When a language model has trained on a benchmark question, it tends to walk the same path through the problem every time it is asked. When it has only learned the general skill, it wanders more. A recent detector built on this intuition asks a model for an answer and then for an alternative solution, records how uncertain the model is at each generated token, and compares the two uncertainty traces. That detector is the only one in our file that still works after reinforcement-learning post-training, which erases the likelihood signals older detectors rely on. It reaches only about 0.70 area under the ROC curve (AUC), and it has two blind spots. First, it compares the traces as fixed-length vectors, so a model that re-walks a memorized path with a few inserted words looks less rigid than it is. Second, it cannot distinguish a model that memorized this item from a model that has become rigid on every item of this type, which is exactly the failure that makes contamination in modern reasoning models look invisible.
We propose to measure contamination as a rigidity gap: how much more repetitive a model's reasoning trajectory is on a benchmark item than on minimally perturbed twins of that item (same problem, changed numbers or entities). Trajectories are compared with an elastic alignment that tolerates insertions and pacing differences. The alignment comes from a family of curve distances that runs from dynamic time warping, which sums matched costs, to the Fréchet distance, which charges only the worst matched pair. The twin contrast is the main ingredient. The alignment is a supporting measurement choice that we test rather than assume.
Core Claim
Reinforcement learning (RL) after contamination hides the evidence that likelihood detectors use, but it does not remove behavioral memorization. It adds a global loss of diversity that swamps per-item signals. On The Fragility of Benchmark Contamination Detection in Reasoning Models shows that one epoch of clean GRPO (a PPO-style RL algorithm) after contaminated supervised fine-tuning drives reference-free detectors to roughly 50% AUROC. It also shows that chain-of-thought contamination of DeepSeek-R1-Distill-Llama-8B leaves ten detectors at 50–58% AUROC, because the model generalizes memorized reasoning templates to unseen items of the same distribution. That second finding is what motivates the design. If templates generalize, raw rigidity is high for members and non-members alike, and the informative quantity is the difference between an item and its near-identical twins.
We claim that twin-contrasted, alignment-based rigidity separates members from non-members in both RL-stage and SFT-then-RL contamination, where likelihood detectors are near chance. The detector needs only sampled generations plus top-k token log-probabilities, and a token-only variant needs no probabilities at all.
Relation to Prior Work
The closest work is Detecting Data Contamination from Reinforcement Learning Post-training for Large Language Models. It records token-level entropy for a greedy answer and for a self-critique alternative, and it scores their length-penalized cosine similarity. It reports average AUC of 0.70 on Qwen2.5-7B-Instruct and 0.64 on DeepSeek-Math-7B-Instruct on the RL-MIA benchmark. It supplies our probing protocol. We differ from it in two ways. It scores absolute rigidity, whereas we score rigidity relative to perturbed twins. And we replace padded-vector cosine with elastic alignment. As far as the file shows, it was not evaluated in the SFT-then-RL cloaking setting, and we treat that setting as the main test.
Representation-based detectors constrain the problem rather than solve it. How Contaminated Is Your Benchmark? Measuring Dataset Leakage in Large Language Models with Kernel Divergence measures how much a short LoRA fine-tune reshapes a kernel similarity matrix over hidden states. DICE locates the layer that moves most relative to a clean reference model and trains a probe there. A Narrowing Geometry in Contaminated Reasoning finds that contaminated prompts funnel activations through few principal directions. All three need white-box access, and DICE also needs a clean twin model. We need only a twin item, and we operate on outputs.
The likelihood detectors, MIN-K% PROB and Min-K%++, score low-probability tokens. They are the negative evidence that motivates the work: on RL-MIA they sit at 0.42–0.53 AUC.
The measurement method comes from the similarity literature. Products of Euclidean Metrics, Applied to Proximity Problems among Curves shows that dynamic time warping and the discrete Fréchet distance are two ends of one family of coupling costs. We use that family to compare uncertainty traces. We do not use its nearest-neighbor data structures, since our curves are compared pairwise and in small numbers. For the token channel we reuse Computation of Similarity Measures for Sequential Data using Generalized Suffix Trees, which computes n-gram similarity coefficients, including non-metric ones like Kulczynski, in time linear in sequence length regardless of n-gram length. That paper found the Kulczynski coefficient markedly better than a linear kernel for intrusion detection (78% versus about 48% of attacks at zero false positives), which is our reason to include non-metric coefficients.
Method
For item $x$, sample one greedy generation and $m$ alternatives using the self-critique prompt. Each generation is a curve $A=(a_1,\dots,a_n)$. Each point $a_t$ holds the token's entropy, which is computed from top-k log-probabilities when the full distribution is unavailable, together with the top-1 probability. Two curves are compared by
$$d_p(A,B)=\min_{C}\Big(\sum_{(i,j)\in C}\lVert a_i-b_j\rVert^p\Big)^{1/p},$$
where $C$ ranges over monotone couplings of the two index sequences. Setting $p=1$ gives dynamic time warping, and letting $p\to\infty$ gives the discrete Fréchet distance. In parallel, a generalized-suffix-tree n-gram similarity $g(A,B)$ is computed on the token strings.
The rigidity $R(x)$ is the mean similarity between the greedy curve and the alternatives, using $\exp(-d_p/\tau)$ for the trace channel and $g$ for the token channel. The contamination score is
$$S(x)=R(x)-\frac{1}{|T(x)|}\sum_{x'\in T(x)}R(x'),$$
where $T(x)$ is a set of twins with the same structure but altered surface values. Twin generation is procedural for Knights & Knaves and 3-SAT, reuses number-perturbed versions in the style of GSM-hard for grade-school math, and for AIME is done by hand-checked number substitution on the subset where the answer can be recomputed.
Twins can change difficulty, and difficulty alone changes rigidity. To control for this, when a pre-contamination base model is available we subtract its own gap $S_{\text{base}}(x)$. We also report the uncalibrated score, so that the method's usefulness does not depend on having a base model.
Research Program
The work has three parts, in order of importance. First, it tests whether twin contrast recovers signal in the cloaking regimes where every current detector is near chance. Second, it measures whether elastic alignment adds anything over cosine, and which end of the distance family carries the signal. A signal concentrated at $p\to\infty$ would mean contamination shows up as a single pinned step, such as a memorized intermediate value. A signal concentrated at $p=1$ would mean diffuse, path-wide repetition. Third, it compares the entropy-trace channel with the token-string channel, which determines whether the method can run on APIs without log-probabilities.
Baselines
The naive reference points are perplexity thresholding and Min-K%++, run on identical items and models. On RL-MIA they are reported at 0.42–0.53 AUC for PPL and Min-K% by the RL post-training paper. In the reasoning-model regimes, the fragility paper reports near-50% AUROC for reference-free methods after clean GRPO, and 50–58% AUROC for ten methods under chain-of-thought contamination. We rerun them rather than copying numbers, so that splits match.
The strongest existing method on this question is Self-Critique entropy cosine. Its reported AUC on RL-MIA is 0.70 on Qwen2.5-7B-Instruct and 0.64 on DeepSeek-Math-7B-Instruct. Our method uses more generations because it also samples the twins, so we give Self-Critique an equal budget: it may average cosine similarity over as many alternative generations as our method consumes in total, with the same decoding settings and the same hyperparameter search budget over its length penalty. Beating it means a higher AUC under this matched budget, with a paired bootstrap confidence interval excluding zero, on both RL-MIA models. The comparison in the SFT-then-RL and chain-of-thought regimes counts most. There, we treat reaching clearly above the 50–58% band, for example 0.65 AUROC, as the bar for a meaningful result. That figure is our target, not a reported number.
In the white-box setting we also run two representation baselines. Kernel Divergence Score reports a Spearman correlation of 0.99 with contamination level on pretraining-style benchmarks. LiRA reaches 89.1% AUROC in the fragility paper's Stage I before RL cloaking. We run both with the same model checkpoints. On GSM8K-style contamination during supervised fine-tuning, DICE reports AUROC of nearly 100 given a clean reference model. We do not expect to beat it there. We run it to show what our gray-box method gives up relative to full white-box access.
The ablations isolate the ingredients. They are, in turn: our score without twins (raw rigidity with elastic alignment); twins with cosine instead of $d_p$; the $p$ sweep; and each channel alone.
Why not just…?
Why not just swap cosine for dynamic time warping in Self-Critique? This may capture part of the gain, and our ablations report it directly. However, the fragility paper's finding that chain-of-thought contamination generalizes to unseen same-distribution items predicts that any absolute rigidity score will rise for non-members too. If the no-twin ablation with dynamic time warping matches the full method in the chain-of-thought regime, the twin contrast is unnecessary and we will say so.
Why not just measure answer agreement or string overlap across samples, with no entropy at all? This is a real threat, because it is fully black-box and cheap. Our token-string channel is this alternative, made more precise with suffix-tree n-gram coefficients. If it alone matches the joint score, the practical conclusion is that log-probabilities are unnecessary, which would be a useful finding in its own right. We expect final-answer agreement to be weak on RL-trained verifiable tasks, where clean models also converge on the correct answer. Rigidity along the path, rather than agreement on the answer, is the quantity the self-critique results point to.
Why not just use likelihood or representation detectors? The file's evidence is that likelihood detectors are at chance after RL: 0.42–0.53 AUC on RL-MIA, and near 50% after one epoch of clean GRPO. Representation detectors need weights, gradient updates, or a clean reference model. We include them as baselines, but auditors of deployed models rarely have that access.
Why not just use fresh benchmarks like LiveBench? Fresh items avoid contamination going forward but cannot audit scores already reported on AIME or GSM8K. DICE also shows that in-distribution training data inflates scores on new items from the same template. Our twin contrast is designed to separate that template-level effect from item-level memorization.
Proposed Experiments
On RL-MIA (AIME 2024/2025, Knights & Knaves, 3-SAT, with half the items injected into RL training), we replicate the Qwen2.5-7B-Instruct and DeepSeek-Math-7B-Instruct setups and report AUC for all methods. The GSM8K and AIME portions of the fragility setup cover both of its regimes. In the first, we contaminate a model during supervised fine-tuning, then run one to three epochs of clean GRPO, and track each detector's AUROC across epochs. In the second, we contaminate DeepSeek-R1-Distill-Llama-8B with chain-of-thought data. As a white-box sanity check, we add GSM8K contamination during supervised fine-tuning with GSM-hard-style twins against DICE.
The decisive check is the chain-of-thought regime. If the twin-contrasted score stays near 0.5 there, the claim fails. If raw rigidity is high for both members and non-members while the gap separates them, the mechanism is confirmed.
The second decisive check is a difficulty control. On a clean base model, the gap $S(x)$ should be centered at zero across members and non-members. If it is not, twin perturbation is leaking difficulty into the score, and we fall back to the base-calibrated version. Finally, the $p$ sweep and the channel comparison are reported regardless of outcome, since each answers a question the current literature leaves open.
References
- On The Fragility of Benchmark Contamination Detection in Reasoning Models
- Detecting Data Contamination from Reinforcement Learning Post-training for Large Language Models
- How Contaminated Is Your Benchmark? Measuring Dataset Leakage in Large Language Models with Kernel Divergence
- DICE: Detecting In-distribution Contamination in LLM's Fine-tuning Phase for Math Reasoning
- A Narrowing Geometry in Contaminated Reasoning
- Detecting Pretraining Data from Large Language Models
- Min-K%++: Improved Baseline for Pre-Training Data Detection from Large Language Models
- Products of Euclidean Metrics, Applied to Proximity Problems among Curves: Unified Treatment of Discrete Fréchet and Dynamic Time Warping Distances
- Computation of Similarity Measures for Sequential Data using Generalized Suffix Trees