ChatPaper.aiChatPaper

自壓縮語言模型智能體

Self-Compacting Language Model Agents

June 22, 2026
作者: Tianjian Li, Jingyu Zhang, William Jurayj, Xi Wang, Chuanyang Jin, Mehrdad Farajtabar, Eric Nalisnick, Daniel Khashabi
cs.AI

摘要

由思维链和工具调用组成的长代理轨迹会累积陈旧内容,从而锚定后续生成过程,并最终超出上下文窗口的限制。现有的框架通过在达到令牌阈值时触发固定间隔的压缩来缓解这一问题。然而,此类触发机制不考虑轨迹结构,可能导致在推演或搜索中途丢弃部分结果。我们提出SelfCompact——一种让模型自身决定何时以及如何压缩的框架。具体而言,它将两个推理时元素配对:(i) 模型调用的压缩工具,用于总结累积的上下文;以及(ii) 一个轻量级准则,规定何时触发压缩(子任务已完成,或轨迹趋于收敛)以及何时抑制压缩(推演中途,或陷入卡顿)。两者缺一不可。仅靠工具本身,在开源模型中的使用不均,常常在无益的时机被调用,或根本不被调用;而仅凭准则则无法实际执行。两者结合,无需任何微调或外部监督,便能实现有效的自适应压缩。我们在六个基准测试(竞赛数学和智能体搜索)和七个模型上展示了实证结果。结果表明,SelfCompact在显著降低令牌成本的情况下,匹配甚至超越了固定间隔摘要总结,与无摘要基线相比,在数学任务上最高提升18.1个百分点,在智能体搜索任务上提升5-9个百分点,同时每个问题的成本降低30-70%。我们的结果揭示了一个元认知差距:尽管未经提示的模型无法可靠地判断自身上下文何时正在腐化,但一个轻量级准则弥补了这一差距,将何时压缩重新定义为框架无需训练即可提供的能力。
English
Long agent traces composed of chains of thought and tool calls accumulate stale content that anchor subsequent generations, and eventually outgrow the context window. Existing scaffolds mitigate it with fixed-interval compaction triggered at a token threshold. Such triggers pay no heed to trajectory structure, risking discard of partial results mid-derivation or mid-search. We propose SelfCompact, a scaffold that allows the model itself to decide when and how to compact. Specifically, it pairs two inference-time elements: (i) a compaction tool the model invokes to summarize the accumulated context, and (ii) a lightweight rubric specifying when to fire (a sub-task has resolved, or the trajectory is converging) and when to suppress (mid-derivation, or when stuck). Both are needed. The tool alone is unevenly used across open-weight models, often invoked at unhelpful moments or not at all; the rubric alone cannot act. Together, they elicit effective adaptive compaction without any fine-tuning or external supervision. We present empirical results on six benchmarks (competitive math and agentic search) and seven models. Our results show that SelfCompact matches or exceeds fixed-interval summarization at a fraction of the token cost, improving over a no-summarization baseline by up to 18.1 points on math and 5-9 points on agentic search at 30-70% lower per-question cost. Our results expose a meta-cognitive gap: although unprompted models cannot reliably tell when their own context is rotting, a lightweight rubric closes this gap, reframing when to compact as a capability that scaffolds can supply without training.