Skip to main content
QUICK REVIEW

[Paper Review] DeepDebug: Fixing Python Bugs Using Stack Traces, Backtranslation, and Code Skeletons

Dawn Drain, Colin B. Clement|arXiv (Cornell University)|May 19, 2021
Software Engineering ResearchComputer Science25 references14 citations
TL;DR

DeepDebug proposes a sequence-to-sequence transformer model that fixes Python bugs using stack traces, backtranslation, and code skeletons. It achieves 75% first-attempt fix rate on executable test benchmarks and reduces false positives from 35% to 5% on QuixBugs, outperforming prior work by over 50% in fixes found with significantly faster inference (1 minute vs. 6 hours).

ABSTRACT

The joint task of bug localization and program repair is an integral part of the software development process. In this work we present DeepDebug, an approach to automated debugging using large, pretrained transformers. We begin by training a bug-creation model on reversed commit data for the purpose of generating synthetic bugs. We apply these synthetic bugs toward two ends. First, we directly train a backtranslation model on all functions from 200K repositories. Next, we focus on 10K repositories for which we can execute tests, and create buggy versions of all functions in those repositories that are covered by passing tests. This provides us with rich debugging information such as stack traces and print statements, which we use to finetune our model which was pretrained on raw source code. Finally, we strengthen all our models by expanding the context window beyond the buggy function itself, and adding a skeleton consisting of that function's parent class, imports, signatures, docstrings, and method bodies, in order of priority. On the QuixBugs benchmark, we increase the total number of fixes found by over 50%, while also decreasing the false positive rate from 35% to 5% and decreasing the timeout from six hours to one minute. On our own benchmark of executable tests, our model fixes 68% of all bugs on its first attempt without using traces, and after adding traces it fixes 75% on first attempt. We will open-source our framework and validation set for evaluating on executable tests.

Motivation & Objective

  • Address the high false positive rate in automated program repair, where patches pass tests but are not genuine fixes.
  • Improve bug localization and repair by leveraging executable test feedback, including stack traces and print statements.
  • Enhance model generalization and accuracy by incorporating code skeletons—imports, signatures, docstrings, and parent class context.
  • Reduce inference time from hours to under a minute while increasing fix rates on benchmark datasets.
  • Develop a scalable, end-to-end framework for automated debugging that can be deployed in real-world development workflows.

Proposed method

  • Train a bug-creation model on reversed Git commits to generate synthetic bugs for data augmentation.
  • Fine-tune a pretrained sequence-to-sequence transformer (based on DeepDev-py) on 200K repositories using backtranslation to learn bug-to-fix mappings.
  • Inject synthetic bugs into functions from 10K repositories with executable tests, preserving test coverage and collecting stack traces.
  • Fine-tune the model on this executable test data, incorporating stack traces and extended context (code skeletons) to improve localization and repair.
  • Expand the model’s context window using axial embeddings to include parent class, imports, function signatures, and docstrings in priority order.
  • Apply sampling strategies with top-k and top-p decoding to generate multiple candidate patches and evaluate them against test suites.

Experimental results

Research questions

  • RQ1Can backtranslation on large-scale, raw Python code improve generalization for automated program repair?
  • RQ2To what extent do code skeletons (imports, signatures, docstrings, parent class) improve bug localization and fix accuracy?
  • RQ3How effective are stack traces in guiding model repair when combined with code skeletons and backtranslation?
  • RQ4Can a unified model achieve high fix rates with low false positive rates while reducing inference time from hours to minutes?
  • RQ5Does the use of executable test feedback (e.g., stack traces) improve performance on real-world, executable bugs compared to synthetic benchmarks?

Key findings

  • On the QuixBugs benchmark, DeepDebug fixes 21 out of 40 bugs (53%), a 50% improvement over prior state-of-the-art, with only 1 false positive (5% rate), down from 35%.
  • On a custom benchmark of 523 executable neural bugs, DeepDebug fixes 393 out of 523 bugs (75%) on the first attempt when using stack traces, up from 68% without traces.
  • The top-10 patch success rate increases from 90% (without traces) to 97% (with traces), demonstrating the value of trace-aware repair.
  • Adding code skeletons reduces cross-entropy loss by 25% on neural bug detection, indicating improved model confidence and alignment with correct fixes.
  • The model achieves a 1-minute inference timeout, a dramatic improvement over prior tools that used 6-hour timeouts, while maintaining high fix quality.
  • The model generates many duplicate edits due to low perplexity, indicating a need for improved sampling strategies to diversify repair candidates.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.