A retrieval conditioned rebinding circuit for dynamic entity tracking in large language models

Soyoung Oh, Vera DembergarXiv 2026

TL;DR

Large language models (LLMs) track changing entity states (like items being swapped between boxes) not by constantly updating an internal mental model, but by deferring the computation until a question is asked. This paper identifies a compact, multi-stage attention head circuit responsible for this "retrieval-conditioned rebinding" and reveals that while this strategy is shared across Gemma and Llama models, their underlying low-level implementations differ significantly.

What Problem Does This Paper Address?

How do large language models keep track of changing properties in a discourse? If a text says "Box R contains the rabbit. Box S contains the sock. Swap the items of Box S and Box R," an LLM can easily tell you that Box R now contains the sock. However, the underlying mechanism driving this ability has remained a black box.

The authors investigate two competing hypotheses for how LLMs handle these state updates:

  1. Global State Update: The model incrementally updates its internal representation of the world as soon as it encounters a state-changing instruction (simulating the swap immediately).
  2. Retrieval Conditioned Rebinding: The model leaves the original entity-attribute bindings intact and stores the swap instruction compactly, only resolving the final, updated mapping at the very end when a query forces it to do so.

Methods

The authors employ a suite of mechanistic interpretability techniques to dissect four instruction-tuned models (Gemma2-9B, Gemma3-12B, Llama3.2-3B, and Llama3.1-8B):

  • Causal Mediation Analysis (Interchange Interventions): The authors swap activations between original and counterfactual prompts (e.g., changing the object or the box names) to trace exactly when and where role-specific information influences the final prediction.
  • Path Patching: They use V-patching (value-step) and Q-patching (query-step) to isolate the exact information-routing pathways between attention heads, uncovering a localized circuit.
  • Role-Specific Interchange Interventions: By forcing attention patterns from a counterfactual run into an original run, they discern whether specific head groups are responsible for address routing (pointers) or content delivery (payload).
  • Q/K Subspace Probing: They estimate the geometric directions of "binding IDs" within the Query-Key spaces to see how models mathematically match entities to their attributes.

Datasets

The paper utilizes a controlled, synthetic dynamic entity tracking task adapted from prior literature.

  • Standard Setup: Prompts consist of initial state sentences mapping 3 boxes to 3 objects, a single swap instruction, and a question asking about the contents of a specific box.
  • Generalization Setup: To ensure the findings weren't artifacts of a simplistic prompt, they scaled the task up to 5 boxes with an additional distractor swap to test the robustness of the discovered circuits.

Key Insights and Ideas

  • LLMs are "Lazy" State Trackers: Instead of actively maintaining a running simulation of the world state, LLMs defer the heavy lifting. The final binding resolution is triggered primarily at retrieval time (when the model processes the query colon : token).
  • A Highly Localized Circuit: The complex behavior of tracking state changes is governed by a remarkably small subset of components. In Gemma-9B, a circuit consisting of just 5.7% of the total attention heads is enough to recover near-full model performance.
  • The Circuit's Blueprint: The authors mapped this behavior to five functional roles acting in a chain: Binding Anchor $\rightarrow$ Swap Position Transmitter $\rightarrow$ Position Updater $\rightarrow$ Dereferencer $\rightarrow$ Answer Retriever (visualized in Figure 2).
Figure 2: Path patching circuit for the retrieval conditioned rebinding mechanism. Rows denote functional head groups A–E at specific tokens; Columns denote layers. Horizontal arrows indicate attention mediated value routing. Vertical dashed arrows indicate residual stream composition between head groups, with V and Q denoting value
  • Same Behavior, Different Math: While both Gemma and Llama families use retrieval-conditioned rebinding, they implement it differently. Gemma models rely on symmetric Query/Key subspace matching (the query actively looks for a matching key). Llama models, conversely, are heavily key-dominated, meaning the rebinding information is primarily driven by changes within the key vectors themselves.

Key Results

  • Token-Level Dissociation: Causal mediation analysis showed that information about the target object is retrieved directly from its original context, whereas box information is heavily mediated through intermediate tokens after the swap command (see Figure 1).
Figure 1: Information flow of crucial tokens using interchange interventions in Gemma-9B. y-axis: model layers; x-axis: shared original prompt template. Each colored token is varied in a separate experiment: Exp1. Reference box, Exp2. Swap target box, Exp 3. Object, all other black tokens are unchanged; cell: reports normalized IIA, darker cells indicating stronger causal mediation.
  • Circuit Performance: The pruned attention circuits successfully captured the models' tracking capabilities. The Gemma-9B circuit achieved 0.89 candidate accuracy (compared to 1.00 for the full model and 0.34 for a random baseline).
  • Pointer vs. Content Routing: In pointer intervention experiments on the "Dereferencer" head group (Group B), patching the attention pattern shifted the model's prediction toward the target object by a massive logit margin of 6.79, while content control patches yielded a negligible change of 0.26, proving Group B functions strictly as an address router.

Limitations and Future Work

  • Highly Controlled Environment: The study relies on a synthetic setup with single-token objects and simple alphabetical box names. Real-world discourse involves far more complex, implicit state changes and multi-token entities.
  • Single Swaps: The current framework focuses on a single state transition (or one distractor). How these circuits scale or adapt to long sequences of multiple sequential updates remains an open question.
  • Linearity Assumption: The Q/K subspace interventions assume that binding IDs are represented linearly in the activation space. If models represent these relationships non-linearly or dynamically across layers, the current intervention methods might underestimate the mechanism's complexity.

Summary updated

BibTeX
@misc{oh2026retrieval,
  author = {Soyoung Oh and Vera Demberg},
  title = {{A retrieval conditioned rebinding circuit for dynamic entity tracking in large language models}},
  year = {2026},
  eprint = {2606.08644},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.08644},
}
Figure