Content hash: 9ad87bb5d06a974243196dc93de856fadefb3462f87a24c006df2f70023ee206
## Synthetic Data Pipeline Reference
### JSONL format by use case
**Instruction tuning (SFT):**
```json
{"instruction": "Explain RAG", "input": "", "output": "RAG is..."}
```
**Preference pairs (DPO/IPO):**
```json
{"prompt": "Explain RAG", "chosen": "RAG combines retrieval...", "rejected": "RAG is bad."}
```
**Function calling:**
```json
{"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "tool_calls": [...]}],
"tools": [...]}
```
### Quality filter thresholds (starting points)
| Filter | Threshold |
|--------|-----------|
| Dedup similarity | Cosine > 0.85 = duplicate |
| Min output length | 10 chars |
| Max output length | 2000 chars |
| Toxicity score | < 0.1 (use detoxify/lib) |
| Quality judge score | > 3/5 (LLM judge) |
### Teacher model selection
| Priority | Model | Reason |
|----------|-------|--------|
| Quality | Claude 3.5 Sonnet / GPT-4o | Best instruction following |
| Speed + cost | GPT-4o-mini | 10x cheaper, still strong |
| Open source | Llama 3.1 70B / Qwen 2.5 72B | Self-hosted, no API cost |
### Reproducibility checklist
- [ ] Lock teacher model + version + temperature in config file
- [ ] Version the generated dataset (git + hash)
- [ ] Hold out human eval set (never train on it)
- [ ] Report clean rate from spot-check (e.g. 95%+ clean)
- [ ] Confirm diversity: coverage across seed categories
### Common failure modes
- **Mode collapse**: all outputs look identical -> need more template diversity
- **Teacher hallucination**: teacher fabricates facts -> verify against knowledge base
- **Distribution shift**: training data doesn't match deployment -> seed from real user queries