Topic 2 of 5 · 5 min read
Curating a small high-quality dataset
Goal: Review a sample of training rows and flag the duplicates, inconsistent answers and off-distribution inputs to remove.
For supervised fine-tuning, a few hundred to a few thousand examples that are clean, consistent and shaped like real traffic usually beat a huge pile of noisy ones. Curation is the main work, not the training run.
Check yourself · 1 of 3
What does supervised fine-tuning teach most reliably?
Why it matters
SFT mostly teaches the model a style, a format and a way of handling your task. It adds little new knowledge. The LIMA paper tuned a large model on about 1,000 carefully selected examples and got strong results, which supports the idea that quality and diversity matter more than count. Every bad row is a lesson the model will repeat.
How to do it
- Start from real inputs. Sample actual user requests, tickets or documents from production (after the privacy step). Invented inputs drift away from what the model will see.
- Write the target answers to one standard. Decide the format, tone, length and what to do when information is missing. Put it in a short style sheet that every labeller uses.
- Deduplicate. Remove exact copies and near copies. Duplicates make the model over-weight those cases, and research on deduplication shows it reduces memorisation.
- Check consistency. Group similar inputs and read their answers side by side. If one says "refund approved" and a near twin says "escalate", the model learns noise.
- Cover the spread. Include the easy cases, the hard ones, the typos, the empty input and the cases where the right answer is to refuse or ask a question.
- Remove off-distribution rows. Examples the model will never meet (another language, another product) only dilute the signal.
- Start small, then grow. Tune on 200 rows, read the failures, and add examples that target them.
Before and after
Weak sample from a ticket-triage set:
| Input | Answer |
|---|---|
| Two charges for March | billing |
| two charges for march | billing |
| Double charged in March | payments |
| asdf test | billing |
Rows one and two are the same case. Row three contradicts them. Row four is junk that happened to be labelled. After curation: keep one of the first two, resolve the label with the style sheet (billing or payments, not both), and delete the junk row.
What goes wrong
- Scale as a goal. Scraping 50,000 rows of mixed quality locks in their errors.
- Many labellers, no style sheet. The model averages their habits into inconsistent behaviour.
- Only happy paths. The tuned model has never seen a refusal or a missing field, so it invents one.
- Evaluation rows mixed in. Anything you will test on must stay out of training.
Examples
Reading twin rows
Sort rows by input similarity and read each cluster. Two near-identical complaints labelled billing and payments are not two classes, they are one unresolved style decision. Pick one label in the style sheet and fix both rows.
Growing from 200 rows
Tune on 200 reviewed rows. Run 50 held-out inputs and list the failures: most are long inputs with several issues. Write 40 new examples with multi-issue inputs, retrain, and compare. Each round adds data where the model is actually weak.
Key points
- Format, tone and handling of edge cases are what SFT teaches best, so make them consistent.
- About 1,000 curated examples were enough in the LIMA study to shape a model's response style.
- Remove exact and near duplicates, and rows whose answers contradict similar rows.
- Sample inputs from real traffic and include hard, messy and refusal cases.
- Start with a small set, read the failures, and add examples that target them.
Common mistakes
- Chasing row count with scraped or auto-labelled data nobody has read.
- Letting several labellers answer in different styles without a written standard.
- Leaving out refusals, empty inputs and ambiguous cases, so the model never learns what to do with them.
- Training on invented inputs that look nothing like production traffic.
Check yourself · 2 of 3
Two training rows have near-identical inputs but one answer says "approve" and the other "escalate". What is the best action?
Check yourself · 3 of 3
A team has 40,000 scraped support replies of mixed quality. What is the best first step before tuning?
Practice items, not counted towards your mastery.
Start here
- OpenAI: Supervised fine-tuning guide (opens in a new tab)DocsFree
How a hosted provider expects training data to be formatted, sized and evaluated.
- Hugging Face TRL: SFT Trainer (opens in a new tab)DocsFree
How an open-source trainer reads conversational data and masks the loss.
- Chat templates (Hugging Face Transformers) (opens in a new tab)DocsFree
Shows how a model's chat template turns messages into the exact training text.
More for this topic
- LIMA: Less Is More for Alignment (Zhou et al.) (opens in a new tab)PaperFree
Evidence that about 1,000 carefully curated examples can shape a model's response style.
- Deduplicating Training Data Makes Language Models Better (Lee et al.) (opens in a new tab)PaperFree
Shows that removing duplicate text reduces memorisation and improves models.