SWE-Pruner: 코딩 에이전트를 위한 자체 적응형 컨텍스트 프루닝
SWE-Pruner: Self-Adaptive Context Pruning for Coding Agents
January 23, 2026
저자: Yuhang Wang, Yuling Shi, Mo Yang, Rongrui Zhang, Shilin He, Heng Lian, Yuting Chen, Siyu Ye, Kai Cai, Xiaodong Gu
cs.AI
초록
LLM 에이전트는 소프트웨어 개발 분야에서 뛰어난 능력을 입증했지만, 긴 상호작용 컨텍스트로 인해 높은 API 비용과 지연 시간이 발생하여 성능이 저하되는 문제가 있습니다. 이러한 문제를 해결하기 위해 LongLLMLingua와 같은 다양한 컨텍스트 압축 기법이 등장했지만, 대부분 PPL과 같은 고정된 지표에 의존하여 코드 이해의 작업 특수성을 간과합니다. 그 결과, 구문적 및 논리적 구조가 자주 손상되고 중요한 구현 세부 사항을 유지하지 못하는 경우가 많습니다. 본 논문에서는 코딩 에이전트에 특화된 자체 적응형 컨텍스트 프루닝 프레임워크인 SWE-Pruner를 제안합니다. 인간 프로그래머가 개발 및 디버깅 과정에서 소스 코드를 '선별적으로 훑어보는' 방식에서 영감을 얻어, SWE-Pruner는 긴 컨텍스트에 대해 작업 인식 적응형 프루닝을 수행합니다. 현재 작업이 주어지면 에이전트는 프루닝 대상을 안내하는 힌트로 명시적 목표(예: "오류 처리에 집중")를 수립합니다. 가벼운 신경망 스키머(0.6B 매개변수)가 목표를 고려하여 주변 컨텍스트에서 관련 코드 라인을 동적으로 선택하도록 훈련됩니다. 4개의 벤치마크와 여러 모델을 통한 평가는 SWE-Bench Verified와 같은 에이전트 작업에서 23-54%의 토큰 감소를, LongCodeQA와 같은 단일 턴 작업에서는 최대 14.84배의 압축률을 성능 저하 최소화와 함께 달성하는 등 SWE-Pruner의 다양한 시나리오에서의 효과성을 입증했습니다.
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.