Where Memorized Answers Live Inside Vision-Language Attention

When a vision-language model (a system that reads an image and a question and writes an answer) scores well on a public benchmark, we cannot tell whether it looked at the image or simply recalled an answer it saw during training. The best current test for this "benchmark contamination" edits the image with a diffusion model so that a different answer becomes correct, then checks whether the model follows the edit. That works, but it is expensive, it breaks on charts and diagrams, and it treats the model as a black box. This proposal asks a mechanistic question with a practical payoff. When a model recalls a leaked answer, does its attention take a distinct, low-dimensional route that we can find, measure, and switch off, without generating a single counterfactual image?

The bet is concrete. In an attention head, each token emits a query and a key, and attention is high when the two point the same way inside a small subspace. If contamination creates a shortcut where the answer position matches the question text (or a memorized image fingerprint) instead of the image regions that carry the evidence, that shortcut should appear as a separate low-rank direction in query-key space. If it does, we get a white-box contamination detector that works item by item on fully open models, and a causal handle for testing whether claimed "open parity" rests on looking or on remembering.

Core Claim

We claim that, in open vision-language models deliberately contaminated on a known subset of benchmark items, a small number of attention heads contain a rank-one to rank-few query-key subspace whose activation at the answer position separates contaminated from clean items. We further claim that this subspace (i) predicts contamination on held-out items and at contamination doses not used to find it, (ii) needs no image synthesis, so it applies to scientific figures where diffusion edits fail, and (iii) is causal: projecting it out should push a contaminated model's accuracy on original items down toward clean levels and its accuracy on counterfactual images back up.

The method comes from Decomposing Query-Key Feature Interactions Using Contrastive Covariances. That paper contrasts query-key covariance under positive and negative conditions, takes a singular value decomposition, and shows in text-only Llama 3.1-8B and Qwen 3-4B that categorical features sit in rank-1 query-key subspaces that can be causally swapped. We carry this decomposition into the cross-modal setting and use contamination status as the contrast condition. That paper never looks at visual tokens or memorization. The motivating evidence is Contamination Detection for VLMs Using Multi‑Modal Semantic Perturbations, which shows that contaminated models anchor memorized answers to visual features, so text-only paraphrasing and option shuffling fail as detectors. Our method has to beat that work, not just extend it.

For a head $h$, let $q$ be the query at the first answer token and $k$ the key at a context token. Let $C^+_h$ be the average of $q k^\top$, weighted by attention, over contaminated training items, and $C^-_h$ the same average over clean items. The contrastive interaction is

$$\Delta C_h = C^+_h - C^-_h = \sum_i \sigma_i u_i v_i^\top ,$$

where $u_i, v_i$ are its singular vectors and $\sigma_i$ its singular values. An item's contamination score in that head is the attention-weighted sum, over the top $r$ components, of $(u_i^\top q)(v_i^\top k)$. We report the score separately for keys on image tokens and keys on text tokens, which tells us whether the shortcut routes through pixels or through the question.

The superposition result in the same decomposition paper is a real constraint on this design. When there are more features than head dimensions, interactions spill into off-diagonal interference that low-rank bases cannot explain. Contamination may therefore be smeared across many heads rather than isolated in a few. Theory on multi-head attention (Attention-based representations for multi-task computation) predicts the opposite: conflicting computations get pushed into separate heads to avoid interference. Which of these holds is itself one of the findings.

Research Program

Ground truth comes first. Following the dose protocol of the perturbation paper, we split MMStar's 1,500 items into a contaminated half and a held-out half. We fine-tune LLaVA-v1.5-7B and Qwen2-VL for 0 to 3 epochs on the contaminated half only, which gives item-level labels inside a single model. We fit $\Delta C_h$ on a third of the contaminated items plus matched clean items. We select heads by how much $\sigma_1$ dominates, then score the remaining items. CharXiv and MathVista items are contaminated the same way, as the chart and math regime where diffusion edits are known to be fragile.

The open-source direction supplies the realistic test. Molmo2 (Molmo2 Open Weights and Data for Vision-Language Models with Video Understanding and Grounding) releases its training data along with its weights. We can therefore string-match and image-hash its corpus against benchmark items and obtain naturally contaminated labels, not just ones we injected. One caveat: its SigLIP 2 image encoder was trained on closed data, so leakage upstream of the language model stays invisible to us. We report that limitation rather than hide it. Fine-tuning a model on test items for a few epochs is not the same as leakage during pretraining. The Molmo2 audit is where we learn whether subspaces found under injected contamination transfer to natural contamination.

