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.