Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Scan training data for benchmark contamination — n-gram overlap, embedding similarity, and exact canary detection against 60+ evaluation datasets.
.claude/skills/mkurman-benchmark-contamination-scan/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 36% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 1% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 14% | 0% |
| case-11 | ✗→✓ | ▲ Improved | -9% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 6% | 0% |
Training on benchmarks is the cardinal sin of ML. This skill scans your training data against a curated exclusion list of 60+ benchmarks using n-gram overlap (fast, high recall) and embedding similarity (slow, high precision).
Mandatory before every training run. Run on pre-training data, instruction tuning data, and RL alignment data.
pythonBENCHMARKS = { "mmlu": {"name": "MMLU", "source": "huggingface://cais/mmlu"}, "hellaswag": {"name": "HellaSwag", "source": "huggingface://Rowan/hellaswag"}, "gsm8k": {"name": "GSM8K", "source": "huggingface://gsm8k"}, "humaneval": {"name": "HumanEval", "source": "huggingface://openai_humaneval"}, "boolq": {"name": "BoolQ", "source": "huggingface://boolq"}, "arc": {"name": "ARC", "source": "huggingface://ai2_arc"}, "winogrande": {"name": "Winogrande", "source": "huggingface://winogrande"}, "piqa": {"name": "PIQA", "source": "huggingface://piqa"}, "siqa": {"name": "Social IQA", "source": "huggingface://social_i_qa"}, "openbookqa": {"name": "OpenBookQA", "source": "huggingface://openbookqa"}, "squad": {"name": "SQuAD", "source": "huggingface://rajpurkar/squad"}, "natural_questions": {"name": "Natural Questions", "source": "huggingface://natural_questions"}, "triviaqa": {"name": "TriviaQA", "source": "huggingface://trivia_qa"}, "medqa": {"name": "MedQA", "source": "huggingface://bigbio/med_qa"}, "pubmedqa": {"name": "PubMedQA", "source": "huggingface://pubmed_qa"}, # Add all evaluation datasets used in your project }
pythonfrom collections import defaultdict import hashlib class ContaminationScanner: def __init__(self, n=13): self.n = n self.benchmark_ngrams = {} self._load_benchmarks() def _ngrams(self, text): tokens = text.split() return set(" ".join(tokens[i:i+self.n]) for i in range(len(tokens) - self.n + 1)) def _load_benchmarks(self): """Load and hash all benchmark texts.""" for bid, bm in BENCHMARKS.items(): try: ds = load_dataset(bm["source"], split="test") all_ngrams = set() for example in ds: text = " ".join(str(v) for v in example.values() if isinstance(v, str)) all_ngrams.update(self._ngrams(text)) self.benchmark_ngrams[bid] = { "ngrams": all_ngrams, "n_examples": len(ds), } except Exception as e: print(f"Could not load {bm['name']}: {e}") def scan_example(self, text): """Check a single training example. Returns list of [benchmark, n_matches].""" example_ngrams = self._ngrams(text) if not example_ngrams: return [] hits = [] for bid, bm_data in self.benchmark_ngrams.items(): overlap = len(example_ngrams & bm_data["ngrams"]) if overlap > 0: hits.append({"benchmark": BENCHMARKS[bid]["name"], "n_matching_ngrams": overlap}) return hits def scan_dataset(self, examples, threshold=5): """Scan full dataset. threshold = min matching ngrams to flag.""" contaminated = [] for i, example in enumerate(examples): text = " ".join(str(v) for v in example.values() if isinstance(v, str)) hits = self.scan_example(text) if any(h["n_matching_ngrams"] >= threshold for h in hits): contaminated.append({"index": i, "hits": hits}) return contaminated
For semantic contamination (paraphrased benchmarks):
pythonfrom sentence_transformers import SentenceTransformer, util model = SentenceTransformer("all-MiniLM-L6-v2") def embedding_scan(text, benchmark_texts, threshold=0.85): emb_text = model.encode(text) emb_bench = model.encode(benchmark_texts) scores = util.cos_sim(emb_text, emb_bench)[0] hits = [(i, float(s)) for i, s in enumerate(scores) if s > threshold] return hits
markdown# Contamination Scan Report Date: [YYYY-MM-DD] N-gram size: 13 Bencharks scanned: [N] Training examples: [N] Contaminated examples: [N] (X.X%) Excluded from training: [N] ## By Benchmark | Benchmark | Contaminated | Action | |-----------|-------------|--------| | MMLU | 142 | Removed | | HellaSwag | 18 | Removed |
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-21 | pass→pass | 8,535 | 2,867 | -66% | 1 | 1 | 0% | 1,533 | 1,815 | +18% | 0 | 0 | — |
case-01 | fail→pass | 20,090 | 21,859 | +9% | 1 | 1 | 0% | 4,413 | 6,019 | +36% | 0 | 0 | — |
case-02 | fail→fail | 20,738 | 17,256 | -17% | 1 | 1 | 0% | 4,212 | 5,425 | +29% | 0 | 0 | — |
case-03 | pass→fail | 19,618 | 13,931 | -29% | 1 | 1 | 0% | 3,433 | 4,064 | +18% | 0 | 0 | — |
case-04 | pass→pass | 16,014 | 14,890 | -7% | 1 | 1 | 0% | 2,924 | 4,206 | +44% | 0 | 0 | — |
case-05 | pass→pass | 22,705 | 19,658 | -13% | 1 | 1 | 0% | 4,204 | 5,136 | +22% | 0 | 0 | — |
case-06 | pass→pass | 11,716 | 5,712 | -51% | 1 | 1 | 0% | 1,832 | 2,295 | +25% | 0 | 0 | — |
case-07 | fail→pass | 13,636 | 5,720 | -58% | 1 | 1 | 0% | 2,261 | 2,285 | +1% | 0 | 0 | — |
case-08 | pass→pass | 8,749 | 2,034 | -77% | 1 | 1 | 0% | 1,405 | 1,745 | +24% | 0 | 0 | — |
case-09 | fail→pass | 14,573 | 6,883 | -53% | 1 | 1 | 0% | 2,253 | 2,575 | +14% | 0 | 0 | — |
case-10 | pass→pass | 11,418 | 5,158 | -55% | 1 | 1 | 0% | 1,746 | 2,297 | +32% | 0 | 0 | — |
case-11 | fail→pass | 15,515 | 5,732 | -63% | 1 | 1 | 0% | 2,685 | 2,454 | -9% | 0 | 0 | — |
case-12 | pass→pass | 13,194 | 6,283 | -52% | 1 | 1 | 0% | 1,737 | 2,433 | +40% | 0 | 0 | — |
case-13 | fail→pass | 14,560 | 8,689 | -40% | 1 | 1 | 0% | 3,018 | 3,213 | +6% | 0 | 0 | — |
case-14 | fail→pass | 10,232 | 1,773 | -83% | 1 | 1 | 0% | 1,593 | 1,663 | +4% | 0 | 0 | — |
case-15 | pass→pass | 15,364 | 17,056 | +11% | 1 | 1 | 0% | 2,448 | 4,242 | +73% | 0 | 0 | — |
case-16 | pass→pass | 17,211 | 16,332 | -5% | 1 | 1 | 0% | 2,847 | 3,869 | +36% | 0 | 0 | — |
case-17 | fail→pass | 16,516 | 3,784 | -77% | 1 | 1 | 0% | 2,698 | 1,956 | -28% | 0 | 0 | — |
case-18 | fail→pass | 17,928 | 13,595 | -24% | 1 | 1 | 0% | 3,118 | 3,589 | +15% | 0 | 0 | — |
case-19 | fail→pass | 10,871 | 2,929 | -73% | 1 | 1 | 0% | 1,905 | 1,894 | -1% | 0 | 0 | — |
case-20 | fail→pass | 12,789 | 3,958 | -69% | 1 | 1 | 0% | 2,251 | 2,153 | -4% | 0 | 0 | — |
case-22 | pass→pass | 15,099 | 23,295 | +54% | 1 | 1 | 0% | 2,866 | 6,460 | +125% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +41 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.