Certified-Recall Hamming Search for Benchmark Contamination Audits

When a lab reports that its pretraining data was "decontaminated," it almost never states how much contamination its filter could have missed. Standard filters look for shared word sequences (n-grams), so they miss paraphrases and translations of test questions. The one study that searched for such "soft" duplicates with meaning-based embeddings found them for 78% of CodeForces problems in the Olmo3 training data. Its authors also concede that their search was limited by compute and probably undercounts (Soft Contamination Means Benchmarks Test Shallow Generalization).

We propose an audit that reports a found-duplicate count together with a statistical guarantee on how many true duplicates the search could have missed. The method has three parts. Every passage of a pretraining corpus is compressed into a short bitstring, a binary hash, so that two passages can be compared by counting differing bits (the Hamming distance, computed with one XOR and one bit-count instruction). The corpus is then scanned exhaustively rather than approximately. Finally, a search radius is chosen with conformal prediction, a distribution-free calibration method, so that a known fraction of genuine paraphrased, translated, or reformatted benchmark items is guaranteed to fall inside it.

In short, bit codes make an exhaustive semantic scan of a web-scale corpus affordable, and exhaustiveness is what makes a recall guarantee valid. Together they turn "we filtered the data" into a bounded prevalence estimate: at least this many contaminated items, and at most this many.

Core Claim

The question for a contamination audit is not whether a retrieval method finds some duplicates. It is whether we can bound the number it missed. Approximate nearest-neighbor graph indices over dense vectors, such as the HNSW indices common in retrieval systems, add a miss rate that the user never measures. That miss rate compounds with the embedding's own failures, so no radius chosen on held-out data yields a valid recall statement.

Binary codes remove the first source of error. Exact radius search in Hamming space can be done without approximation by splitting each code into $m$ substrings. By the pigeonhole principle, any code within radius $r$ of the query must match at least one substring within radius $\lfloor r/m \rfloor$, so the search is exact while touching only a small fraction of the corpus.

The remaining source of error, the hash itself, can then be calibrated. Let $q$ be a benchmark item, $x$ a corpus passage that is a genuine soft duplicate of it, and $d_H$ the Hamming distance between their codes. Take $n$ held-out calibration pairs whose distances sorted from smallest to largest are $d_{(1)} \le \dots \le d_{(n)}$. Setting the radius to $$r_\alpha = d_{(\lceil (n+1)(1-\alpha) \rceil)}$$ guarantees $P(d_H(q,x) \le r_\alpha) \ge 1-\alpha$ for a new duplicate pair drawn from the same distribution. This is the standard split-conformal quantile argument.

Retrieved candidates are then checked by a verifier, an LLM judge as in the soft-contamination study, which removes false positives. If $k$ verified duplicates are found, the expected true count is at most $k/(1-\alpha)$. The audit therefore reports an interval rather than a lower bound. The interval is valid only for duplicate types represented in calibration, and we treat this caveat as a first-class object of study.

Research Program

The query side and the corpus side are deliberately asymmetric, following the two-tower design of FLORA (Asymmetric Hashing for Fast Ranking via Neural Network Measures). FLORA maps queries and items through separate networks into one binary space so that ranking becomes bitwise; we reuse the idea for a different reason.

Benchmarks are small, a few thousand to tens of thousands of items, so each item can be expanded cheaply into many views. These views are the question stem alone, the stem joined with the correct answer, the answer rationale where one exists, and machine translations into the seven languages that Data Contamination Can Cross Language Barriers showed carry contamination past n-gram filters. The corpus, chunked into passages of about 256 tokens, is encoded once by a single multilingual sentence encoder followed by a learned projection to 128 or 256 bits. At 256 bits, a billion passages occupy 32 GB, which is small enough to stream on one machine.

We build three hash variants of increasing sophistication. The first is plain sign-binarization of the encoder output. The second is a learned projection trained with a standard average-distortion objective. The third, our main variant, is trained to minimize the calibration radius directly. It penalizes the upper quantile of Hamming distances between positive pairs, measured relative to the distance distribution of unrelated passages. This borrows the insight of Near-Isometric Binary Hashing for Large-scale Datasets, which showed that optimizing average distortion sacrifices the critical pairs while a worst-case ($L_\infty$) objective preserves them. We narrow "worst case" to the band of pairs that decide recall, which also avoids NIBH's all-pairs constraint growth.

We also test a bit-reliability weighting inspired by COLA (Conformalized Hierarchical Calibration for Uncertainty-Aware Adaptive Hashing). COLA predicts which bits flip under perturbation and down-weights them in a weighted Hamming distance, and applies conformal prediction to the classification side of domain-adaptive hashing. We instead put the conformal guarantee on retrieval recall, which is the quantity an auditor needs.

Calibration pairs come from generators that mimic known contamination routes. These are LLM paraphrases, background-story rewrites in the style of Inference-Time Decontamination, translations, Choice Confusion distractor swaps from the cross-lingual contamination paper, and reformatting into forum or solution-post style. Training pairs and calibration pairs are kept strictly disjoint.

Conformal guarantees hold only when calibration and deployment duplicates are exchangeable, meaning drawn from the same distribution. COLA itself notes that guarantees degrade under distribution shift, in proportion to the total variation distance between the two distributions. We therefore report recall per duplicate type and measure coverage on duplicate types held out from calibration. The central empirical question is how gracefully the guarantee fails when the contamination route is new.

Baselines

The naive reference point is lexical MinHash deduplication applied between benchmark items and corpus passages, the method used at 15-trillion-token scale in The FineWeb Datasets. It runs on the same corpus shard, with the same benchmark item expansion, using standard shingle sizes and a Jaccard threshold tuned on the same calibration pairs. We expect it to have near-zero recall on translations. The cross-lingual paper reports that translated contamination lifted LLaMA3-8B on MathQA from 42.01% to over 95% while passing n-gram checks. Beating MinHash on translations is therefore trivial, so the meaningful comparison is on English paraphrases.

The strongest existing method is exact dense cosine search with the same encoder, followed by the same LLM verification. This is the pipeline of the soft-contamination study, and the within-cluster variant is SemDeDup (SemDeDup), which runs k-means and compares floating-point vectors only inside clusters. We run both variants with the same encoder, the same compute budget in machine-hours, and the same verifier. Dense search is also given the conformal radius treatment in cosine space, so that the comparison isolates the effect of binarization.

The soft-contamination study reports detection prevalence (78% of CodeForces, 50% of ZebraLogic), not recall against a planted ground truth. No reported result was found on Lacuna for the recall of dense soft-duplicate search against a known set of duplicates. We measure that number ourselves.

Our method beats the dense baseline if, at equal wall-clock budget, it scans a corpus at least an order of magnitude larger at recall within a few points of exact dense search on in-distribution duplicate types. It also beats dense search if, at equal corpus size, it produces a narrower prevalence interval. COLA's reported roughly 30× speedup over dense retrieval gives a prior for the achievable budget gap, but it comes from image benchmarks and must be re-measured on text.

A third baseline is dense search through an approximate HNSW index at matched latency. This shows how much unmeasured miss rate approximate search introduces, which is the core argument for exhaustiveness.

The key ablation compares our three hash variants (sign-binarization, average-distortion learned, radius-targeted learned) under an identical conformal procedure. It isolates whether learning the codes matters, or whether the guarantee alone is the contribution.

Why not just…?

Why not just use MinHash, since it already runs at trillion-token scale? It measures shared word sequences, and the evidence that soft contamination evades it is direct. Olmo3's data passed standard decontamination yet contained semantic duplicates that gave roughly 20% gains on MuSR (Soft Contamination Means Benchmarks Test Shallow Generalization). Translated benchmarks evade it completely. We keep MinHash as the floor baseline and expect it to remain competitive only on near-verbatim copies.

