ChatPaper.aiChatPaper

SWE-Pruner Pro:程式碼大型語言模型早已知道該剪去什麼

SWE-Pruner Pro: The Coder LLM Already Knows What to Prune

July 20, 2026
作者: Yuhang Wang, Yuling Shi, Shaoqiu Zhang, Jialiang Liang, Shilin He, Siyu Ye, Yuting Chen, Kai Cai, Xiaodong Gu
cs.AI

摘要

为编码代理的长上下文剪枝一直是高效上下文管理的关键技术。虽然现有上下文剪枝方法(如SWE-Pruner)通过附加一个独立的代码分类器来实现这一点,但我们发现,代理本身在读取工具输出时会编码内部表示,这些表示指示了代码上下文的相关性。基于这一发现,我们提出了SWE-Pruner Pro,它直接在代理内部对工具输出进行剪枝。具体来说,一个轻量级头部将代理自身的内部表示转换为每行代码的保留或剪枝标签,并附带一个长度感知嵌入,该嵌入与每个工具输出的行数相关联。在两个开放权重骨干网络和四个多轮基准测试中,SWE-Pruner Pro在保持任务质量的同时,节省了多达39%的提示和补全令牌,且推理开销可控。值得注意的是,在MiMo-V2-Flash上,SWE-Pruner Pro额外将SWE-Bench Verified的解决率提高了+3.8%,并将长上下文Oolong的准确率提高了2.2个百分点。
English
Pruning long context for coding agents has been a vital technology for efficient context management. While existing context pruning methods such as SWE-Pruner realize this by attaching a separate code classifier, we find the agent itself encodes internal representations indicating the relevance of code context when reading tool output. Based on this finding, we propose SWE-Pruner Pro, which prunes tool outputs directly inside the agent. Concretely, a small head turns the agent's own internal representations into a keep-or-prune label for each line, with a length-aware embedding keyed to each tool output's line count. Across two open-weight backbones and four multi-turn benchmarks, SWE-Pruner Pro saves up to 39% of prompt and completion tokens while preserving task quality, with bounded inference overhead. Notably, on MiMo-V2-Flash SWE-Pruner Pro additionally raises the SWE-Bench Verified resolve rate by +3.8% and the long-context Oolong accuracy by +2.2 points.