detect-eval-set-contamination
Use when an eval or benchmark score looks too good, or a test set predates a model's training cutoff. Measures prompt and answer overlap with the training corpus.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- detect-eval-set-contamination
- description
- Use when an eval or benchmark score looks too good, or a test set predates a model's training cutoff. Measures prompt and answer overlap with the training corpus.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md355 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Detect Eval-Set Contamination
A model that has seen the test items scores on memory, not ability. Contamination is the default state for any public eval older than the training cutoff, so measure it rather than assume it away.
Procedure
- Pin the eval's release date and the model's training cutoff. Any public split published before the cutoff is presumed contaminated until shown otherwise.
- Measure n-gram containment: for each item, compute the longest shared word run with the nearest corpus document. A 13-gram match is the standard memorisation signal.
def has_match(item, docs, n=13): words = item.split() grams = set(tuple(words[i:i+n]) for i in range(len(words)-n+1)) return any(grams & set(tuple(d.split()[i:i+n]) for i in range(len(d.split())-n+1)) for d in docs) - Do it on answers, not just questions. Multiple-choice items contaminate through the option text and label order, not only the stem.
- Check paraphrase leakage: a model may not recall the exact string but a close variant. Use MinHash near-duplicate detection with a Jaccard threshold of 0.8.
- Run the canary test: prepend a random GUID to each item, ask the model to complete the prefix, and see whether it reproduces the gold answer.
- Compare contaminated vs clean subsets when you can segment them (e.g. by publication date). The gap is the contamination effect size.
- Report contamination as a number — percent of items with a >=13-gram match — not a yes/no.
python3 tools/contaminate.py --eval mmlu.jsonl --corpus pile/*.txt --ngram 13 > contam.tsv
Pitfalls
- Checking only the question stem misses answer-side and option-order leakage.
- A web-crawled corpus changes under you; record the corpus snapshot hash next to the score.
- Substring search is not enough — tokenisation differences (whitespace, unicode) hide exact matches.
- A held-out set you authored after the model's release is clean only if it was never published or used in any fine-tune.
- Assuming a "private" eval is clean misses a downstream fine-tune; check the training data card.
Verification
wc -l contam.tsv # count flagged items; divide by total items for the contamination rate
Report: "12% of the eval set has a >=13-gram match with the pretraining corpus; the model's 94% drops to 79% on the uncontaminated subset — treat the headline as inflated."
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.