Detecting Leaked Benchmark Items by Where Their Gradients Point

When a language model has seen a benchmark question during training, its high score may reflect recall rather than reasoning. The best current detectors work at the level of a whole benchmark. They can say "this model saw a lot of GSM8K," but they cannot say which questions leaked. This proposal tests a specific geometric signal for the per-question version of the problem. For each test item we compute the direction the model's weights would move if trained on it, called the item's gradient. We then ask what fraction of that direction lies in the few "stiff" directions of weight space, where the loss curves most sharply; these are the top eigenvectors of the Hessian, the matrix of second derivatives of the loss. We compare that fraction with the same quantity for paraphrases of the item. The prediction is that leaked items put measurably more of their gradient into the stiff directions than their paraphrases do, and that this holds even when the leaked text was rephrased.

The reason to expect this comes from optimization theory. The high-curvature subspace of a trained network's Hessian closely matches the dominant subspace of the gradients the optimizer actually saw during training (Hessian based analysis of SGD for Deep Nets). Late in training, gradient descent also locks its updates onto the sharpest directions (Understanding Gradient Descent on the Edge of Stability; On the Convergence Direction of Gradient Descent). If an item was trained on, especially repeatedly, its gradients helped build that stiff subspace. Its gradient should therefore still point into the subspace after training, while a paraphrase the model never saw should not. If this is right, auditing becomes possible from a single released checkpoint, with no access to the training corpus and no clean reference models.

Core Claim

Define $g(x) = \nabla_\theta \ell(x)$ as the gradient of the loss on item $x$ with respect to the parameters $\theta$. Let $U_k$ hold the top-$k$ Hessian eigenvectors, computed once on a generic reference corpus. The stiff-energy fraction and its paired contrast are

$$s(x) = \frac{\lVert U_k^\top g(x) \rVert^2}{\lVert g(x) \rVert^2}, \qquad \Delta(x) = s(x) - \frac{1}{m}\sum_{j=1}^{m} s(\tilde{x}_j),$$

where $\tilde{x}_1,\dots,\tilde{x}_m$ are $m$ meaning-preserving paraphrases of $x$. Our claim is that $\Delta(x)$ separates leaked items from clean ones better than loss-based or confidence-based scores at the same auditing budget. The claim has two parts, and either can fail. First, the geometry must add information that cheaper per-item signals do not already carry. Second, the signal must survive at the final checkpoint.

The normalization matters. A memorized item has low loss and therefore a small gradient, so gradient size alone mostly repeats what the loss already says. The fraction $s(x)$ ignores size and measures only direction.

The paraphrase contrast borrows the pairing idea from PaCoST. PaCoST compares confidence on original and rephrased items with a benchmark-wide t-test. We move that pairing to the level of individual items and apply it to gradient geometry. The contrast removes item difficulty, the confound that ConStat handles instead by fitting a difficulty curve on clean reference models.

Relation to Prior Work

Two lines of work motivate the proposal by linking curvature to memorization.

The first measures curvature with respect to the input. Memorization Through the Lens of Curvature scores vision samples by input-space curvature, estimated with Hutchinson's trick. Unveiling Privacy, Memorization, and Input Curvature Links proves that input curvature upper-bounds memorization. Both work on continuous images, whereas language models take discrete tokens.

The first of these papers also constrains our design. It reports that input curvature around memorized points flattens by the end of training, so it must be averaged over checkpoints. We address this directly. Our signal lives in weight space and depends on direction rather than magnitude. Edge-of-stability theory predicts that alignment with the sharp directions strengthens late in training. Whether that prediction beats the flattening effect for leaked text is an empirical question, and one experiment below exists to settle it.

The second line uses second-order weight geometry for membership inference, which asks whether a given sample was in the training set. Do Parameters Reveal More than Loss for Membership Inference? scores samples with the Newton step $H^{-1}\nabla\ell$. It reports an AUC of 0.703 against 0.531 for a loss attack on Purchase-100, a tabular dataset. That method assumes the auditor knows almost the entire training set, which is impossible for web-scale corpora, and it is sensitive to how near-zero eigenvalues are damped. We keep only its lesson that weights reveal more than loss. We replace the inverse Hessian with a projection onto the top eigenvectors, which needs no training-set knowledge and no inversion.

The closest work on contamination is Synthetic Data and the Rise of Spiky Intelligence. It studies benchmark-adjacent synthetic training data, which it calls "benchmaxxing." It uses first-order gradient cosine similarity to predict which test items became correct after augmentation, reaching an AUC of 0.68 against 0.54 for embedding similarity, and it calls for stronger attribution. We add second-order structure and a paired contrast, and we evaluate on a different target: which items were leaked, not only which improved.

Finally, DiReCT supplies the method, namely randomized Hessian sketching and a split of weight space into stiff and flat directions for language models. It treats stiff-direction gradient energy as training noise to suppress. We read the same quantity as a trace of contamination. Eigen-SAM warns that raw gradients align only moderately with the top eigenvector during normal training, with alignment scores of 0.4 to 0.6. That is why we measure energy in a top-$k$ subspace rather than cosine similarity with a single eigenvector.

Research Program

