Sibling Negatives for Contamination Detection in Reasoning Models

Checking whether a language model has seen a benchmark's test questions during training usually comes down to one test. Is the model suspiciously confident on the test items compared with items it could not have seen? That test breaks for modern reasoning models. When a model is fine-tuned on leaked worked solutions (chains of thought, the step-by-step reasoning written before an answer), it learns the reasoning pattern behind each leaked problem. It then becomes just as confident on unseen "sister" problems built from the same pattern. Ten existing detectors fall to 50–58% AUROC in this regime, close to a coin flip. A short phase of clean reinforcement learning also erases the likelihood traces of earlier leakage while keeping the inflated scores (On The Fragility of Benchmark Contamination Detection in Reasoning Models).

We propose to attack this failure with a tool from a different field. In hierarchical contrastive learning, a model learns embeddings by pulling matching examples together and pushing non-matching ones apart. There, choosing the "push-away" examples (the negatives) from sibling categories that share a parent in a taxonomy forces the encoder to find fine-grained features instead of broad shortcuts. We would train a contamination detector on the model's internal activations, and build its negative examples from a problem taxonomy: domain, then reasoning template, then problem instance, then surface wording. The hardest negatives are exactly the unseen sibling problems that fool current detectors. The detector is also asked to say at which level the leak happened: this exact item, or this item's template family. The first question may be unanswerable; the second may not be.

Core Claim

A detector trained with flat labels (seen versus unseen) on a contaminated model tends to learn "the model is competent here," because that is the cheapest feature separating seen items from random unseen ones. We claim two things.

First, reweighting training so that the negatives are unseen siblings from the same template removes that shortcut. It forces the detector onto whatever internal signature separates having seen an item from having generalized to it. That signature might, for example, be the low-dimensional "memorization subspace" that A Narrowing Geometry in Contaminated Reasoning reports for leaked items.

Second, if no such instance-level signature survives chain-of-thought contamination, the same taxonomy still supports detection at the template-family level. Here the contrast is between siblings of leaked items and siblings of never-leaked templates. Both outcomes are informative. The central experiment is designed to tell them apart.

Relation to Prior Work

Work that motivates the proposal. The fragility paper is the main motivation. It documents both the chain-of-thought failure and the reinforcement-learning "cloaking" effect, and it attributes the failure to cross-instance generalization within the problem class. That attribution is precisely the confound that sibling negatives are meant to isolate.

Work that supplies the method. - Facilitating Contrastive Learning of Discourse Relational Senses by Exploiting the Hierarchy of Sense Relations samples negatives from sister senses in the discourse sense tree. It shows this makes the encoder isolate fine-grained cues. We transfer that sampling rule from label taxonomies to problem taxonomies. - Taxes Are All You Need splits negatives into taxonomy negatives (sharing a parent) and regular negatives, and upweights the former. Its singular value analysis shows this reverses the collapse of closely related classes into few dimensions. We reuse its weighting. - Benchmarking Omni-Vision Representation Through the Lens of Visual Realms (ReCo) scales the penalty by tree path distance. It suggests the graded version we ablate. - SEAL trains multi-granularity heads with cross-level consistency. That motivates predicting the contamination level as well as a single bit.

None of these works studies contamination or operates on the internals of generative models.

Work that constrains the design. - A Narrowing Geometry in Contaminated Reasoning shows leaked items concentrate activations into few dominant directions, measured by the Eigenspectrum Concentration Index (ECI). Its suppression method, Top-Subspace Suppression, recovers reasoning on about half of leaked MSCalc samples. It does not test whether unseen siblings of leaked items share the narrowing, and it uses a fixed statistic rather than a learned detector. Its handcrafted signal is therefore our strongest white-box competitor. - DyVal: Dynamic Evaluation of Large Language Models for Reasoning Tasks generates reasoning problems from directed acyclic graphs (DAGs), that is, computation graphs. This gives us exact, programmatic control over what counts as a sibling (same graph shape, new values) versus a cousin (different shape, same depth).

The closest bridging work. Hierarchical Semi-supervised Contrastive Learning for Contamination-Resistant Anomaly Detection uses hierarchical contrastive learning to resist anomalies polluting a training set. It addresses dirty training data for visual anomaly detection, not leaked test sets in language model training. It also does not use sibling problems as negatives.

