# Preparing Fine-Tuning Datasets

> Collect, clean, format and split training examples; data quality matters far more than quantity. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/ai-engineer/fine-tuning-data
Last updated: 2026-11-28

Collect, clean, format and split training examples; data quality matters far more than quantity.

Intermediate · about 5 hours · difficulty 3/5

Learn first: [Prompting vs RAG vs Fine-Tuning](https://www.internhack.in/roadmaps/tracks/ai-engineer/when-to-fine-tune), [Building Golden Datasets](https://www.internhack.in/roadmaps/tracks/ai-engineer/golden-datasets)

A fine-tuned model learns exactly what your data shows it, including mistakes. Most of the work in fine-tuning is **data work**.

### Formats

- **Supervised fine-tuning (SFT)** uses input and ideal output pairs, usually as chat-format JSONL: a list of messages with system, user and assistant roles.
- **Preference data** uses a prompt plus a preferred and a rejected response, for methods like DPO.
- Match the format your training tool or provider expects exactly, including any chat template.

### Sources

- Logged production outputs that humans reviewed or corrected.
- Expert-written examples for the hardest cases.
- Outputs from a larger model that you filter for quality (this is distillation, covered next).

### Quality checklist

- **Consistency**: examples should agree with each other on format and style. Contradictions teach confusion.
- **Coverage** of the real input distribution, including edge cases and refusals.
- **Deduplication** and removal of near-duplicates.
- **PII scrubbing** and licence checks on anything you did not write.
- **Held-out eval split** never seen during training, and ideally your existing golden set.

### How much data?

A few hundred high-quality examples can shift format and style; complex tasks may need thousands. Start small, train, evaluate, then add data targeted at the failure categories you see.

### Good enough to move on

You can produce a clean, deduplicated chat-format JSONL dataset with train and eval splits and a short data card describing its sources and known gaps.

## Key concepts

- **Chat-format JSONL**
- **SFT vs preference data**
- **Sourcing examples**
- **Consistency and deduplication**
- **Chat templates**
- **Train and eval splits**
- **Data cards**

## Mini project

Turn 500 logged support replies into a fine-tuning dataset: filter to human-approved answers, deduplicate, scrub PII, convert to chat JSONL, and hold out 50 for evaluation.

## Check yourself

Half your examples end with a sign-off and half do not. What will the fine-tuned model likely do?

## Free resources

- [OpenAI docs: supervised fine-tuning](https://platform.openai.com/docs/guides/supervised-fine-tuning) (OpenAI)
- [Hugging Face: chat templates](https://huggingface.co/docs/transformers/chat_templating) (Hugging Face)
- [Hugging Face datasets documentation](https://huggingface.co/docs/datasets) (Hugging Face)

Previous: [Prompting vs RAG vs Fine-Tuning](https://www.internhack.in/roadmaps/tracks/ai-engineer/when-to-fine-tune) · Next: [Hosted Fine-Tuning Services](https://www.internhack.in/roadmaps/tracks/ai-engineer/hosted-fine-tuning)

## More in Fine-Tuning and Model Customization

- [Prompting vs RAG vs Fine-Tuning](https://www.internhack.in/roadmaps/tracks/ai-engineer/when-to-fine-tune)
- [Preparing Fine-Tuning Datasets](https://www.internhack.in/roadmaps/tracks/ai-engineer/fine-tuning-data)
- [Hosted Fine-Tuning Services](https://www.internhack.in/roadmaps/tracks/ai-engineer/hosted-fine-tuning)
- [LoRA and Parameter-Efficient Fine-Tuning](https://www.internhack.in/roadmaps/tracks/ai-engineer/lora-peft)
- [Distillation and Small Models](https://www.internhack.in/roadmaps/tracks/ai-engineer/distillation)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [AI Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/ai-engineer)
