cs.AIOct 28, 2026

Context Compaction for World Models

Authors: Hayder Tirmazi

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

Explore similar work

CardsList
  1. Qwen-AgentWorld: Language World Models for General Agents

    Jun 23, 2026Yuxin Zuo, Zikai Xiao, Li Sheng +30LLM World ModelsAgentic RL

  2. How To Train Your World Model: Fine-tuning vs RAG for LM-based World Modeling

    Oct 1, 2026Dhananjay Ashok, Shantanu Agarwal, Vivek Datla +2LLM World ModelsWorld Model Learning

  3. Context Compaction Theory

    Aug 2, 2026Hayder Tirmazi, Sam Markelon, Allison Bishop +1LLM Context ManagementContext Compression