When Memory Fills the Gap: Evidence-Excision Probes for Long-Context Benchmarks

Long-context language models are graded on questions about documents that can run to hundreds of thousands of tokens, such as detective novels, meeting transcripts, and reports. Many of those documents, or discussions of them, are also in the models' training data. This produces a failure that current evaluations cannot see. When a model cannot actually reach the passage that answers a question, because it sits too far back or in the neglected middle of the prompt, it can still answer correctly from memory. Benchmark contamination therefore does more than inflate headline scores. It hides the specific weakness that long-context benchmarks exist to measure, which is how far into its input a model can really read.

We propose to measure this directly. For each benchmark question we keep the whole document, which still tells the model which book or report it is looking at, but cut out every passage that contains the answer's evidence and fill the gap with length-matched text from elsewhere in the same document. A model that is reading should fall to chance. A model that still answers is recalling the answer from training. Repeating this while moving the evidence to different distances from the question gives a corrected curve of "how far can the model read," with the memory contribution removed. We then use that curve to ask whether popular fixes for limited context windows improve reading or only improve scores on material the model has already memorized.

Core Claim

Our central claim is that memorized knowledge is usually triggered by cues in the document rather than available unprompted. The standard contamination check asks the question with no document at all, which is the closed-book condition that Retrieval Or Holistic Understanding? Dolce uses to define its "Category I" tasks. Because it removes the cues, it underestimates how much of long-context accuracy comes from memory. Keeping the document and removing only the evidence separates two things that the closed-book and full-context conditions mix together: recall that the document triggers, and reading of the document. Once the two are separated, we expect contaminated benchmarks to show effective context lengths that look longer than they are, and flatter accuracy-versus-distance curves than matched clean benchmarks. We also expect part of the gains reported for context-extension methods to disappear on clean material.

For each item we write $A_{\text{full}}$ for accuracy with the intact document, $A_{\text{cut}}$ for accuracy after evidence excision, $A_{\text{cb}}$ for closed-book accuracy, and $c$ for chance. The memory-reliance ratio is

$$R = \frac{A_{\text{cut}} - c}{A_{\text{full}} - c},$$

the fraction of above-chance accuracy that survives when the evidence is gone. The cue gap is $A_{\text{cut}} - A_{\text{cb}}$, the recall that only the document's surrounding text triggers. The claim is falsified if the cue gap is near zero on known-contaminated data. In that case closed-book testing is already sufficient.

Relation to Prior Work

Four papers show that the gap is real. DetectiveQA asks multi-hop questions over full detective novels and finds a large difference between multiple-choice accuracy and step-wise reasoning scores. That is consistent with answers obtained without reading, but the paper never removes chapters to test this, and its published novels are exposed to contamination. BAMBOO avoids contamination by using only post-2023 text, capped at 16k tokens. It observes "lost in the middle" failures but does not use context manipulation to measure leakage. Dolce estimates the minimum span a task needs and how often evidence repeats, and it flags tasks solvable with zero context. We keep its idea of span estimation, but condition on the document minus the evidence rather than on nothing. Retrieval or Global Context Understanding? finds classification-style tasks stable to 64k tokens while reasoning tasks collapse at 16k, and leaves open whether that stability comes from memorized benchmarks.

Three papers limit the design. A Controllable Examination for Long-Context Language Models shows that inserted text which does not fit its surroundings becomes a shortcut, which it calls "the coherence trap." Filling the excised span with foreign or random text would therefore create a new cue, so our fillers come from the same document. Its fictional-biography benchmark, LongBioBench, has zero contamination by construction, which makes it our clean control. Detecting Data Contamination in LLMs via In-Context Learning introduces CoDeC, which detects memorization because added context lowers a memorized sample's likelihood. That result warns that long documents may also disturb memorized recall, and our distance curves test this. Finally, redundancy in Dolce's sense means that excision must remove every restatement of the evidence, not just the first.

Two papers supply the methods we evaluate. Why Does the Effective Context Length of LLMs Fall Short? introduces STRING. STRING is a training-free change to how token positions are encoded at inference: it combines a local window of recent tokens with well-trained position indices reused for distant tokens. The paper reports large gains on synthetic retrieval only. UniGist compresses distant text into summary ("gist") tokens and gives the model a raw window of only 128 tokens. It reports that models trained this way tend to ignore the compressed tokens. Neither paper asks whether its gains on natural text come from reading or from recall.

Research Program

The first component is a construction pipeline. For each item we locate the evidence spans. DetectiveQA supplies gold clue annotations, LongBioBench spans are known by construction, and for BAMBOO's question-answering sets we annotate evidence by hand and check it with an LLM-assisted search for paraphrased restatements. We then build four variants of each item with identical token length. The full variant is the original document. The cut variant replaces all evidence spans with passages sampled from the same document that do not mention the answer entities. The swap variant alters the evidence so that it supports a different, equally plausible answer. The moved variant places the intact evidence at a controlled distance before the question, with the rest of the document intact. The swap variant measures whether context or memory wins when they conflict. The cut variant measures whether memory alone suffices.

The second component is the corrected distance curve. At each distance $d$ we measure accuracy in the moved variant against the cut floor at the same length. We then define the corrected effective context length as the largest $d$ at which moved-variant accuracy stays significantly above the cut floor. This replaces the usual practice of reading effective length off raw accuracy, which on contaminated data never falls to chance.

