ResearchPod Summary
Coding agents often struggle with long-context degradation and high token costs due to the accumulation of redundant tool outputs (e.g., file reads, terminal logs) during multi-turn tasks. Existing pruning methods typically rely on external classifiers or explicit goal-hint queries to decide what to keep, which introduces significant computational overhead and may not accurately reflect the agent's evolving internal focus. This paper investigates whether the agent's own backbone already encodes the necessary information to distinguish between relevant and redundant code context.
The authors demonstrate through a probing study that an agent's last-layer hidden states already contain a clear signal for line-level importance. Based on this, they introduce SWE-Pruner Pro, a lightweight, non-linear head that attaches to the frozen backbone. This head processes the hidden states generated during the standard prefill phase, incorporating a length-aware embedding to handle varying response sizes and a per-sample balanced focal loss to ensure that even rare, critical lines are preserved. Because the head operates directly on the existing prefill, it avoids the need for additional model calls, resulting in minimal inference overhead.
SWE-Pruner Pro consistently outperforms existing pruning methods across four multi-turn benchmarks. It is the only evaluated method that reduces end-to-end token consumption in every tested setting while maintaining or improving task quality. Specifically, it achieved up to 39% token savings on SWE-QA-Pro and improved the resolve rate on SWE-Bench Verified by 3.8% for the MiMo-V2-Flash backbone. The results suggest that reading pruning signals directly from the backbone's internal representations is more effective than external scoring, as it avoids the performance penalties associated with auxiliary models or retrieval-based systems.
This work demonstrates that coding agents possess latent capabilities for self-optimization that are often overlooked. By leveraging internal representations rather than external proxies, developers can build more efficient, cost-effective coding agents that handle long-context tasks without sacrificing accuracy. This approach provides a scalable path toward managing the massive token budgets required for complex repository-level software engineering tasks.
AI-generated third-party summary by ResearchPod. Not official content or an endorsement by the paper authors or affiliated organizations.