Spot the flaw: 'We fine-tuned on 10K examples and eval on a random 500 from the same dataset. Accuracy is 94%, so the model is ready for production.'
Click any words you think contain an error. Click again to unmark.
The eval set was drawn from the same pool as the training data. The 94% accuracy may measure memorization, not generalization. Use a held out set collected independently.
Imagine a teacher gives students a practice test with 100 questions, then tests them on 10 questions randomly picked from the same 100. The students score well because they already practiced those exact questions. The teacher thinks the students understand the material, but they might just have good memories. A fair test would use new questions the students have never seen, drawn from a different source. That is what a held out eval set does for a model.
Detailed answer & concept explanation~4 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Open by naming the flaw: train eval contamination from drawing the eval set from the training pool. Walk the two layers: exact overlap (memorization) and distribution leakage (shared bias). Explain the fix: split before training, independent collection, contamination check as a pipeline gate. Cover the generalization gap metric. Close on why the 94% number is untrustworthy and what a trustworthy eval design looks like.
Real products, models, and research that use this idea.
- Kaggle competitions enforce strict train test splits with hidden test sets specifically to prevent this class of leakage, and contestants who accidentally train on test data are disqualified.
- The Alpaca Eval and LMSYS Chatbot Arena leaderboards have documented cases where models scored higher on benchmarks contaminated into their training data, leading to contamination detection becoming a standard part of evaluation.
- Production ML teams at major tech companies run contamination detection pipelines that hash every training example and check against eval sets before reporting any metric, catching leakage that manual inspection misses.
- The Open LLM Leaderboard on Hugging Face added contamination detection after discovering that some submitted models had benchmark data in their training sets, inflating scores by 5 to 15 points.
What an interviewer would ask next. Try answering before peeking at the approach.
QYou verified zero exact overlap between train and eval, but the eval accuracy is still suspiciously high. What else could cause inflated scores?
QHow would you design a contamination detection pipeline that runs automatically in CI?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Drawing the eval set from the same pool as training data and interpreting high accuracy as evidence of generalization rather than memorization.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.