Research Program

Step 1: build problem taxonomies with programmatically generated siblings. For DyVal's seven tasks and for MSCalc-style multi-step calculation, the tree has four levels:

  • task domain,
  • DAG topology (the template),
  • instantiated values (the instance),
  • description order or paraphrase (the surface).

For competition math (AIME, AMC, OlympiadBench, Minerva Math, as used in the fragility paper), templates are harder to extract. We would use symbolic re-parameterization only where a problem admits it. Items we cannot vary faithfully are reported separately rather than forced into the tree.

Step 2: create controlled contamination. We follow the fragility paper's protocol, using DeepSeek-R1-Distill-Llama-8B as in its Stage II plus smaller models for cheaper runs. A random half of templates is marked "leaked." Within those templates, some instances are fine-tuned on with chain-of-thought solutions, and a later clean GRPO phase is optionally applied. GRPO is the group-relative policy optimization reinforcement-learning method.

This yields items at known hierarchical positions:

  • seen items;
  • unseen siblings of seen items;
  • unseen items from leaked templates at cousin distance;
  • items from never-leaked templates.

As a critical control, we also train a model on freshly generated siblings, never the benchmark items themselves. This mimics a developer who legitimately trained on the skill.

Step 3: extract per-item features. From a single forward pass over the prompt and the model's own answer, we record:

  • mean-pooled hidden states from several layers;
  • per-layer eigenspectrum concentration of token activations, following Xie et al.;
  • Min-K%++ token statistics.

Step 4: train the detector. A small encoder maps these features to an embedding $z_i$. It is trained with a supervised contrastive loss whose negatives are weighted by tree distance:

$$\mathcal{L}_i = -\frac{1}{|P(i)|}\sum_{p \in P(i)} \log \frac{\exp(z_i \cdot z_p/\tau)}{\sum_{a \in P(i)} \exp(z_i \cdot z_a/\tau) + \sum_{n \in N(i)} w_{d(i,n)} \exp(z_i \cdot z_n/\tau)}$$

The symbols are:

  • $P(i)$: the other items sharing anchor $i$'s membership label;
  • $N(i)$: the items with the opposite label;
  • $d(i,n)$: the tree distance between the two problems (1 for siblings, 2 for cousins, 3 for unrelated);
  • $w_d$: a weight that decreases with $d$, so siblings are pushed hardest, following Kokilepersaud et al.;
  • $\tau$: a temperature.

A second head predicts membership at the template level. At test time the detector returns an instance score and a template score. It never sees the benchmark's contamination labels; it is trained on contamination runs of other benchmarks and applied zero-shot.

Baselines

Naive reference. The do-nothing point is 50% AUROC. Plain sequence loss is the simplest real detector. The fragility paper reports that ten detectors average 50–58% AUROC on Stage II chain-of-thought contamination. It also reports that LiRA reaches 89.1% AUROC in Stage I and loses about 14 points after one epoch of GRPO. Those are the reference numbers our setup should reproduce before any comparison is trusted.

Likelihood detectors. Min-K%++ (Min-K%++) z-normalizes each token's log-probability against the vocabulary distribution and averages the lowest $k\%$ of tokens. It is the strongest reference-free likelihood detector in the file, improving on Min-K% by 6.2–10.5 AUROC points on WikiMIA. We run it on exactly the same items with $k$ tuned on the training benchmarks.

Behavioral detectors. CoDeC (Detecting Data Contamination in LLMs via In-Context Learning) measures how prepending same-dataset examples changes confidence. It reports 99.9% dataset-level AUC, but an ambiguous 60–80% zone on partially contaminated sets. Min-$k$NN distance (Detecting RLVR Training Data via Structural Convergence of Reasoning) measures edit-distance collapse across 32 sampled solutions. It reports 0.70 average AUC in its reinforcement-learning setting. Both get the same items, and Min-$k$NN gets its full sampling budget. We report its cost next to our single-pass cost.

Strongest white-box competitor. This is an unlearned ECI threshold from Xie et al., computed on the same layers we feed our detector. No reported instance-level AUROC for ECI as a detector was found on Lacuna, so we will measure it.