Why not just binarize off-the-shelf embeddings by their signs and skip learning a hash? This is a real threat, and we treat it as a likely outcome rather than argue around it. The certified-recall audit is independent of the hash, so if sign-binarization matches the learned radius-targeted hash, the contribution becomes the exhaustive-scan-plus-conformal procedure with the simplest possible codes. That is still the first contamination audit with a stated miss bound. The ablation above decides this, and we will report whichever result holds.

Why not just run dense cosine search, perhaps with HNSW, and calibrate that? Exact dense search can be calibrated just as well, and on small corpora it should win on recall. The argument for bits is purely one of budget. Exact dense scanning of a web-scale corpus is what forced SemDeDup to restrict comparisons to clusters and led the soft-contamination authors to admit undercounting. HNSW is fast but approximate, and its misses break the guarantee. The matched-budget and approximate-index baselines test both points.

Why not just detect contamination from the model's behavior, with tools like PaCoST, ConStat, or CAP, and never touch the corpus? These methods perturb benchmark questions and test the model's confidence or accuracy gap: PaCoST, ConStat, and CAP. They need no corpus access, which is a real advantage for closed models. However, On The Fragility of Benchmark Contamination Detection in Reasoning Models shows that reinforcement-learning post-training collapses the relevant signal. The LiRA detector falls from 89.1% AUROC to near chance, and after chain-of-thought training detectors average 50–58% AUROC. Corpus-side auditing does not depend on the model's internals. We run PaCoST and ConStat as complementary checks on the models trained in our experiments, not as substitutes.

Proposed Experiments

The first experiment is a planted-contamination test on FineWeb. We sample a one-billion-passage shard of FineWeb (HuggingFaceFW/fineweb) and insert known contaminants derived from MMLU, ARC, GSM8K, and MathQA test items. The contaminants are paraphrases, story rewrites, seven-language translations, and Choice Confusion variants, inserted at controlled rates with a subset duplicated many times, since Data Contamination: From Memorization to Exploitation found that repetition drives exploitation.

For each method we measure recall, verified precision, wall-clock time, memory, and empirical coverage of the $1-\alpha$ guarantee at $\alpha \in \{0.05, 0.1\}$. Coverage is measured separately for duplicate types included in calibration and held out from it. The decisive check is whether empirical coverage on in-distribution types sits at or above $1-\alpha$, as theory predicts. The most informative number is how far coverage falls on held-out types.

The second experiment is a real-world replication on the Olmo3 data (Dolma3 and Dolmino) against CodeForces, ZebraLogic, MuSR, and MBPP. We compare our interval against the soft-contamination study's point prevalence of 78% for CodeForces. A found count above theirs at lower compute would confirm their suspected undercount, and an upper bound near their figure would suggest they missed little.

The third experiment tests downstream consequences. We train small models on a FineWeb shard in three conditions: raw, decontaminated by MinHash, and decontaminated by our method. Evaluation uses the planted benchmarks and the Choice Confusion probe. The Choice Confusion probe is a strong signal here, because its authors report that clean models gain about 26 points on the generalized version while contaminated models drop about 17. The check is whether our filter removes the contaminated-model signature where MinHash does not.

The fourth experiment is a secondary search-time check. Search-Time Data Contamination found that search agents retrieved answer keys from public mirrors, reaching 37.5% versus 17.4% on contaminated versus uncontaminated HLE questions, and their detection relied on URLs and keywords. We re-host reformatted HLE and SimpleQA answer keys on unflagged pages. We then test whether Hamming screening of retrieved documents against the benchmark index flags them within per-query latency budgets, where URL filtering cannot.

The project fails in an informative way under two outcomes. If held-out-type coverage collapses, conformal guarantees for contamination audits hold only for anticipated leak routes, which the field should know. If sign-binarization matches every learned hash, the learning-to-hash component adds nothing to this problem, and the certified exhaustive scan stands alone as the contribution.