arXiv:2606.23525cs.CL2026-06被引 1

让大模型自己决定何时压缩上下文,省 token 又提效果。

Self-Compacting Language Model Agents

论文配图:Self-Compacting Language Model Agents
图 1 · 摘自论文原文
  • 模型自判时机,用轻量规则触发摘要工具
  • 数学任务准确率提升18.1点,搜索任务提5-9点
  • 无需微调,适合长流程推理场景

由思维链和工具调用组成的长代理轨迹会积累过时内容,最终超出上下文窗口。现有方法采用固定间隔的压缩机制,但不考虑轨迹结构,可能在推导或搜索中途错误丢弃结果。本文提出 SelfCompact,让模型自身判断何时何地压缩。它结合两个运行时组件:(i) 模型可调用的摘要工具,(ii) 轻量级规则,用于判断何时触发(子任务完成或轨迹收敛)或抑制(推导中或卡住)。两者缺一不可。单独使用工具会导致使用不均,单独使用规则无法执行。二者结合实现无微调的自适应压缩。在六个基准(含数学与代理搜索)和七个模型上验证,SelfCompact以不到一半的令牌开销达到或超过固定间隔压缩效果,数学任务比无摘要基线最高提升18.1分,搜索任务提升5-9分,每题成本降低30%-70%。结果揭示一个元认知缺口:虽未提示模型无法判断自身上下文是否失效,但轻量规则可弥补此缺口,将压缩时机转化为无需训练即可提供的能力。

原文摘要 · Abstract (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.

大模型推理上下文压缩自适应机制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。