Paper 2607.18213
SWE-Pruner Pro: The Coder LLM Already Knows What to Prune
- Published
- Jul 2026
- Research lab
- Independent
- Citations
- 0
- GitHub
- 16 stars
01 In brief
Summary
SWE-Pruner Pro is a method for pruning long tool outputs in coding agents by reading line-level importance directly from the agent's own internal representations, eliminating the need for a separate scoring model or explicit goal-hint query.
A lightweight head, trained with a per-sample balanced focal loss and a length-aware embedding, converts the frozen backbone's last-layer hidden states into per-line keep-or-prune decisions.
Evaluated on two open-weight backbones (MiMo-V2-Flash and Qwen3-Coder-Next) across four multi-turn benchmarks, it saves up to 39% of tokens while preserving task quality, and even improves SWE-Bench Verified resolve rate by +3.8% and Oolong accuracy by +2.2 points on MiMo-V2-Flash.
The in-server head adds only 15.0% aggregate wall time.
Ablations show the per-sample balanced focal loss and length-aware embedding are key to its performance, with the loss improving judge scores by +1.13 over BCE and the embedding by +0.22.
The method is limited to open-weight models and Python-centric benchmarks, though it is language-agnostic and transferable to other backbones with retraining.
02 From the paper
Abstract
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.