Context Compaction for World Models
Organizations: 1Boston University, Boston, Massachusetts, USA · 2AllSpice Inc., Boston, Massachusetts, USA.
Abstract
World models let observers explore and interact with generated worlds. Recent work shows that when observers revisit a region, current models often fail to regenerate it consistently. We view this as a context retrieval problem. LLM agents manage context retrieval at two layers of their stack. At the model layer, the KV cache design determines how much context fits in memory. At the agent harness layer, harnesses such as Claude Code pick the context sent to the LLM. Prior work on world models has mostly focused only on the model layer. In this paper, we make three contributions. First, we build a benchmark to measure world model context retrieval. It generates new worlds for every episode, preventing a model from recalling rooms using training data. It also separates context retrieval from guesses based on nearby frames. Second, we build an agent harness that performs context compaction for world models, which to our knowledge no prior work has studied. Third, we use our benchmark to study four world model designs. Context compaction lets our world models retrieve rooms up to 4 times beyond their context window without retraining. However, world models with sliding-window attention lose most of their context retrieval when dreaming. Therefore, a dreaming world agent benefits more from extending the reach of its world model using context compaction than switching to sliding window attention at the model layer.
Figures & tables
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Decode | |||
|---|---|---|---|
| Model | Batch 1 | Batch 16 | Prefill |
| Decoder-only | 5.74 | 17.42 | 14.53 |
| CED | 5.89 | 18.06 | 9.80 |
| CED-SWA | 5.30 | 11.37 | 9.56 |
| DD | 4.49 | 7.53 | 9.20 |
World Models
World models represent and predict how environments change, helping agents plan, act, and reason about possible futures.
See all 369 papers