Unit 5 of 7 · about 3 hours · implement

Contamination and memorization

Training on the Internet means the test set may already be in the weights. Without overlap checks, a benchmark measures recall, not generalization.

You'll be able to

  • Implement exact and approximate contamination checks between train and evaluation texts and produce a clean subset.
  • Explain memorization, duplicate inflation and why a contaminated score cannot support a capability claim.
  • State the contamination boundary in the release gate with fresh or private evals where needed.

Covers

Exact and approximate contamination checksMemorization, duplicates and unsupported capability claims
1

Read

In this order, only the parts listed

0 of 4 done

  1. CS336 Lecture 12: validity and train-test overlapStanford CS336 - resource accounting, inference and evaluation

    Function validity() with train-test overlap routes (exchangeability paper 2310.17623, reporting norms 2410.08385 with confidence intervals, fresh evals LiveCodeBench and UncheatableEval with unsafe timestamps, private evals with perplexity as the easiest private check) plus dataset quality (SWE-Bench Verified, Platinum, agentic test gaps with Docent)

  2. Modern LLM Notebook 25-evaluation: contamination pitfallsModern LLM Notebook - evaluation and FLOP accounting

    Section 10.1 (contamination as critical with exact, n-gram and embedding matching, check_integrity limits, stale HumanEval toward HumanEval+ and LiveCodeBench, small-data variance)

  3. lm-eval-harness: decontamination guideLanguage Model Evaluation Harness

    13-gram overlap rule from Few-Shot Learners Appendix C with 8 to 13, decontaminate.py n-gram dicts plus training scan, clean benchmark with decontaminate suffix, disabled by default

  4. lm-eval-harness: task decontamination fieldsLanguage Model Evaluation Harness

    should_decontaminate and doc_to_decontamination_query fields for enabling task decontamination

2

Focus on

  • Run both exact and approximate (n-gram or embedding) checks. Exact catches copies, n-grams catch near copies.
  • check_integrity checks task and data plumbing, not training overlap. Do not cite it as decontamination.
  • Duplicates and memorized benchmarks inflate scores without new capability. Prefer fresh or private evals for the headline claim.
  • Report full versus clean side by side. A large drop is evidence of leakage, not a worse model.
Common mistakes · 3
  • Equating deduplication with decontamination. Dedup cleans training, while decontamination checks train versus eval overlap.
  • Trusting timestamps for freshness. Copied text carries old dates into new pages, so scraped evals still need overlap checks.
  • Claiming reasoning from a memorized benchmark. Unique tasks or fresh problems test generalization, while leaked sets test recall.
3

Try it yourself

Closed-book, before checking anything

Write the 13-gram overlap scan from decontamination.md: build eval n-grams, scan training n-grams, mark contaminated docs, and report the metric with a decontaminate suffix on the clean subset.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Which does the harness use for decontamination, and what marks a doc as contaminated?Answer

    13. OpenAI used 8 to 13 by dataset, and the harness fixes 13 for simplicity. A doc is contaminated if any 13-gram overlaps a training doc.

  2. 2.What does check_integrity do, and what does it not do?Answer

    It checks task and data integrity such as config and loading, not train-eval overlap. It cannot replace decontamination.

  3. 3.HumanEval is stale and widely memorized. What should you do?Answer

    Move to HumanEval+ or LiveCodeBench, run overlap checks, and cross-validate with more sets, because 164 items carry high variance on their own.

  4. 4.Full-set accuracy is 85 percent but clean-subset accuracy is 71 percent. What should you claim?Answer

    Report both, headline the clean number, and present the drop as leakage evidence. Never claim broad capability from the full score alone.

You're done when

Your report shows full versus clean scores from an explicit n-gram check, and every capability claim names the evals excluded as contaminated.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 3 more in the section
  • Stanford CS336 - resource accounting, inference and evaluationStanford University · primary

    Use Spring 2026 Lectures 2, 10 and 12 for FLOPs, memory, arithmetic intensity, inference and evaluation. Reproduce the small calculations locally. Assignment 3 IsoFLOPs analysis is optional; do not require its hosted training API or costly experiments.

  • Modern LLM Notebook - evaluation and FLOP accountingWalking Labs · required

    Use English notebook 25-evaluation and Appendix B FLOP and memory accounting. Build a 20-example evaluator with two slices, raw outputs and bootstrap intervals, and deliberately create one parser, prompt or judge failure.

  • Language Model Evaluation HarnessEleutherAI · optional

    After the small evaluator passes, inspect task versioning, request construction and result schemas to understand production evaluation plumbing. Do not use the harness as a substitute for owning the task and metric contract.

Also in this section

  • LLMs from Scratch companion - GPT FLOP analysisSebastian Raschka · required

    Use ch04/02_performance-analysis/flops-analysis.ipynb as a concrete calculator, then rebuild the formulas from the model configuration and reconcile parameters and at least one memory or operation estimate with runtime state.

  • LLM Foundations Checkpoint - evaluation and arithmetic sliceRoadmap-Final · support

    Use the contamination, evaluator-bias, parameter, FLOP, activation, state and KV requirements as the assessment contract. Keep raw outputs and distinguish a verified task result from a broad model capability claim.

  • Stanford CS336 Assignment 3 - IsoFLOPs scalingStanford University · optional

    Use Section 2.1 and Problem chinchilla_isoflops with data/isoflops_curves.json for the bounded curve-fitting exercise only. Do not use the hosted training API or costly experiments.