SWE-Pruner: Self-Adaptive Context Pruning for Coding Agents
- •ByteDance introduces SWE-Pruner to reduce token usage in coding agents by up to 54%
- •Framework uses a 0.6B neural skimmer to selectively prune code based on specific task goals
- •Evaluation shows significant cost savings for models like Claude Code with minimal impact on performance
Coding agents have revolutionized software development, but they face a major bottleneck: the massive context window required to understand complex codebases. As interaction logs grow, so do the costs and processing delays. Traditional methods to shorten this data often break the logic of the code, making it unreadable for the AI. Enter SWE-Pruner, a new framework from ByteDance inspired by how human developers skim files to find bugs. Instead of blindly cutting text, it uses a small, efficient neural skimmer with only 600 million parameters. This skimmer acts like a filter, identifying and keeping only the lines of code relevant to a specific objective, such as fixing an error or adding a feature. By focusing on task-aware pruning, the system ensures that the syntactic structure—the grammatical rules of the code—remains intact. On the rigorous SWE-Bench Verified benchmark, the tool reduced token consumption by over 50%. This approach effectively lowers the barrier for using high-end models like Claude Code, allowing developers to build more complex features at a fraction of the usual expense. This research suggests that the future of efficient AI might not lie in larger models, but in smarter ways to manage what information we show them. By teaching agents to selectively skim, we can maintain high accuracy while drastically reducing the computational footprint of AI-assisted programming.