Why do you deduplicate fine-tuning data, and how would you actually do it?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Because duplicates silently reweight your dataset and drive memorisation. If 20% of a set is duplicated and you train 3 epochs, those examples are effectively seen ~6 times while the rest are seen 3. You did not choose that mixture, the scraper did. Duplicates also inflate held-out metrics whenever a near-copy straddles the train/test split, and heavy repetition of a single response teaches the model to emit that response as a canned answer.
Full worked answer with diagram
Because duplicates silently reweight your dataset and drive memorisation. If 20% of a set is duplicated and you train 3 epochs, those examples are effectively seen ~6 times while the rest are seen 3. You did not choose that mixture, the scraper did. Duplicates also inflate held-out metrics whenever a near-copy straddles the train/test split, and heavy repetition of a single response teaches the model to emit that response as a canned answer.
The pipeline I run, in order:
- Normalise: strip whitespace, unicode-normalise, lowercase for hashing only.
- Exact dedup: hash the normalised text, drop collisions. Cheap, catches a surprising amount.
- Near-dup: MinHash over ~5-gram shingles with LSH banding, Jaccard threshold around 0.8. Linear time, CPU only, minutes on 100k examples.
- Semantic dedup: embed, then drop near neighbours above a cosine threshold (~0.95) or cluster and cap per cluster. Catches paraphrases that MinHash misses.
- Decontaminate against every eval set you plan to report, using the same overlap machinery.
Dedup the prompt and the response separately, because they fail differently. Many near-identical prompts with conflicting answers teach inconsistency. Identical responses to different prompts teach a canned reply.
The part people get wrong is over-dedup. Some repetition is signal: if 30% of production traffic is the same intent, collapsing it to one example makes your training distribution stop matching reality. Prefer capping counts per cluster over dropping to a single instance. And always dedup before you split, never after, or your test set leaks.
Worth sketching. the order is load-bearing: everything happens before the split, never after.
flowchart LR
A["Raw examples"] --> B["Normalise<br/>whitespace and unicode"]
B --> C["Exact hash dedup"]
C --> D["MinHash LSH<br/>Jaccard ~0.8"]
D --> E["Embedding dedup<br/>cosine ~0.95"]
E -->|"cap per cluster,<br/>not down to one"| F["Decontaminate against<br/>every eval set"]
F --> G["Only now split<br/>train and test"]
What a good answer covers
- Because duplicates silently reweight your dataset and drive memorisation
- If 20% of a set is duplicated and you train 3 epochs, those examples are effectively seen ~6 times while…
- You did not choose that mixture, the scraper did
- Duplicates also inflate held-out metrics whenever a near-copy straddles the train/test split, and heavy…
- Normalise: strip whitespace, unicode-normalise, lowercase for hashing only
In the glossary: Memorisation · Eval set
Interviewer follow-ups to expect
Why is MinHash preferred over pairwise cosine similarity at scale?
How would you pick the Jaccard threshold rather than just taking 0.8 on faith?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep