上下文语言模型

·

研究论文 · 2026/09/30

我们提出上下文语言模型(CLMs),这类语言模型能原生管理自身上下文。实现方式是将上下文视为文件,并允许模型对该文件进行无限制更新。这使模型能学习上下文中最重要的维护内容,并自然扩展到多智能体系统,其中多个智能体上下文作为文件共存。基于现有模型零样本构建的CLMs在多种任务上优于最先进的上下文管理策略:在BrowseComp-Plus上准确率提高11.4%且FLOPs减少21.5%,在12小时EdgeBench上得分提高5%且FLOPs减少59%,在24小时多仓库智能体集群任务上同等计算量下改进幅度高65%。此外,通过将上下文管理从外部框架控制转变为模型内在行为,CLMs自然支持上下文管理策略的上下文内学习和参数化学习。我们表明,CLMs可通过标准技能优化循环演化的自然语言指令进行引导,在上下文管理任务上将留出准确率提升高达35.9个百分点,同时减少计算量。我们还提出一种用于CLMs的在线强化学习方法,在BrowseComp-Plus上将Qwen3.5-9B性能提升47.6%,同时FLOPs减少12%。最后,我们为CLM服务协同设计后缀缓存重用,在匹配性能下进一步将服务器端计算量相对标准SGLang减少35%。

该研究提出了一种让语言模型原生管理上下文的新范式,在多个任务上以更少计算量实现更高性能,并展示了通过指令引导和强化学习优化上下文管理策略的潜力,对提升长上下文和多智能体系统的效率与效果具有重要意义。

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.

阅读原文

参与讨论