Answers Decided Before Reasoning: Detecting Benchmark Leakage From Domain Pre-Training Inside the Chain of Thought

When a language model is adapted to medicine by continuing its training on a large medical corpus, a step called domain-adaptive pre-training, that corpus almost certainly contains published exam questions, answer keys, and commentary on them. The model then sits benchmarks such as MedQA having already seen parts of the test. Later reasoning training can hide the leak from every standard detector. We propose to find these leaked items from inside the model, while it reasons. For each test question we ask how early, and how stubbornly, the model's hidden states already point to an answer before its written chain of thought does any work. The test that separates leakage from legitimate medical knowledge is a counterfactual twin: a copy of the question with one clinical finding edited so that the correct answer changes. A model that learned medicine updates its internal answer to match the edit. A model that memorized the item stays internally committed to the old answer on the twin, and its written reasoning on that item becomes theatre.

This matters because the field has two results that do not yet fit together. Contamination detectors that compare token probabilities on seen and unseen text fail after reinforcement learning: On The Fragility of Benchmark Contamination Detection in Reasoning Models shows a detector called LiRA reaching 89.1% AUROC after contaminated fine-tuning and collapsing toward 50% after a single epoch of clean reinforcement learning, while accuracy stays inflated. Separately, mechanistic work shows that memorized answers travel through specific internal routes that can be read and edited (Spurious Rewards Paradox). Nobody has asked whether those internal signatures survive the cloaking effect, or whether they exist when contamination enters through a domain corpus rather than a math benchmark. In specialized domains the question is also harder, because most medical questions are legitimately answerable by recall alone.

Core Claim

Our claim is that contamination introduced during domain-adaptive pre-training leaves a durable, item-level trace that (a) survives subsequent clean reasoning training even when probability-based detectors fail, (b) shows up as an internal commitment to the leaked answer at the start of the chain of thought, before the text has derived it, and (c) can be separated from legitimate domain knowledge only by a counterfactual contrast, not by early commitment alone. The third part is what makes the problem nontrivial. Disentangling Reasoning and Knowledge in Medical Large Language Models reports that only 32.8% of standard medical benchmark questions require multi-step reasoning, and 67.2% can be answered by direct recall. Domain pre-training is supposed to make the model answer those early and confidently. A detector that simply flags "answered before reasoning" would therefore flag the very knowledge domain pre-training is meant to teach. We expect it to fail exactly on the knowledge-heavy stratum, and we design the measurement around that expected failure.

How This Differs From the Closest Work

Four papers come closest, and each leaves a specific gap.

Spurious Rewards Paradox is the nearest neighbour. It localizes an "Anchor-Adapter" circuit in Qwen2.5, where layers 18 to 20 branch off toward retrieving a stored answer. Resetting those layers drops leaked MATH-500 accuracy from 98% to 86% and leaves clean LiveMathBench untouched. That work explains memorization that was already present and then woken up by spurious rewards, in one model family, on math, with a base-model checkpoint available for comparison. We differ in four ways. We plant contamination ourselves during domain pre-training, so membership is known exactly. We read commitment step by step along the chain of thought rather than through a layer reset. We need no clean reference checkpoint at test time. And we confront the knowledge-versus-memorization confound that math benchmarks largely avoid. We reuse its tools, logit lens and probing of intermediate layers, as method.

Legibility is Not Interpretability defines a step's true importance as its advantage: the change in the probability of eventually reaching the correct answer after committing to that step, estimated with 50 Monte Carlo continuations per step. Using this measure it finds performative reasoning under misleading cues. It never asks whether memorized items produce such zero-advantage chains, and its measure is too expensive to run at scale. We use its advantage measure as ground truth on a subsample, and test whether a cheap internal readout predicts it.

Reasoning Without Self-Doubt reads intermediate answers by injecting a forced "Final Answer:" prompt into the text. Its signal is behavioural, and its purpose is saving tokens. We treat this textual probe as a baseline for our hidden-state readout.

Investigating Data Contamination for Pre-training Language Models supplies the controlled-contamination design. Its findings constrain ours: question-plus-answer leakage inflates scores far more than raw text, the effect of repetition is non-monotone, and n-gram filters fail. It worked at GPT-2 scale, with no reasoning stage and no internal analysis. We carry its design to a 7–8B domain-adapted reasoning model.

Research Program

We build a contaminated domain model whose leaked items we know exactly, then test whether internal commitment identifies them through each later training stage.

