arXiv(opens in a new tab)cs.AISep 2026Cited by 8 papers on PaperVantage

Manuscript Offprint

arXiv:2609.37725

Context Language Models

Rulin Shao, Shannon Zejiang Shen, Junjie Oscar Yin, Yuetai Li, Minheng Wang, Hamish Ivison, Radha Poovendran, Nathan Lambert, Teng Xiao, Mike Lewis, Wen-tau Yih, Luke Zettlemoyer, Pang Wei Koh

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Rulin Shao1,2^{1,2}, Shannon Zejiang Shen3^{3}, Junjie Oscar Yin1,2^{1,2}, Yuetai Li1^{1}, Minheng Wang1^{1}, Hamish Ivison1^{1}, Radha Poovendran1^{1}, Nathan Lambert4^{4}, Teng Xiao1^{1}, Mike Lewis2^{2}, Wen-tau Yih2^{2}, Luke Zettlemoyer1,2^{1,2}, Pang Wei Koh1^{1}

1^{1}University of Washington, 2^{2}Meta Superintelligence Labs, 3^{3}MIT, 4^{4}Trillium Labs

We introduce Context Language Models (CLMs), language models that natively manage their own context. We implement this by treating the context as a file and allowing the model to make unrestricted updates to this file. This allows the model to learn what is most important to maintain in context, and naturally extends to multi-agent systems where multiple agent contexts coexist as files. Building CLMs zero-shot with existing models outperforms SOTA context-management strategies across a variety of tasks: 11.4% higher accuracy with 21.5% fewer FLOPs on BrowseComp-Plus, 5% higher scores with 59% fewer FLOPs on 12-hour EdgeBench, and 65% greater improvement with the same compute on a 24-hour multi-repository agent-swarm task. Moreover, by shifting context management from external harness control to intrinsic model behavior, CLMs naturally enable both in-context and parametric learning of context-management strategies. We show that CLMs can be steered with natural-language instructions evolved through a standard skill-optimization loop, improving held-out accuracy by up to 35.9 points on a context-management task while reducing compute. We also introduce an online reinforcement learning method for CLMs, improving Qwen3.5-9B performance on BrowseComp-Plus by 47.6% while using 12% fewer FLOPs. Finally, we co-design Suffix Cache Reuse for CLM serving, further reducing server-side compute by 35% relative to standard SGLang at matched performance.

Date: September 30, 2026

Correspondence: Rulin Shao at rulin@cs.washington.edu

Code: https://github.com/facebookresearch/context-language-models

Meta

1 Introduction

Despite the fact that context is the cornerstone that allows a language model (LM) to process and retain information over time, context management is not traditionally a native LM capability. Instead, prior work mostly relies on harnesses, either hand-engineered (Cassano and Rush, 2026; OpenAI, 2026a; Merrill et al., 2026) or optimized offline by agents (Lee et al., 2026). Recent work adds a constrained set of tools with fixed strategies such as compaction, offloading, and retrieval, to the agent's action space (Yan et al., 2026; Yu et al., 2026; Li et al., 2026c; Liu et al., 2026; Zhang et al., 2025a). In contrast, we show that giving LMs unrestricted access to manage their own context outperforms human-designed baselines, enabling adaptive and creative context-management strategies to emerge. Our findings echo The Bitter Lesson (Sutton, 2019): we should let LMs search for and learn better strategies that go far beyond existing human priors.

Concretely, we introduce Context Language Models (CLMs), which are natively capable of managing their own context. We show existing LMs can be turned into strong CLMs and can be further improved through in-context learning and reinforcement learning. Formally, a CLM parametrized by θ\theta makes context an artifact of the LM: ct+1=fθCLM(ct)c_{t+1} = f_{\theta}^{\text{CLM}}(c_t), where ctc_t is the context at turn tt and fθCLMf_{\theta}^{\text{CLM}} can be an arbitrary function controlled by CLMs. In contrast, a standard LM simply appends new tokens to the existing context: ct+1=ct⊕fθLM(ct)c_{t+1} = c_t \oplus f_{\theta}^{\text{LM}}(c_t).

We implement CLMs by treating context as a file. Specifically, we mirror the context into a storage space with LM write access. The LM can either append newly generated tokens or use Bash to freely edit the context file, with each modification immediately synchronized to the LM's live context for the next turn. This design naturally extends to multi-agent systems, where multiple context files can coexist and be managed by CLMs for agent-swarm or subagent workloads.

References (35)