SWE-PDB: Teaching LLMs to Leverage Debugging Tools via Agentic Training
Interaction with debugging tools enables large language models (LLMs) to reason over concrete runtime states, rather than relying solely on static analysis of source code. Specifically, with the help of a debugger, an LLM-based agent can observe actual program execution by inspecting intermediate variable states and stepping through the control flow. These runtime observations enable the model to better understand program behavior and identify the root causes of bugs. Despite these advantages, using debuggers correctly and effectively remains challenging for many models because debugger interaction is inherently stateful and requires executing complex, long-horizon action sequences. As a result, models often exhibit unproductive interactions in which the debugger is underutilized or even disrupts the debugging process. To address this challenge, we propose SWE-PDB , the first training-based framework that teaches LLMs to leverage debuggers for interactive debugging and program repair. Our approach constructs large-scale buggy Python instances with verified failing tests from diverse sources and synthesizes multi-turn interactive debugging trajectories that follow structured debugging workflows. To ensure data quality, we apply multi-stage trajectory filtering and refinement, and train models using agentic supervised fine-tuning to learn effective debugger behaviors, followed by agentic reinforcement learning with rule-based rewards to improve generalization and promote more strategic debugger usage. Extensive evaluations across diverse benchmarks demonstrate substantial gains. In particular, SWE-PDB-14B achieves 38.0% accuracy on SWE-bench Verified with complete test suites, more than tripling the base model’s performance, while improving interaction efficiency and exhibiting robust, meaningful debugger usage.
Authors
- Xin Xia (ORCID: https://orcid.org/0000-0002-6302-3256)
- Xing Hu (ORCID: https://orcid.org/0000-0002-3218-599X)
- Jiaxing Liu
Institutions
- Zhejiang University (CN)
Publication Details
- Journal
- Proceedings of the ACM on software engineering.
- Published
- 2026-10-01
- DOI
- https://doi.org/10.1145/3832117
- Primary Topic
- Software Testing and Debugging Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00