Base model and domain corpus. The base model is Llama-3.1-8B. We choose it because Reasoning or Memorization? shows it is not pre-contaminated on math, which makes it a cleaner starting point than Qwen2.5. We continue its training on a PubMed-style biomedical corpus.

Planting the leak. We randomly split MedQA test items into members and non-members. Members are injected into the corpus in three forms that mirror how leakage actually occurs in harvested repositories. The first is verbatim question plus answer, which the GPT-2 study calls the super-contaminant. The second is the question text alone. The third is a paraphrased explanatory commentary that discusses the case and its answer without reproducing the stem. Each form is used at repetition factors of 1, 5, and 10.

Clean reasoning training. We then apply reasoning fine-tuning on clean reasoning traces, followed by GRPO, a reinforcement learning method that scores groups of sampled answers against each other. This mirrors the BioMed-R1 recipe from Disentangling Reasoning and Knowledge. The Fragility paper predicts that this stage cloaks the leak from probability-based detectors.

Measurements. We take checkpoints after domain pre-training, after reasoning fine-tuning, and after reinforcement learning. On each we measure accuracy inflation and run every detector.

Counterfactual twins. For every member and non-member item we build a twin by editing one decisive finding (a lab value, a symptom, an exposure) so that the gold answer changes. Edits are drafted with a strong model, then checked by clinicians on a sample. We also use open-ended versions in the style of MEDQA-OPEN from Few shot chain-of-thought driven reasoning, so the model cannot reach answers by eliminating options.

The internal readout. At each reasoning step $t$ we read, from hidden states at a probe layer $\ell$, a probability distribution over candidate answers. We use logit lens and a linear probe trained only on non-member items. Write $a$ for the original item's gold answer and $a'$ for the twin's gold answer. The precommitment score of an item is

