Is Lost-in-the-Middle Partly a Memory Artifact? Counterfactual Multi-Hop Tests with Chain Fingerprints

Language models answer worse when the key evidence sits in the middle of a long prompt, and worse again when two pieces of evidence that must be combined are far apart. Nearly all of this evidence comes from HotpotQA, 2WikiMultihopQA and MuSiQue. These are public Wikipedia-derived benchmarks, and models have very likely seen both the benchmarks and the underlying facts during pre-training. A model that already "knows" that Christopher Nolan was born in London does not need to find that sentence in the prompt at all, wherever it sits. The positional curves we have may therefore mix two things: a model reading its context, and a model reciting from memory. Memorized items should look position-insensitive, which would make the measured positional penalty smaller than the true one. The same mixing could also make decoding-time fixes look better or worse than they really are.

We propose to separate the two. For each multi-hop item we build a counterfactual twin: the same reasoning chain, relations and question form, but with the bridge and answer entities consistently replaced so that memory gives the wrong answer and only the prompt gives the right one. To confirm that a twin really preserves the original's reasoning structure, and to search open pre-training corpora for leaked chains cheaply, we borrow the core idea of perceptual hashing. A perceptual hash is a compact fingerprint that stays the same under harmless changes such as recompressing an image, but changes when the content is altered. Here the fingerprint is of the chain's structure rather than its surface text. In two sentences, the idea is this: re-measure lost-in-the-middle and lost-in-between on items the model provably cannot answer from memory, and report how much of the published positional effect, and of published fixes for it, survives. A structural fingerprint makes the matched twins and the contamination audit verifiable and cheap.

Core Claim

The claim has three parts, each testable. First, on multi-hop items the model can answer from parametric memory, accuracy depends only weakly on where the evidence sits and how far apart the pieces are. Second, on structurally matched counterfactual twins, both the U-shaped positional curve and the "lost in-between" distance penalty are markedly steeper. Published estimates of positional sensitivity on these benchmarks are therefore diluted by contamination. Third, inference-time fixes that reweight distant against local evidence can partly work by amplifying parametric recall. Their gains should shrink on counterfactual twins, where memory points to the wrong answer.

The main measured quantity is a contamination gap in positional sensitivity:

$$\Delta = S(\text{counterfactual}) - S(\text{original}),$$

Here $S$ is a sensitivity score computed on a set of items. It is either the accuracy range across the absolute positions of the gold evidence, or the fitted slope of accuracy against the number of distractor documents placed between the two evidence documents. A reliably positive $\Delta$ is the finding.

Where This Sits in Prior Work

The motivating result is Lost in the Middle, and In-Between. That paper places multiple gold documents among 20 and shows that accuracy falls with absolute position and also with the distance between evidence documents. For GPT-3.5 on 2-hop HotpotQA, accuracy moves from roughly 50% with adjacent evidence to 45% with separated evidence. It explicitly does not check whether its benchmarks were in the models' training data. We reuse its placement protocol unchanged and add the missing control. The original single-needle finding (Lost in the Middle) and its serial-position framing (Serial Position Effects of Large Language Models) share the same blind spot.

Two mechanistic papers make the confound plausible rather than hypothetical. Exploiting Contextual Knowledge in LLMs through V-usable Information based Layer Enhancement finds that the usefulness of prompt information peaks in intermediate layers and then decays, so parametric knowledge can override the context. Studying and improving reasoning in humans and machines shows that memorized puzzles are completed with near-zero surprise. Together these suggest that memorized items bypass context reading, and with it the positional bottleneck.

The main fix we stress-test is Positional Contrastive Decoding, from Mitigating Posterior Salience Attenuation in Long-Context LLMs. That method builds a deliberately near-sighted copy of the model's output scores by over-rotating the model's rotary position encoding. It then subtracts this copy, so that tokens supported only by nearby text are penalized. The paper never asks whether the boosted distant signal comes from the context or from memory, and we test exactly that.

On the contamination side, Rethinking Benchmark and Contamination with Rephrased Samples shows that paraphrased test items slip past n-gram filters. It detects them with dense retrieval followed by a GPT-4 judge. We reuse that detector as a reference, but our unit of comparison is a multi-hop chain rather than a single-turn question. The contamination survey supplies the taxonomy we stratify by, separating data-level exposure (questions seen) from label-level exposure (question and answer seen). DyVal avoids contamination by generating synthetic reasoning graphs on the fly. It is a constraint on our design rather than a competitor. Its problems are short formal prompts, not retrieval over long documents, so it cannot measure lost-in-between by itself. We use it as an uncontaminated reference point.

