Compress What You See, Not What You Say: Anchored Context Distillation for Latent-Observation Software Engineering Agents
作者: Zhensheng Zou, Guoqing Wang, Dan Hao
分类: cs.AI
发布日期: 2026-09-25
💡 一句话要点
提出LOHA与ACD以解决软件工程代理的上下文压缩问题
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture)
关键词: 上下文压缩 软件工程代理 潜在观察 锚定上下文蒸馏 行为一致性 智能助手 自动化工具
📋 核心要点
- 现有方法在上下文压缩时可能丢失重要信息,导致后续动作的执行受到影响。
- 本文提出LOHA和ACD相结合的方法,通过分离压缩历史与精确引用文本来保留关键行为信息。
- 实验表明,使用K=3时,Qwen3-4B和SWE-Master-4B-RL的上下文减少率分别为43%和57%,且解决率有所提升。
📝 摘要(中文)
工具观察主导了软件工程代理的上下文,使得长交互历史的维护成本高昂。现有的上下文压缩方法可能会丢失后续动作所需的信息,而将代理适应于软令牌表示可能会影响其原有行为。为减少上下文同时保留关键行动信息和代理行为,本文结合了潜在观察与硬动作(LOHA)和锚定上下文蒸馏(ACD),实现了历史信息的压缩与行为的约束。实验结果表明,在SWE-bench Verified上,K=3时,Qwen3-4B和SWE-Master-4B-RL的上下文减少率分别为43%和57%,同时解决率也有所提升。
🔬 方法详解
问题定义:本文旨在解决软件工程代理在长交互历史中上下文维护成本高的问题。现有方法在压缩上下文时可能丢失后续动作所需的信息,影响代理的决策能力。
核心思路:提出LOHA(潜在观察与硬动作)和ACD(锚定上下文蒸馏)相结合的框架,LOHA通过将旧的工具观察压缩为软令牌,同时保留代理的自身回合和最近K次观察的文本,确保信息的完整性和行为的一致性。
技术框架:整体架构包括两个主要模块:LOHA用于上下文压缩,ACD用于训练。LOHA将历史信息压缩为软令牌,而ACD则通过锚定行为在纯文本输入上进行蒸馏,确保代理在使用压缩表示时不偏离原有行为。
关键创新:最重要的创新在于LOHA和ACD的结合,LOHA有效地压缩了历史信息,同时ACD确保了代理行为的稳定性。这种设计与现有方法的本质区别在于同时关注信息保留和行为一致性。
关键设计:在实验中,K的设置对上下文压缩和任务性能有显著影响。使用K=3时,Qwen3-4B的上下文减少率为43%,而在32K-token限制下,Qwen3的解决率为21.1%。
🖼️ 关键图片
📊 实验亮点
实验结果显示,在SWE-bench Verified上,K=3时,Qwen3-4B和SWE-Master-4B-RL的上下文减少率分别为43%和57%,解决率提升至12.1%和21.8%。在单GPU服务中,Qwen3的实例吞吐量达到了全文本代理的1.9倍,显示出显著的性能优势。
🎯 应用场景
该研究的潜在应用领域包括软件工程中的智能助手、自动化代码生成和调试工具等。通过有效压缩上下文信息,代理能够在更低的计算成本下执行复杂任务,提升工作效率。未来,该方法可能在其他需要上下文理解的AI系统中得到广泛应用。
📄 摘要(原文)
Tool observations dominate the context of software-engineering agents, making long interaction histories costly to maintain. Existing context compression methods can discard information needed by later actions, while adapting agents to soft-token representations can compromise their original behavior. To reduce context while preserving action-critical information and agent behavior, we combine Latent Observations, Hard Actions (LOHA), a context layout that separates compressed history from text needed for exact reference, with Anchored Context Distillation (ACD), a training method that enables latent reading while constraining behavioral drift. LOHA compresses older tool observations into soft tokens while retaining the agent's own turns and the last K observations in text, providing compact access to historical information and exact access to recent content. To enable the agent to use this representation, ACD distills the base model's full-text predictions into the latent view while anchoring its behavior on plain-text inputs to the same base model. On SWE-bench Verified, K=3 reduces context per call by 43% for Qwen3-4B and 57% for SWE-Master-4B-RL, with resolve rates of 12.1% and 21.8% versus 14.5% and 27.5% for their uncompressed bases. A single-run recency sweep reaches 14.4% and 23.0% at K=8, with larger windows generally favoring task performance over compression. Under a 32K-token limit, Qwen3 with K=3 resolves 21.1% of a 199-instance subset versus 11.1% for the same adapted agent using full text. In concurrent single-GPU serving, it achieves 1.9 times that full-text agent's instance throughput.