AIAny
Icon for item

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

Prunes tool-output lines inside a coding LLM agent by turning the agent's own internal representations into per-line keep-or-prune labels. Implements a small classification head plus a length-aware embedding, saving up to 39% of tokens across benchmarks while preserving task quality.

Introduction

Most multi-turn coding agents struggle with long tool outputs: they raise latency and token cost, yet relevance varies line-by-line. SWE-Pruner Pro's surprising insight is that a coder LLM already encodes relevance internally while reading tool output — you don't need a separate classifier. Tapping those internal activations lets the agent decide, per line, whether to keep or prune with minimal extra compute.

Key Findings
  • Core mechanism: attach a lightweight head to the agent's internal representations to predict keep/prune labels for each output line; include a length-aware embedding keyed to the tool output's line count to normalize across different output sizes.
  • Empirical impact: across two open-weight backbones and four multi-turn coding benchmarks, the method reduces prompt+completion tokens by up to 39% while maintaining task performance; on MiMo-V2-Flash it increases the SWE-Bench Verified resolve rate by +3.8% and long-context Oolong accuracy by +2.2 points.
  • Efficiency and deployment: pruning happens inside the agent (no external classifier), yielding bounded inference overhead and tighter alignment between pruning decisions and the agent's semantic understanding of the output.
Who it's for & Trade-offs
  • Great fit if you run or fine-tune open models for coding assistants and need to reduce token costs and latency without losing task accuracy; useful for multi-turn tool-heavy workflows where many output lines are auxiliary.
  • Look elsewhere if you only have black-box access to closed-source LLMs (no activation hooks), if tool outputs must be preserved verbatim for auditing, or if your task depends on rare, late-occurring lines that aggressive line-level pruning might remove.
  • Practical note: the approach requires access to internal activations and some calibration per backbone; although inference overhead is bounded, teams must weigh the engineering cost of integrating the pruning head versus running an external filter.

Information

  • Websitearxiv.org
  • AuthorsYuhang Wang, Yuling Shi, Shaoqiu Zhang, Jialiang Liang, Shilin He, Siyu Ye, Yuting Chen, Kai Cai, Xiaodong Gu
  • Published date2026/07/20

More Items

Introduces Declarative Attention (DA), a zero-shot protocol that has LMs declare which parts of long context to attend to during chain-of-thought, letting the runtime build dynamic attention masks and skip most KV-cache reads. Produces large token savings (up to ~52% on Gemma-4-31B) with modest accuracy loss.

Generates compact keyword sets for both queries and items with LLMs and matches them directly via an inverted index. Uses supervised fine-tuning to align keyword spaces, then alternates GRPO-based reinforcement learning on query- and item-side generators to co-evolve representations and maximize retrieval F1 while staying compatible with keyword-based infrastructure.

Predicts an LLM agent's final success or failure from partial execution traces and halts runs when outcomes are confident to save per-task compute. Uses LightGBM success/failure classifiers on behavioral, textual, and reference features; cuts 13–26% steps and up to 44% input tokens on benchmarks.