MuSiQue prevents leakage between its own splits and blocks disconnected shortcuts, but it cannot protect against exposure during web-scale pre-training after release. Its composition-from-single-hops structure is what makes clean entity substitution feasible.

The hashing idea is borrowed from image and web forensics. Do NFTs' Owners Really Possess their Assets? matches near-duplicate assets by the Hamming distance between perceptual hashes, and The Poorest Man in Babylon hashes website layouts to find shared scam templates. The DermaMNIST audit showed that perceptual similarity tools, not exact matching, exposed that about 13.47% of lesions appeared in more than one split. The file itself notes that such hashing has not been extended to textual reasoning structure. That extension is our methodological contribution, deliberately kept secondary to the measurement question.

Research Program

Chain fingerprints. We first build the structural fingerprint. Each multi-hop item comes with gold supporting paragraphs. We entity-link each hop and reduce it to a signature made of two parts:

  • the relation type (for example, director-of, birthplace-of);
  • the coarse types of its subject and object entities.

We then hash the ordered set of hop signatures into a short bitstring using a locality-sensitive scheme, so that similar chains land at small Hamming distance. This is the textual analogue of keeping low-frequency image structure while discarding texture. The resulting hash should be invariant to paraphrase and to renaming entities within a type, and sensitive to changing a relation, adding a hop, or reordering the bridge. A second, content-bearing hash that includes entity identities distinguishes an exact chain leak from a mere structural match.

We validate both hashes on a labeled set built from benchmark items and their variants:

  • LLM paraphrases, in the style of Yang et al.;
  • entity-renamed twins;
  • deliberately structure-altered versions.

The score is how well each hash ranks true matches above non-matches, together with cost per comparison.

Counterfactual twins. Next we construct twins for HotpotQA, 2WikiMultihopQA and MuSiQue-Ans, stratified into 2, 3 and 4 hops. For each item we substitute the bridge entity and the answer consistently across all gold paragraphs and the question. Replacements are same-type entities, either real but wrong or fictional, so the paragraphs stay internally coherent. A twin is accepted only if three conditions hold:

  • its structural hash equals the original's;
  • its content hash differs;
  • the model under test fails the twin question closed-book, meaning with no documents, while still answering correctly when given only the two gold paragraphs.

The last condition matters. It guarantees that the twin remains solvable from context, so any positional drop reflects reading failure rather than broken text.

Contamination strata. For original items we assign three contamination labels per model:

  • closed-book answerability;
  • a chain-leak flag from content-hash search over an open pre-training corpus such as RedPajama, where the model's corpus is known;
  • Yang et al.'s decontaminator verdict on a subsample.

These labels let us distinguish "the model knows the fact" from "the model saw this benchmark chain."

Positional measurement. Finally we run Baker et al.'s 20-document placement grid on originals and twins alike. Absolute position runs over all slots, and the distance between evidence documents runs from 0 up to the maximum allowed by the grid. We then add Positional Contrastive Decoding and chain-of-thought prompting on top of the same grid.

Baselines

Naive reference. Standard greedy decoding on the unmodified benchmarks, with Baker et al.'s document placement and no contamination control. This is exactly how the literature currently reports positional sensitivity. The strongest published number here is GPT-3.5's drop on 2-hop HotpotQA from about 50% with adjacent evidence to 45% with separated evidence (Baker et al.). We rerun this protocol ourselves on each model rather than comparing against the printed figure, so prompts, document pools and decoding settings are identical. Our claim beats this reference if the distance slope on counterfactual twins is significantly steeper than on originals for the same model, judged by a paired bootstrap over items.

Closed-book stratification alone. Split the original items by whether the model answers them without context, then measure positional curves in each stratum. This is the cheapest serious competitor for the measurement question. It uses the same items, same models and same grid, and involves no twins and no hashing. If this split reproduces the full $\Delta$ that twins reveal, the twin and hash machinery add nothing for measurement. We would then say so and keep only the twins' role in testing decoding fixes. The twins beat this baseline only if items that fail closed-book still show flatter curves than their twins. That would mean partial priming from exposure, which closed-book testing misses.

