In-context superposition: human-like working memory interference in large language models
Organizations: School of Psychological and Brain Sciences, Georgia Tech · Department of Psychology, New York University · Department of Cognitive Science, Indiana University Bloomington · Honda Research Institute USA ·
Abstract
Intelligent systems must maintain and manipulate task-relevant information online to adapt to dynamic environments. This capacity, known as working memory, is fundamental to human reasoning. Yet, human working memory is strikingly limited, maintaining only three to four items in a brain with billions of neurons. Surprisingly, large language models (LLMs), despite different substrates and direct access to prior context through attention, exhibit similar working memory limitations. Why should such different systems face analogous constraints? We propose that working memory limitations reflect a general trade-off of shared representations: representational compression and reuse support efficient learning and generalization, but also cause simultaneously active representations to interfere. We show a two-layer transformer trained on a working memory task can solve it perfectly, but diverse trained LLMs exhibit human-like limitations: performance declines with memory load, while retrieval is biased by recency and stimulus statistics. Mirroring humans, working memory performance in LLMs is also associated with broader model capability. Mechanistically, we show that LLMs encode multiple memories in entangled representations --- a condition we call in-context superposition --- and progressively suppress competing content while aligning the target with the readout. Moreover, a causal intervention that suppresses interfering information improves performance. Together, these findings suggest that working memory capacity reflects the ability to select task-relevant information under interference, a computational challenge shared by biological and artificial systems.
Figures & tables
| Lure | Stimulus size | Transition statistics | ||||
|---|---|---|---|---|---|---|
| Autoregressive | . | 51 ∗∗∗ | . | 30 ∗ | . | 36 ∗ |
| Teacher forcing | . | 32 ∗ | . | 26 | . | 62 ∗∗∗ |
| Letter alignment | Decodability | Subspace similarity | Target alignment | |||||
|---|---|---|---|---|---|---|---|---|
| Autoregressive | . | 15 ∗∗∗ | . | 42 ∗∗∗ | . | 16 ∗∗∗ | . | 78 ∗∗∗ |
| Teacher forcing | . | 13 ∗∗∗ | . | 14 ∗∗∗ | . | 22 ∗∗∗ | . | 76 ∗∗∗ |
| MMLU Pro | GPQA Diamond | IFEval | ||||
|---|---|---|---|---|---|---|
| Autoregressive | . | 78 ∗∗ | . | 88 ∗∗∗ | . | 69 ∗ |
| Teacher forcing | . | 70 ∗ | . | 72 ∗ | . | 82 ∗∗ |
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
| Autoregressive | Teacher Forcing | |||||||
| Model | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 |
| Qwen3.5 2B | 0.11 | 0.05 | 0.05 | 0.05 | 0.91 | 0.26 | 0.12 | 0.11 |
| Qwen3.5 4B | 0.92 | 0.50 | 0.26 | 0.21 | 1.00 | 0.97 | 0.90 | 0.86 |
| Qwen3.5 9B | 0.99 | 0.44 | 0.45 | 0.41 | 1.00 | 0.98 | 0.97 | 0.96 |
| Qwen3.5 27B | 1.00 | 0.99 | 0.88 | 0.84 | 1.00 | 1.00 | 0.99 | 0.99 |
| Gemma3 1B | 0.05 | 0.04 | 0.05 | 0.03 | 0.66 | 0.46 | 0.28 | 0.20 |