TL;DR
This paper investigates whether Large Language Models (LLMs) can track the changing states of entities in a discourse (e.g., knowing where an object is after a series of moves). The authors find that while most text-only models fail this task out-of-the-box, models pretrained on code (like GPT-3.5) exhibit a surprising emergent ability to track entities, suggesting that the logic of variable tracking in programming translates to better natural language understanding.
What Problem Does This Paper Address?
To truly understand a story or a set of instructions, a listener must maintain a "mental map" of the entities involved. If a recipe says "put the eggs in the bowl and mix," you need to know the eggs are now in the bowl and their state has changed to "batter."
While LLMs are great at generating fluent text, it’s unclear if they actually track these underlying state changes or just rely on surface-level statistical patterns. Previous benchmarks for this ability, such as the Alchemy dataset, were found by the authors to be "leaky"—models could often guess the correct answer using simple shortcuts (like assuming a beaker is empty or hasn't changed) without actually doing any tracking. This paper aims to build a more rigorous, shortcut-proof benchmark to see if LLMs possess a genuine capacity for discourse entity tracking.
Methods
The authors designed a programmatically generated task involving objects and boxes. A typical prompt describes an initial state and a series of operations:
“Box 1 contains the book. Box 2 contains the apple. Move the book into Box 2. Box 2 contains ____”
To ensure the task measures actual tracking rather than pattern matching, they followed four "desiderata":
- Distributional Independence: States shouldn't follow common patterns found in web text.
- Context Dependence: Individual words (like "drain") shouldn't give away the final state.
- Lexical Disjointness: Training and evaluation should use different words/phrasings.
- No Slot-Filling: The task shouldn't be solvable by simple template matching.
The researchers evaluated models in two ways: In-context learning (probing GPT-3, GPT-3.5, and Flan-T5 with a few examples) and Finetuning (training smaller T5 models specifically on this task).
Datasets
- The Boxes Dataset: A new benchmark featuring 100 distinct objects and 7 boxes, with scenarios involving up to 12 state-changing operations.
- Variants: The authors created harder versions, including
AmbiRef(using ambiguous descriptions like "the big brain" vs "the brain") andMoveContents(moving everything in a box at once, requiring the model to remember what was there). - Reanalysis: They also performed a critical re-evaluation of the existing Alchemy and TextWorld datasets.
Key Insights and Ideas
- The "Code" Connection: The most striking finding is that GPT-3.5 models—which were trained on a mix of text and code—performed significantly better than GPT-3 models trained primarily on text. The authors hypothesize that tracking variables in code provides a "grounding" signal that helps models learn to track entities in language.
- Pretraining is a Prerequisite: When training a small model (T5) from scratch on this task, it failed. However, a pretrained T5 could be finetuned to near-perfect accuracy. This suggests that general language pretraining provides the necessary "building blocks" for entity tracking, even if the ability doesn't surface until the model is specifically prompted or tuned.
- Tracking is Brittle: Even for the best models, performance drops as the number of operations increases. Tracking a state through one or two changes is easy; tracking it through seven is much harder.
Key Results
- Zero-Shot Failure: Vanilla GPT-3 (davinci) and Flan-T5 essentially failed the task, often just repeating the initial state of the boxes.
- GPT-3.5 Success:
text-davinci-003(a code-augmented model) achieved non-trivial accuracy, correctly predicting box contents even after 7 operations in over 25% of cases—far exceeding a strong random baseline. - Code vs. Text: As shown in Figure 5, models trained on code (solid lines) systematically outperformed those trained only on text (dotted lines).
- Finetuning: A finetuned T5-base model reached near 100% accuracy on simple scenarios but struggled when the task required resolving ambiguous references or moving entire box contents.
Limitations and Future Work
- Behavioral vs. Causal: The study is behavioral; it shows that models can do this, but not exactly how their internal representations are changing.
- Context Window: The experiments were limited to short discourses that fit within a standard context window. Tracking entities across a whole novel remains a much larger challenge.
- Stability: The "brittleness" of the tracking suggests these models aren't yet reliable enough for critical applications requiring perfect state logic.
- Future Directions: The authors suggest investigating how pretraining on code specifically changes a model's internal "world model" and whether this effect holds across different languages.
Summary updated