arXiv:2607.02911cs.SEcs.AI2026-07被引 1

提出一种保留代码代理行为的观测压缩方法,显著降低推理成本。

CoACT: Action-Preserving Observation Compression for Coding Agents

论文配图:CoACT: Action-Preserving Observation Compression for Coding Agents
图 1 · 摘自论文原文
  • 基于下一步动作保持机制,筛选压缩后仍能引导相同行为的观测
  • 在SWE-bench上将平均令牌消耗降低33.0%,任务成功率接近原始模型
  • 适合需要高效上下文管理的智能编程助手场景

基于大语言模型的代码代理通过与开发环境的迭代交互完成软件工程任务,返回的观测信息不断累积于上下文中,成为主要的推理开销来源。观测压缩通过缩短观测内容来降低这一开销。然而,现有方法在效率与效果之间权衡不佳,因其未显式建模压缩对代理后续行为的影响。本文提出CoACT,一种面向代码代理的动作保持型观测压缩方法。CoACT基于下一步动作保持(NAP)机制,要求压缩后的观测与原始观测诱导出相同的下一步动作。通过检查代理的即时下一步动作,NAP提供了压缩是否保留任务持续求解所需信息的实际信号。训练阶段,教师模型首先生成每个观测的多个压缩候选;CoACT随后基于NAP设计动作保持奖励,剔除会改变代理下一步动作的候选,并结合长度缩减奖励,选择紧凑候选作为轻量压缩器的监督信号。在SWE-bench Verified数据集上,使用三种代理模型的实验表明,CoACT将平均总令牌消耗降低33.0%,同时保持任务求解效果接近未压缩代理。

原文摘要 · Abstract (English)

LLM-based coding agents solve software-engineering tasks through iterative interactions with development environments, where returned observations accumulate in the context and become a major source of inference cost. Observation compression reduces this cost by shortening observations before they are appended to the context. However, existing methods still exhibit an unsatisfactory efficiency-effectiveness trade-off, as they do not explicitly model how compression affects the agent's subsequent behavior. This paper proposes CoACT, an action-preserving observation compression method for coding agents. CoACT is built on next-action preservation (NAP), which requires a compressed observation to induce the same next action as the raw observation. By checking the agent's immediate next action, NAP provides a practical signal for whether a compression preserves the information needed for continued task solving. During training, a teacher model first generates multiple compressed candidates of each observation. CoACT then uses an action-preservation reward based on NAP to filter out candidates that would change the agent's next action, and uses a length-reduction reward to choose compact candidates as supervision for a lightweight compressor. Experiments on SWE-bench Verified with three agentic models show that CoACT reduces average total token consumption by 33.0% while maintaining task-solving effectiveness close to the uncompressed agent.

代码生成观测压缩推理优化

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