The mechanistic analysis asks three questions. First, are shortcut subspaces concentrated in a few heads, or spread out? Second, do they key on text tokens, image tokens, or the connector's output? Third, do they grow monotonically with dose? We compare them with the LayerNorm-only adaptation of Tuning LayerNorm in Attention: Towards Efficient Multi-Modal LLM Finetuning. That paper tunes only 0.004% of parameters inside attention blocks and still adapts a language model to images. Contaminating through LayerNorm-only training tests whether memorization can be written without changing query and key projections at all. If it can, the shortcut would live in re-scaled existing directions rather than new ones.

Baselines

The naive reference is the original benchmark score, together with the dataset-level Multi-modal Gain and Multi-modal Leakage diagnostics from Are We on the Right Way for Evaluating Large Vision-Language Models?. Those diagnostics compare a model with and without the image, and against its language backbone. They operate at the level of a whole benchmark, so for item-level comparison we turn each into a per-item blind-versus-sighted correctness signal. Any detector that cannot beat this is not worth its complexity.

The strongest existing method is the multimodal semantic perturbation pipeline (Contamination Detection for VLMs Using Multi‑Modal Semantic Perturbations). It swaps answers, has GPT-4o describe an image edit, renders the edit with Flux plus ControlNet, and filters the results. Its reported numbers on MMStar are a performance delta of +31.5% for clean models against drops down to -45% for contaminated ones. For LLaVA-v1.5-7B at 3 epochs, original accuracy rises from about 38% to about 54% while perturbed accuracy falls from about 69% to about 38%. The file reports no item-level detection AUROC for this method, so we compute it ourselves. We run its pipeline on exactly our item splits and models, use its per-item correctness flip as the score, and report the generation cost and the fraction of items whose edits fail filtering. To beat it, we must match its item-level AUROC on MMStar natural images and exceed it on CharXiv and MathVista, at a small fraction of its compute.

The strongest cheap white-box competitor scores each item by how confident the model is in the gold answer, its token probability or surprise. This follows the logic of Studying and improving reasoning in humans and machines, which found near-zero surprise on memorized puzzle solutions. We found no reported result on Lacuna for answer-likelihood contamination detection in vision-language models. We give it the same items, and calibrate it on the same fitting split.

Three ablations isolate our key ingredient. The first is raw attention mass from the answer position onto image tokens versus text tokens, with no decomposition. The second is a linear probe on the residual stream at the answer position, trained on the same labels. The third is random rank-$r$ query-key subspaces in the same heads. Our claim survives only if the contrastive subspace beats raw attention mass and matches or beats the residual probe while also passing the causal test. A probe can only detect; it cannot be removed while the model keeps running.

Why not just…?

Why not just run the diffusion perturbation detector? It works on MMStar, and on natural photographs it may stay the better detector; that is a real possibility. Its stated weaknesses are artifacts and poor rendering of fine geometric text, plus heavy cost per item. There is also a reflexive risk: once perturbed images are published, future training data can include them. Our CharXiv and MathVista arm measures exactly where its edit filtering fails. If our detector does not do better there, the white-box detector has no practical advantage, and the contribution shrinks to the mechanistic finding.

Why not just use answer likelihood? This is the most dangerous alternative because it is nearly free. It has a known confound: clean but easy items also receive high confidence, and fine-tuning on the task in general sharpens confidence everywhere. Our design separates these with held-out items from the same benchmark at matched difficulty. If likelihood alone reaches our AUROC, we will say so. We would then fall back to the causal and routing analysis, which likelihood cannot provide.

Why not just train a probe on hidden states? A probe answers "is this item contaminated" but not "through what path." It cannot be ablated to test whether recall depends on image tokens. If the probe is more accurate, we report it as the detector of choice and keep the query-key subspace as the explanation. The causal intervention is the test the probe cannot run.

Decisive Checks

The work stands or falls on four results. First, held-out item-level AUROC for the subspace score is reported on MMStar, CharXiv and MathVista against all baselines above, across doses 1 to 3 when the subspace is fit only at dose 2. Second, projecting out the top-$r$ components in the selected heads moves contaminated-item accuracy toward the clean model's level. On counterfactual images it should move from about 38% back toward about 69%, while leaving held-out items within noise. Third, subspaces found under injected contamination should rank Molmo2's naturally overlapping items above non-overlapping ones. Fourth, the image-key versus text-key split of the score tells us whether shortcuts bypass the image or latch onto a memorized image fingerprint. That difference decides whether open models' parity claims are a language-prior artifact or a visual-memory one. A negative result on the first and second checks, with contamination diffuse across heads, would itself settle the open question between functional specialization and superposition.