7 routes42 sections324 units

Unit 4.5 · about 3 h

315 / 324

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.

  • implement

You can now

  • 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 checks
  • Memorization, duplicates and unsupported capability claims

Study, in this order

4 steps

  1. CS336 Lecture 12: validity and train-test overlap
    Stanford 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 pitfalls
    Modern 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 guide
    Language Model Evaluation Harness

    13-gram overlap rule from Few-Shot Learners Appendix C with \(N\) 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 fields
    Language Model Evaluation Harness

    should_decontaminate and doc_to_decontamination_query fields for enabling task decontamination

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.

Reproduce closed-book

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.

Traps

  • 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.

Practice

The section mini-project covers this: exact and approximate contamination checks between the tiny train corpus and the eval set, with full versus clean reporting.

Self-test

  1. Which \(n\) does the harness use for decontamination, and what marks a doc as contaminated?

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

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

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

Completion criterion

Stop when

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

Mark passed, then open 4.6 Only mark this when you can do it without notes.

Leads to

Comes after

Resources for this unit

  • Stanford CS336 - resource accounting, inference and evaluation
    Stanford Universityprimarycourse
    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 accounting
    Walking Labsrequiredimplementation
    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 Harness
    EleutherAIoptionalreference
    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 analysis
    Sebastian Raschkarequiredimplementation
    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 slice
    Roadmap-Finalsupportassessment
    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 scaling
    Stanford Universityoptionalpractice
    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.

Quick find

Search Michi

Type to search every route, section, unit, topic and resource.

Enter opens the first result Esc closes

Reference

Keyboard shortcuts

n
Continue to the first unit not passed
j / k
Next / previous unit
1 2 3
Toggle learned, practised, passed
/
Open search
?
Show this help
Esc
Close open panels