BugPilot: Complex Bug Generation for Efficient Learning of SWE Skills

Atharv Sonwane, Isadora White, Hyunji Lee, Matheus Pereira, Lucas Caccia, Minseon Kim, Zhengyan Shi, Chinmay Singh, Alessandro Sordoni, Marc-Alexandre Côté, Xingdi Yuan

TL;DR

Training open-weight software engineering (SWE) agents requires vast amounts of high-quality bug-fixing data, but synthetic bugs typically rely on artificial, localized code mutations. BugPilot introduces a more naturalistic approach: it tasks an agent with building new features and captures the bugs that unintentionally break existing test suites. Training on these rich, multi-file bugs yields FrogBoss-32B, achieving a state-of-the-art 54.6% Pass@1 on SWE-Bench Verified.

What Problem Does This Paper Address?

Top-performing SWE agents currently rely on proprietary models like Claude and GPT-4. Closing the gap with open-weight models requires supervised fine-tuning (SFT) and reinforcement learning (RL) on massive bug-fixing datasets.

However, existing bug-collection methods hit major bottlenecks:

  1. Mining real GitHub repositories demands intense manual effort to isolate reproducible environments and clean issue descriptions.
  2. Existing synthetic bug generators (e.g., SWE-Smith) rely on rule-based mutations or localized LLM rewrites. These produce simple, single-file bugs that fail to reflect how bugs arise in real software engineering—namely, as unintended side effects during complex multi-file development.

Methods

BugPilot introduces FEATADD (Buggy Feature Addition) alongside an agentic baseline called BUGINSTRUCT:

  • FEATADD (Unintentional Bugs): An agent (Claude Sonnet 4 in SWE-Agent) is tasked with implementing a brand-new, complex feature across an existing repository while preserving current functionality. Whenever the changes inadvertently cause existing unit tests to fail, a bug is logged. A language model then summarizes the failing test logs into a natural language issue description.
  • BUGINSTRUCT (Intentional Bugs): As a baseline, the agent is directly prompted to inject subtle, hard-to-detect runtime bugs into the repository.
  • Agent Training (SFT & RL): The authors collect expert solution trajectories on these bugs using Claude Sonnet 4 and fine-tune open-weight student models (primarily Qwen3-32B, alongside 14B and 235B variants) using the R2E-Gym scaffold. They also run RL using the RLLM framework.
+-------------------------------------------------------+
|  SWE Agent prompted to add a feature (FEATADD)        |
+---------------------------+---------------------------+
                            |
                            v
               [ Run Existing Test Suite ]
              /                           \
      (Tests Pass)                    (Tests Fail)
           |                                |
  Discarded / used for                      v
  Multi-Task Training             Realistic Bug Created!
                               (Multi-file diff + Bug Report)

Datasets

  • FEATADD (Ours): 785 multi-file synthetic bugs created via unintended feature side effects. Features average 4,376 diff tokens and 4.2 modified files.
  • BUGINSTRUCT (Ours): 1,000 synthetic bugs created via explicit bug-injection prompting (average 435 tokens, 1.3 files).
  • Baselines / Existing Benchmarks:
  • SWE-Smith: 1,000 rule-perturbed synthetic bugs (average 598 tokens, 1.2 files).
  • R2E-Gym: 1,000 human-authored bugs constructed by reverting historical commits.
  • SWE-Bench Verified: 500 verified real-world issues used strictly for final evaluation.

Key Insights and Ideas

  • Unintentional bugs are more natural and difficult: FEATADD produces a balanced spread of real-world bug categories (API mismatches, state caching errors, validation bugs), closely mirroring SWE-Bench Verified. Consequently, Claude Sonnet 4's solve rate drops from ~66% on SWE-Smith to just 41.4% on FEATADD.
  • Training efficiency via realistic complexity: Training a 32B model on BASEMIX + FEATADD outperformed BASEMIX + BUGINSTRUCT by 2.1% and BASEMIX + SWE-SMITH by 1.4%, showing that unintentional regressions provide a far better training signal than intentional perturbations.
  • Teacher reasoning density matters: When generating distillation trajectories with GPT-4o, GPT-5, and Claude Sonnet 4, GPT models produced fewer natural language explanation tokens before tool calls. Distilling from GPT trajectories resulted in drastically inferior students (31.4% vs 54.6% on SWE-Bench Verified).
  • Reclaiming wasted compute: In FEATADD, runs that successfully implement a feature without breaking tests are normally discarded. The authors trained FrogMultiTask, a model trained jointly on bug fixes and successful feature additions, matching FrogBoss performance (54.0%) while acquiring the ability to generate new features and bugs itself.

Key Results

  • FrogBoss (32B): Achieves 54.6% Pass@1 on SWE-Bench Verified (averaged across 3 seeds), establishing a new open-weights state of the art for 32B models.
  • Pass@3 and Test-Time Scaling: With Pass@3, FrogBoss reaches 67.4%, surpassing proprietary Claude Sonnet 4 (66.9%). A simple test-time heuristic (choosing the shortest trajectory out of 3 rollouts) achieves 57.0%.
  • Model Scale Generalization:
  • FrogMini (14B): 45.3% Pass@1.
  • FrogBeast (235B MoE, 22B active): 61.0% Pass@1.
  • Reinforcement Learning: Training BASEMIX + FEATADD with RL for just 25 steps reached 52.4% Pass@1, outperforming purely supervised BASEMIX (49.87%).

Limitations and Future Work

  • Reliance on Strong Teacher Models: The bug-generation pipeline relies on a teacher capable of writing realistic feature code while occasionally making subtle errors. As frontier models improve, inadvertent breakages may become rarer.
  • Discarded Trajectories: Standard FEATADD discards any agent run where the feature was implemented correctly without breaking tests.
  • Future Work: Developing an iterative self-improvement loop where student models (like FrogMultiTask) alternate between introducing features, generating new bug environments, and training themselves via RL without relying on closed proprietary teachers.

Summary updated

BibTeX
@inproceedings{sonwane2026bugpilot,
  author = {Atharv Sonwane and Isadora White and Hyunji Lee and Matheus Pereira and Lucas Caccia and Minseon Kim and Zhengyan Shi and Chinmay Singh and Alessandro Sordoni and Marc-Alexandre Côté and Xingdi Yuan},
  title = {{BugPilot: Complex Bug Generation for Efficient Learning of SWE Skills}},
  booktitle = {SPOT @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=LwpxZdSbS6},
}
Figure