$$S(x) = \frac{1}{T_0}\sum_{t=1}^{T_0}\Big[\,p_t^{\ell}(a \mid x') - p_t^{\ell}(a' \mid x')\,\Big],$$

where $x'$ is the twin prompt, $p_t^{\ell}(\cdot \mid x')$ is the probe's answer distribution at step $t$, and $T_0$ is a fixed early window of reasoning steps. Read plainly, $S$ is large when, on a question whose correct answer has changed, the model's hidden states still favour the old answer before its reasoning has engaged the edited finding. Legitimate knowledge should give $S \le 0$, because the edit changes what recall retrieves. Memorized item-answer pairs should give $S > 0$. We also record the layer and step at which the probe first commits, and we connect this to the geometric "point of no return" (the layer where the spread of hidden-state geometry peaks) in Geometry of Decision Making in Language Models. That paper studied only final-token multiple-choice decisions.

Performativity check. On a 300-item subsample we compute Monte Carlo step advantage as in the Legibility paper. This tests whether high-$S$ items have chains whose steps carry near-zero advantage, which would mean the reasoning text is performative on leaked items.

Math positive control. As a check on the method, we run the readout on Qwen2.5-Math-7B, comparing MATH-500 against LiveMathBench, OlymMATH, and OmniMATH. Two papers in the file treat this as a known contaminated-versus-clean contrast.

Baselines

Naive reference. The do-nothing reference is raw benchmark accuracy with no detection, compared between our contaminated and clean-control models trained identically. This quantifies the inflation any detector must explain. For context, the Fragility paper reports average pass@1 inflation of 8.8% surviving clean GRPO, and an 11.7% boost when DeepSeek-R1-Distill-Llama-8B was contaminated with chain-of-thought data.

Probability-based membership detectors. These are Loss, Min-K%, and LiRA, run exactly as evaluated in On The Fragility of Benchmark Contamination Detection. They are the standard tools, and the claim we must beat is about them. LiRA gets the base checkpoint as its reference model, which is an advantage our method does not use. The reported numbers we compare against are 89.1% AUROC for LiRA after contaminated fine-tuning, near 50% after one epoch of clean GRPO, and 50–58% average AUROC across all ten detectors in the chain-of-thought contamination setting. Beating this baseline means an AUROC clearly above 58% on the post-GRPO checkpoint, with a target of at least 75%, on the same member and non-member split.

Output-distribution detection. CDD from Generalization or Memorization measures how often repeated samples nearly coincide. It reports 21.8–30.2% relative gains over n-gram and LLM baselines on DETCON. We run it with the same sampling budget per item that our method spends on twin prompts.

Partial-prompt audit. This audit from Reasoning or Memorization? truncates the question at 40%, 60%, or 80% and checks whether the model still answers correctly. Its reported signal is that Qwen2.5-Math-7B reached nearly 40% on MATH-500 from the first 40% of the problem, while Llama3.1-8B scored near zero.

Behavioural twin gap. This is the twin test without any internal reading: the accuracy difference, or the rate at which the old answer is given on the twin. It is the most dangerous baseline because it shares our key ingredient.

Ablations. Three ablations isolate the two ingredients, twin contrast and hidden-state reading. The first is the textual probe-in-the-middle method from Reasoning Without Self-Doubt, applied to twins. This keeps the twin contrast and the step-by-step timing but reads from text instead of hidden states. The second is our hidden-state readout on the original item alone with no twin, which measures early commitment without the contrast. The third is our readout restricted to the final layer.

All detectors see the same items and checkpoints. Any detector with tunable thresholds or a learned probe is tuned only on a disjoint validation split of non-members and members. All results are reported separately on the knowledge-heavy and reasoning-heavy strata, labelled with the PubMedBERT classifier from the Disentangling paper, which reports 81% agreement with experts.

Why not just…?

Why not just decontaminate the domain corpus with n-gram filtering before pre-training? Because Investigating Data Contamination found that the 8- and 13-gram filters used in production pipelines fail to remove the score inflation. Our third injection form, paraphrased commentary, is built so that no long n-gram matches. We report the filter's recall on our planted items as a direct check.

Why not just use the partial-prompt truncation audit? It is cheap and needs no access to model internals, and it is a real competitor for verbatim leaks. We expect it to weaken in two places. One is the commentary form, where the model never saw the stem. The other is the knowledge-heavy stratum, where a truncated vignette that still names the key finding can be answered legitimately. If its AUROC matches ours on every injection form, we will say so and recommend it.

Why not just measure accuracy on the counterfactual twins, with no interpretability at all? This is the strongest threat. A memorizing model that answers the old answer on the twin gives itself away behaviourally. The internal readout should add value in two cases. The first is items where the reasoning text eventually reaches the correct twin answer, through the kind of unfaithful recovery documented in Dissociation of Faithful and Unfaithful Reasoning, while the hidden states favoured the old answer early on. The second is separating "memorized" from "simply bad at reasoning", since both lower twin accuracy but only memorization predicts positive $S$. The decisive comparison is the AUROC of the behavioural twin gap against $S$ on the post-GRPO checkpoint. If they are statistically indistinguishable, the honest conclusion is that twins, not interpretability, carry the method, and we will report it that way.

Why not just ask the model mid-reasoning with an injected "Final Answer:" prompt? That is the textual ablation above. The injected text itself perturbs the computation, and reinforcement learning shapes exactly the surface behaviour such prompts read. If the textual and hidden-state readouts agree, the cheaper textual one wins.

Proposed Experiments and Decisive Checks

The first check is survival. On the post-GRPO checkpoint, we test whether $S$ separates members from non-members at an AUROC well above the 50–58% band in which Fragility's detectors fall, for each injection form and repetition factor. We expect the separation to track the inflation curve, including its non-monotone shape across repetitions.

The second check is the confound. On knowledge-heavy non-members, the twin-free readout should show high early commitment, and therefore false positives, while $S$ should not. If $S$ also produces false positives there, the claim that the twin contrast separates knowledge from memorization fails.

The third check is performativity. On the Monte Carlo subsample, high-$S$ members should have reasoning steps with near-zero advantage, and the rank correlation between $S$ and the summed step advantage of the chain should be negative. This would let a single forward-pass readout stand in for the 50-rollout measurement, on this specific question.

The fourth check is localization and transfer. The commitment layer on our medical model should fall where the middle-to-late branching occurs in the Qwen2.5 Anchor-Adapter circuit, measured relative to depth. On the Qwen2.5-Math positive control, $S$ should rank MATH-500 items above LiveMathBench items. Suppressing the identified layers should lower member accuracy while leaving non-member and twin accuracy unchanged, which mirrors the reported 98%-to-86% reset result.

Finally, we apply the audited readout to a publicly released domain-adapted medical model on MedQA and its twins. In that setting membership is unknown and the method would be used in practice. Its verdicts there are only credible if the controlled experiments above have passed.