The third component uses the probes to evaluate context-extension methods: full attention, sliding-window attention at several widths, STRING, and UniGist where checkpoints can be obtained. The question for each method is whether its improvement lies in the region above the cut floor (reading) or only raises accuracy on items where $R$ is already high (recall).

Baselines

The naive reference is raw full-context accuracy with no probe, which is how current long-context leaderboards report results. For scale, DetectiveQA reports that Claude 3 Opus reaches 81.95% multiple-choice accuracy but only a 37.33% reasoning score. Any contamination diagnostic has to say how much of the 81.95% is reading.

The strongest existing competitor for measuring memory reliance is closed-book testing as used by Dolce. We run it on the same items with the same prompts and answer extraction, giving it the same few-shot formatting budget as our probes. On Lacuna we found no reported closed-book accuracy for these benchmarks, so we compute it ourselves. Our probe beats this baseline if, on the controlled-contamination split described below, the cut variant separates contaminated from clean items with materially higher area under the ROC curve than closed-book accuracy does, and if closed-book accuracy leaves a significant cue gap.

The strongest existing detector is CoDeC, which reports 99.9% dataset-level AUC on short benchmarks (Detecting Data Contamination in LLMs via In-Context Learning). We apply it at the document and question level with its published protocol and the same log-probability access. We do not expect to beat CoDeC as a membership detector; it may well win. What CoDeC cannot provide is a per-item decomposition of accuracy into reading and recall, or a corrected context length. Our probe adds value if items flagged as contaminated by CoDeC show high $R$ while items with high $R$ still include cases CoDeC misses, or the reverse. Either finding is informative.

Two ablations isolate the key ingredient, which is targeted removal of evidence with the cue-bearing document kept intact. Random-span excision removes the same number of tokens at random locations. If it lowers accuracy as much as evidence excision, the probe is measuring disruption rather than evidence removal. Filler-source ablation replaces same-document fillers with text from other books. This tests the coherence trap: if foreign fillers inflate or deflate $A_{\text{cut}}$, same-document filling is required.

Why not just…?

Why not just use closed-book testing? It is cheaper and already standard. Our worry is that recall of a specific novel's murderer or a specific report's figure is triggered by the surrounding text, so a bare question underestimates memory. This is an empirical claim, and the cue-gap measurement on the controlled split settles it. If $A_{\text{cut}} \approx A_{\text{cb}}$ there, we will report that closed-book testing suffices and reduce the proposal to the corrected distance curves, which closed-book testing still cannot produce.

Why not just use post-cutoff or synthetic data, like BAMBOO and LongBioBench? Clean data avoids the problem instead of measuring it, which works for new benchmarks. But the existing natural-text benchmarks behind published context-length claims, such as DetectiveQA's novels and the tasks Dolce reclassifies, are already in use, and "post-cutoff" expires with each new model. Synthetic data runs into the coherence trap and short attribute templates documented by A Controllable Examination. We use both kinds of data as controls rather than as replacements.

Why not just use counterfactual editing, the swap variant alone? This is the most serious threat, because conflicts between context and memory are a familiar probe. Swapping tests which source the model prefers when both are present, and a model can follow an edited passage while still relying on memory whenever the passage is out of reach. Only excision measures what the model does at long distances when the evidence is effectively invisible, which is what matters for estimating context length. We report both. If swap-following rate predicts $A_{\text{cut}}$ almost perfectly across items, the cheaper swap probe wins, and we will say so.

Why not just run CoDeC on long documents? CoDeC answers whether data was seen in training, not whether a given correct answer came from reading. The same benchmark can be contaminated yet mostly read, or clean at the question level yet answerable from general plot knowledge. The comparison in the Baselines section tests whether the two signals diverge.

Proposed Experiments

The decisive experiment is controlled contamination. We take a set of post-cutoff long documents, including BAMBOO sources and public-domain novels newer than the model's cutoff for which we write DetectiveQA-style questions. We continue pretraining Llama-3.1-8B on a random half of the documents, together with synthetic plot summaries of them, and leave the other half unseen. This gives exact contamination labels on text from a single distribution. The predictions are that $R$ and the cue gap are high on the trained half and near zero on the untrained half. We also predict that the uncorrected effective context length on the trained half exceeds the corrected one, while the two roughly agree on the untrained half. If the corrected and uncorrected lengths agree on both halves, the core claim fails.

The field study applies the probes to the English portion of DetectiveQA, to BAMBOO's AltQA and PaperQA at 4k and 16k tokens, and to LongBioBench as the zero-contamination floor, using open models (Llama-3.1-8B and 70B, Qwen2.5). The prediction is that DetectiveQA classics show the highest $R$, LongBioBench shows $R \approx 0$, and the 100k-token drop that DetectiveQA reports appears sharper once the cut floor is subtracted.

The methods study compares full attention, sliding windows at 128 to 32k tokens, STRING, and UniGist on the same items. STRING reports gains of over 15 points for Llama 3.1 70B on RULER (Why Does the Effective Context Length of LLMs Fall Short?). UniGist reports an average HELMET score of 60.4, against 63.9 for full attention, on Llama-3.1-8B (UniGist). Neither result separates reading from recall. The decisive check is whether each method's improvement over its base model persists above the cut floor on the untrained half. We hypothesize that UniGist's reliance on its local window makes it lean on memory more heavily on contaminated items. If so, its HELMET gap to full attention would understate its reading gap on clean text.