Strongest existing positional fix. Positional Contrastive Decoding, with its reported results as the reference: Llama-3-8B-262k improves from 72.0% to 79.0% on InfiniteBench key-value retrieval at 8k, and variable-tracking F1 on RULER at 16k improves from 64.40 to 69.04 (Xiao et al.). No reported result was found on Lacuna for this method on HotpotQA, 2WikiMultihopQA or MuSiQue. We run it on rotary-encoded open models using the authors' strength-parameter range, with the same tuning budget on originals and twins. The tuning set is drawn from originals only, mimicking current practice. The finding is that its gain on twins is significantly smaller than on originals, or negative. We also report on how many twin items it moves the output toward the memorized, now-wrong original answer.

Strongest contamination detector. Yang et al.'s dense-retrieval-plus-LLM-judge decontaminator, which reports F1 of 0.94 to 1.0 on rephrased single-turn benchmarks (Rethinking Benchmark and Contamination). No reported result was found on Lacuna for it on multi-hop chains. It runs on the same candidate pools as our hash. The chain hash beats it if it matches its recall on paraphrased and renamed chains at a small fraction of the judge calls. Separately, the hash must beat plain n-gram overlap and plain embedding similarity on structure-altered negatives.

Ablation. Twins built by random entity substitution without the structural-hash equality check. This isolates whether hash-verified structure matching actually controls difficulty. If unverified twins show the same $\Delta$ and the same gold-only accuracy, the verification step is unnecessary.

Why not just…?

Why not just use closed-book accuracy as the contamination label and skip twins? This is a real threat, and it is built in as a baseline above. Closed-book testing measures whether the answer can be recalled without context. It cannot give memory-free versions of the same items, so any comparison between strata is confounded by differences in difficulty: items that are easy to recall may also be easy to reason about. Twins hold structure fixed and change only whether memory helps. Closed-book testing also cannot evaluate whether a decoding fix is amplifying memory, because that needs items where memory and context disagree. If the stratification baseline fully matches the twins on $\Delta$, we will report the measurement result using the simpler tool.

Why not just evaluate on DyVal-style synthetic graphs, which are contamination-free by construction? DyVal problems are compact formal descriptions, not collections of Wikipedia-style documents among distractors. They cannot reproduce the 20-document distance manipulation that defines lost-in-between. Its own reported 13.6% drop for GPT-4 under reversed ordering also shows that surface form strongly shifts results, so it cannot stand in for natural text. We include a long-context DyVal variant only as an uncontaminated anchor.

Why not just run Yang et al.'s decontaminator on chains instead of inventing a hash? For a few thousand benchmark items, one could. The judge's cost grows with the number of candidates per item. The survey notes that relying on a strong model to judge contamination is costly and is capped by that judge's own ability. The hash earns its place only for corpus-scale search and for guaranteeing structural matches between twins. The detector-comparison experiment decides whether it does, and if the hash loses on recall we fall back to the judge for auditing.

Why not just use MuSiQue, which already controls leakage? MuSiQue's controls address overlap between its own splits and shortcuts that skip a hop. They say nothing about models ingesting the released benchmark or the underlying Wikipedia facts. Our strata are computed on MuSiQue too, and a finding that its originals also show $\Delta > 0$ would be informative in itself.

Proposed Experiments and Decisive Checks

The central experiment computes $\Delta$ for each model and each hop count across HotpotQA, 2WikiMultihopQA and MuSiQue-Ans. The models include an ALiBi model and a rotary-encoded model, matching those Baker et al. used where available, plus a rotary long-context model for the decoding tests. The claim fails if confidence intervals on $\Delta$ include zero across benchmarks. That would be a clean negative result: published positional curves would be trustworthy despite contamination.

A second decisive check is a dose-response analysis. Within original items, positional sensitivity should decline monotonically from items flagged by neither closed-book nor hash, through closed-book-only, to items that are both closed-book answerable and chain-leaked. A flat pattern would argue against memory as the mechanism.

The third check concerns Positional Contrastive Decoding. We compare its accuracy gain on originals versus twins and track how often its outputs flip to the stale original answer on twins. A gain that holds up on twins would clear the method of the concern. A gain that collapses would show that its long-context improvements need contamination-controlled evaluation.

The fourth check is the hash validation: ranking quality on paraphrase, renaming and structure-change sets, and the number of judge calls saved relative to the decontaminator at matched recall.

All item lists, twins, hashes and per-item contamination labels will be released. Future positional work can then report results on memory-free items by default.