Isolating ablation. The key ablation uses the identical encoder, features, data and tuning budget, but trained with flat negatives, meaning uniform $w_d$ and uniformly sampled unseen items. A variant trains a cross-entropy classifier with sibling-oversampled negatives. This separates the contribution of which negatives from that of the contrastive loss.

What counts as winning. On the hard split (seen items versus their unseen siblings), after GRPO cloaking, on held-out benchmarks, the method must:

  • beat the flat ablation and the ECI threshold by a margin exceeding the seed-to-seed spread;
  • clear the 50–58% band that the fragility paper reports.

Why not just…?

Why not just threshold the narrowing-geometry statistic, since Xie et al. already found a contamination signature? This is the most serious alternative. If ECI alone separates seen items from their siblings, our learned detector adds little. Xie et al. validate the signature against clean data, not against unseen siblings that share the leaked reasoning pattern, which is exactly the case the fragility paper identifies as fatal. The ECI-threshold baseline on the sibling split settles this directly. If it matches our detector, we report that the handcrafted signal suffices and the contribution becomes the sibling-split evaluation protocol itself.

Why not just use Min-K%++ or CoDeC, which are cheaper and need no training? Both read token probabilities. The fragility paper shows GRPO clipping compresses exactly the probability gap they rely on, driving likelihood methods toward chance. CoDeC's robustness to that clipping is untested. We include both on the post-GRPO split. If either stays well above the 50–58% band there, our motivation weakens and we say so.

Why not just train an ordinary classifier on hidden states with seen/unseen labels? That is the flat ablation, and it is the comparison the proposal lives or dies by. Our hypothesis is that with random unseen negatives, a flat classifier learns "the model can solve this template." That feature is also present on unseen siblings and on the legitimately skill-trained control. The prediction is therefore specific: flat and hierarchical detectors should look similar on the easy split, and diverge on the sibling split and on the skill-trained control. If the cross-entropy variant with sibling-oversampled negatives matches the contrastive version, the finding is that negative composition, not the loss, carries the effect. That is still a useful result.

Why not just use ConStat's reference-model regression? ConStat flags benchmark scores that exceed what reference models predict. It needs a fleet of reference models and a clean reference benchmark, and it answers only at the benchmark level. Our template head answers a related question at finer granularity without a clean external benchmark. The generated siblings serve as the reference. We would report ConStat-style residuals on our generated families as a benchmark-level sanity check rather than as a competitor on instance detection.

Proposed Experiments and Decisive Checks

Main comparison. We report AUROC and true-positive rate at 5% false-positive rate on three splits of held-out benchmarks:

  • seen versus unrelated-unseen (easy);
  • seen versus unseen sibling (hard);
  • items from leaked templates versus never-leaked templates (family level).

Each split is measured before and after the clean GRPO phase. We train on DyVal and MSCalc contamination runs and test on the competition-math suite, and the reverse. Model-family transfer is tested by training detectors on one base model and evaluating on another.

Check 1: does instance-level detection survive at all? If every method, ours included, is near chance on seen-versus-sibling after chain-of-thought contamination, we have evidence that instance-level membership is not recoverable from these features. We would then argue that audits should shift to the family level. In that world, the template head should still separate leaked from never-leaked families.

Check 2: false positives on legitimate training. The skill-trained control must not be flagged. A detector that flags it is measuring competence, not contamination. We expect flat detectors to fail this control and the hierarchical detector to pass it.

Check 3: the geometric mechanism. We compute the singular value spectrum of detector embeddings under flat and weighted training. Following Kokilepersaud et al., we test whether sibling weighting spreads seen and sibling items along extra directions. We also test whether those directions align with Xie et al.'s dominant memorization directions. This tells us whether the detector rediscovers their subspace or finds something new.

Check 4: sensitivity to the taxonomy. We repeat with a deliberately corrupted tree (randomly reassigned templates). If performance holds, the hierarchy is not doing the work.

Stated limitations. The method requires white-box access to hidden states. Its validity rests on controlled contamination of open models, so application to third-party models with unknown training data remains an extrapolation. We would state that openly rather than claim it.