How do Language Models Bind Entities in Context?

Jiahai Feng, Jacob Steinhardt

Introduction

Researchers have identified a "Binding ID" mechanism in large language models (LLMs) that acts like a digital luggage tag, linking entities (like "Alice") to their attributes (like "Paris") using abstract internal vectors. These binding vectors are additive, position-independent, and surprisingly transferable across entirely different types of reasoning tasks. This work provides a significant step toward "mechanistic interpretability," showing that LLMs may be more symbolic and structured than their "black box" reputation suggests.

The Binding Problem

When you prompt an LLM with a context like, "Alice lives in France and Bob lives in Thailand," the model has to perform a cognitive task known as binding. It must link the attribute "France" specifically to "Alice" and "Thailand" to "Bob." If it fails, it might suffer from "attribute relation errors," hallucinating that Alice lives in Thailand.

Abstract Binding IDs link entities to their attributes in the model's internal activations.

While we know LLMs are highly capable of this task, the exact mechanism has remained elusive. Is the information stored merely through word order proximity, or is it a messy, distributed representation? This paper investigates whether LLMs use a structured, symbolic-like mechanism to manage these associations within their internal activations.

Methodology: Causal Interventions

The authors employ Causal Mediation Analysis to peek under the hood of models like LLaMA and Pythia. Their approach involves several targeted interventions:

  • Activation Swapping: They run the model on two different contexts (e.g., one about Alice/France and one about Eve/London). By swapping specific internal activations between them, they can observe if the model’s "belief" about who lives where changes.
  • Mean Interventions: They calculate "difference vectors" ($\Delta$) that represent the shift from one binding slot to another. By adding these vectors to a model's activations, they can artificially "re-bind" an entity to a new attribute.
  • RoPE Interventions: To test if binding depends strictly on word order, they manipulate the Rotary Position Embeddings (RoPE). This allows them to "move" a token's perceived position in the model's eyes without changing the actual text sequence.
Activation swapping intervention used to test binding representations.

To isolate this mechanism, the study uses several synthetic "binding tasks," including linking names to capitals, linking people to favorite foods or shapes, and more complex tasks like matching names to professional biographies or multi-hop reasoning.

Key Insights and Findings

1. The Binding ID Mechanism

LLMs don't just associate words by proximity. They assign abstract "Binding IDs" (internal vectors) to entities and their corresponding attributes. If Alice and France both receive "Tag A," the model knows they belong together.

2. Factorizability and High Fidelity

The representations are highly modular. In LLaMA-30B, swapping attribute activations led to a near-total reversal of the model's predictions. Accuracy dropped from ~99% to ~0% for the original attribute and moved entirely to the newly injected one, proving the intervention successfully captured the core binding information without affecting the model's knowledge of other entities in the context.

3. Position Independence

Binding is not merely a byproduct of word order. Even if the researchers "tricked" the model into thinking an attribute appeared at the beginning of the sentence using RoPE manipulation, the binding remained intact.

4. Task-Agnostic Tags

Perhaps the most surprising finding is that these Binding IDs are task-independent. A Binding ID used to link a name to a city in one task can be extracted and used to link a color to a shape in a completely different task. The model appears to have a general-purpose "tagging" system. For example, using binding vectors extracted from a CAPITALS task to intervene on a SHAPES task yielded high accuracy (up to 88%).

5. Scale Matters

The researchers found that this structured binding mechanism only emerges in "sufficiently large" models. Smaller models (like Pythia-70M) showed much messier, less factorizable representations.

Limitations and Future Work

While groundbreaking, the Binding ID mechanism isn't the only way LLMs associate information. In Multiple Choice Question (MCQ) tasks, the model uses a different "direct binding" strategy, linking labels (like "A") directly to option text rather than using abstract IDs.

Furthermore, the mechanism was less effective on tasks where attributes are long sentences rather than single tokens, suggesting the current intervention method might be too simple for complex, multi-token attributes. Finally, while the paper identifies what the representations look like (additive vectors), future work is needed to pinpoint the specific "circuits" (which attention heads or MLP layers) are responsible for creating or reading these tags.

Summary updated

BibTeX
@inproceedings{feng2024how,
  author = {Jiahai Feng and Jacob Steinhardt},
  title = {{How do Language Models Bind Entities in Context?}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=zb3b6oKO77},
}
Figure