ChatPaper.aiChatPaper

SWE-Pruner: Zelf-adaptieve contextpruning voor codeeragentschappen

SWE-Pruner: Self-Adaptive Context Pruning for Coding Agents

January 23, 2026
Auteurs: Yuhang Wang, Yuling Shi, Mo Yang, Rongrui Zhang, Shilin He, Heng Lian, Yuting Chen, Siyu Ye, Kai Cai, Xiaodong Gu
cs.AI

Samenvatting

LLM-agents hebben opmerkelijke capaciteiten getoond in softwareontwikkeling, maar hun prestaties worden belemmerd door lange interactiecontexten, die hoge API-kosten en latentie met zich meebrengen. Hoewel diverse contextcompressiebenaderingen zoals LongLLMLingua zijn ontstaan om deze uitdaging aan te pakken, baseren deze zich doorgaans op vaste metrieken zoals PPL, waarbij de taakspecifieke aard van codebegrip wordt genegeerd. Hierdoor verstoren ze veelal de syntactische en logische structuur en slagen ze er niet in kritieke implementatiedetails te behouden. In dit artikel stellen we SWE-Pruner voor, een zelf-adaptief contextpruningframework toegesneden op coderingsagents. Geïnspireerd door hoe menselijke programmeurs broncode "selectief skimmen" tijdens ontwikkeling en debugging, voert SWE-Pruner taakbewuste adaptieve pruning uit voor lange contexten. Gegeven de huidige taak formuleert de agent een expliciet doel (bijvoorbeeld "focus op foutafhandeling") als hint om de pruningdoelen te sturen. Een lichtgewicht neurale skimmer (0.6B parameters) wordt getraind om dynamisch relevante regels uit de omringende context te selecteren gegeven het doel. Evaluaties over vier benchmarks en meerdere modellen valideren de effectiviteit van SWE-Pruner in diverse scenario's, met een tokenreductie van 23-54% op agenttaken zoals SWE-Bench Verified en tot 14.84x compressie op enkelvoudige taken zoals LongCodeQA met minimale prestatie-impact.
English
LLM agents have demonstrated remarkable capabilities in software development, but their performance is hampered by long interaction contexts, which incur high API costs and latency. While various context compression approaches such as LongLLMLingua have emerged to tackle this challenge, they typically rely on fixed metrics such as PPL, ignoring the task-specific nature of code understanding. As a result, they frequently disrupt syntactic and logical structure and fail to retain critical implementation details. In this paper, we propose SWE-Pruner, a self-adaptive context pruning framework tailored for coding agents. Drawing inspiration from how human programmers "selectively skim" source code during development and debugging, SWE-Pruner performs task-aware adaptive pruning for long contexts. Given the current task, the agent formulates an explicit goal (e.g., "focus on error handling") as a hint to guide the pruning targets. A lightweight neural skimmer (0.6B parameters) is trained to dynamically select relevant lines from the surrounding context given the goal. Evaluations across four benchmarks and multiple models validate SWE-Pruner's effectiveness in various scenarios, achieving 23-54% token reduction on agent tasks like SWE-Bench Verified and up to 14.84x compression on single-turn tasks like LongCodeQA with minimal performance impact.
PDF894February 8, 2026