We build controlled contamination testbeds in which the leaked items are known. Open base models at 1B scale (the scale DiReCT studied) and at 7B receive continued pretraining on a generic corpus into which we insert a random half of GSM8K, ARC, MMLU, and HumanEval test items. Insertion takes three forms: verbatim, paraphrased, and benchmark-adjacent synthetic in the style of Factory-GSM. We vary the number of repetitions from one to many. The other half of each benchmark stays clean.

For each model we estimate $U_k$ with Lanczos iteration, a standard method for finding top eigenvectors using only Hessian-vector products, on held-out generic text. We use $k$ between 10 and 100. To keep this tractable, we restrict the computation to the final transformer blocks and, separately, to a LoRA-style low-rank weight subspace, and we report how sensitive results are to that choice. After the one-time eigenvector computation, scoring an item costs one backward pass per text (original plus paraphrases) and $k$ dot products.

When a gradient is nearly zero, $s(x)$ becomes noisy. We track this failure mode by also evaluating at a small random perturbation of the weights and on answer tokens only.

A secondary analysis asks whether DiReCT's stiff-energy constraint silently removes contaminated items from an annealing pool. If it does, the same quantity serves both as a training-efficiency filter and as an implicit decontamination filter.

Baselines

The naive reference points are plain per-item loss, Min-$k$% token probability, and gradient norm. These are the cheapest per-item signals, and the gradient norm tests whether our score reduces to "leaked items have small gradients." File-reported evidence on these baselines points two ways. PaCoST reports that Min-$k$% performs poorly on short multiple-choice items and answer-only leaks. On Purchase-100, the loss attack gets 0.531 AUC. We found no reported per-item result on Lacuna for Min-$k$% on GSM8K or ARC.

The strongest competitor is the per-item paired confidence gap: PaCoST's $P(\text{True})$ difference between original and paraphrases, used as a per-item score instead of a benchmark t-test. It uses the same pairing and the same paraphrases as our method but no geometry, so it is exactly the comparison that tells us whether curvature adds anything. PaCoST reports only benchmark-level significance; no reported per-item result was found on Lacuna.

We also run CDD from Generalization or Memorization, which detects contamination from a sharp peak in the distribution of sampled outputs. It reports relative gains of 21.8% to 30.2% in accuracy and AUC over baselines on its synthetic DETCON detection benchmark, and we include DETCON as an extra testbed.

For the synthetic-adjacent regime we run first-order gradient similarity from Spiky Intelligence on its own task. The number to beat there is 0.68 AUC.

Fairness rules apply to all methods. Every method sees the same checkpoint, the same paraphrases generated by a single model, and a matched compute budget measured in forward and backward passes per item. Any threshold or hyperparameter, including $k$ and the number of CDD samples, is tuned on a separate validation split of injected items.

Three ablations isolate the key ingredient. The first replaces $U_k$ with a random subspace of the same dimension. The second uses the flattest directions instead of the stiffest. The third drops the paraphrase contrast and uses $s(x)$ alone.

Beating the strongest baseline means an AUROC at least 0.05 above the per-item confidence gap, and a higher true-positive rate at 1% false-positive rate, on paraphrased contamination. Paraphrased and synthetic regimes are where loss-based signals should weaken most.

Why not just…?

Why not just use per-item loss or Min-$k$%? These are cheap and work well for verbatim, heavily repeated leaks, and we expect them to stay competitive there. The evidence against them as a general answer is that loss misses weight-level traces on Purchase-100 (0.531 against 0.703 AUC) and that PaCoST reports Min-$k$% failing on short multiple-choice items. The verbatim-versus-paraphrased breakdown in our testbed shows directly where, if anywhere, geometry adds value.

Why not just run the paired confidence test per item? This is the real threat. If paraphrase pairing does most of the work, the per-item confidence gap will match $\Delta(x)$ at a fraction of the cost. We treat this as the central comparison. If the confidence gap matches our method within noise across regimes, we will report that the Hessian contributes nothing and drop the claim. Combining the two scores shows whether the information they carry is complementary.

Why not just use first-order gradient similarity to known benchmark items? Spiky Intelligence reports that this signal saturates near 0.68 AUC. Eigen-SAM's moderate alignment scores suggest raw gradient directions mix sharp and flat components, so the stiff part may be diluted. The random-subspace and flat-subspace ablations test this. If a random subspace performs as well as $U_k$, curvature is not the reason for any gain.

Decisive Checks

Three results decide the proposal.

The first is the head-to-head against the per-item confidence gap on paraphrased GSM8K and ARC leaks. This must show a gain for the geometric score to be worth its cost.

The second is the checkpoint experiment. We score the same injected items at intermediate checkpoints and at the final checkpoint. If $\Delta(x)$ fades at convergence the way input curvature does in Garg et al., single-checkpoint auditing fails and the proposal's practical case collapses. If $\Delta(x)$ holds or grows, as edge-of-stability theory predicts, the audit works on released models.

The third is the synthetic-adjacent regime. There we test whether $\Delta(x)$, computed on test items the model never saw verbatim, exceeds the 0.68 AUC first-order ceiling for predicting which items were inflated.

A dose-response curve over repetition count is a sanity check on the mechanism. The signal should grow with repetitions if leaked items really build the stiff subspace.