Lune

FSE2024Top-tier venue

A Deep Dive into Large Language Models for Automated Bug Localization and Repair

Soneya Binta Hossain, Nan Jiang, Qiang Zhou, Xiaopeng Li, Wen-Hao Chiang, Yingjun Lyu, Hoan Anh Nguyen, Omer Tripp

Abstract

Large language models (LLMs) have shown impressive effectiveness in various software engineering tasks, including automated program repair (APR). In this study, we take a deep dive into automated bug localization and repair utilizing LLMs. In contrast to many deep learning-based APR methods that assume known bug locations, rely on line-level localization tools, or address bug prediction and fixing in one step, our approach uniquely employs LLMs to predict bug location at the token level and subsequently utilizes them for bug fixing. This methodological separation of bug localization and fixing using different LLMs enables effective integration of diverse contextual information and improved incorporation of inductive biases. We introduce Toggle: Token-Granulated Bug Localization and Repair, a comprehensive program repair framework that integrates a bug localization model, an adjustment model to address tokenizer inconsistencies, and a bug-fixing model. Toggle takes a buggy function as input and generates a complete corrected function. We investigate various styles of prompting to the bug fixing model to identify the most effective prompts that better utilize the inductive bias and significantly outperform others. Toggle achieves the new state-of-the-art performance on the CodeXGLUE code refinement benchmark, and exhibits better and comparable performance on several other widely-used APR datasets, including Defects4J. In the Defects4J benchmark, our approach consistently ranks above other methods, achieving superior results in the Top-10, Top-30, Top-50, and Top-100 metrics. Besides examining Toggle's generalizability to unseen data, evaluating the effectiveness of various prompts, we also investigate the impact of additional contextual information such as buggy lines and code comments on bug localization, and explore the importance of the adjustment model. Our extensive experiments offer valuable insights and answers to critical research questions.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

18 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Chasing Shadows: Pitfalls in LLM Security Research cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Chasing Shadows: Pitfalls in LLM Security Research cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • TOGLL: Correct and Strong Test Oracle Generation with LLMS cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Automated Program Repair in the Era of Large Pre-trained Language Models cites CoCoNuT: combining context-aware neural translation models using ensemble for program repair
  • Automated Program Repair in the Era of Large Pre-trained Language Models cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Automated Program Repair in the Era of Large Pre-trained Language Models cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debugging cites CoCoNuT: combining context-aware neural translation models using ensemble for program repair
  • From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debugging cites Automated Program Repair in the Era of Large Pre-trained Language Models
  • LeDex: Training LLMs to Better Self-Debug and Explain Code cites CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning
  • LeDex: Training LLMs to Better Self-Debug and Explain Code cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • LeDex: Training LLMs to Better Self-Debug and Explain Code cites TOGLL: Correct and Strong Test Oracle Generation with LLMS
  • LeDex: Training LLMs to Better Self-Debug and Explain Code cites Automated Program Repair in the Era of Large Pre-trained Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers18

  1. Chasing Shadows: Pitfalls in LLM Security ResearchJonathan Evertz, Niklas Risse, Nicolai Neuer, Andreas Müller et al.NDSS 2026 · 17 citations
  2. TOGLL: Correct and Strong Test Oracle Generation with LLMSSoneya Binta Hossain, Matthew B. DwyerICSE 2025 · 12 citations
  3. LeDex: Training LLMs to Better Self-Debug and Explain CodeNan Jiang, Xiaopeng Li, Shiqi Wang, Qiang Zhou et al.NeurIPS 2024 · 6 citations
  4. FastFixer: An Efficient and Effective Approach for Repairing Programming AssignmentsFang Liu, Zhenwei Liu, Qianhui Zhao, Jing Jiang et al.ASE 2024 · 4 citations
  5. From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical DebuggingYuling Shi, Songsong Wang, Chengcheng Wan, Min Wang et al.ICSE 2026 · 4 citations

Builds on25

  1. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
  2. CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and GenerationYue Wang, Weishi Wang, Shafiq R. Joty, Steven C. H. HoiEMNLP 2021 · 1,224 citations
  3. CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement LearningHung Le, Yue Wang, Akhilesh Deepak Gotmare, Silvio Savarese et al.NeurIPS 2022 · 571 citations
  4. CoCoNuT: combining context-aware neural translation models using ensemble for program repairThibaud Lutellier, Hung Viet Pham, Lawrence Pang, Yitong Li et al.ISSTA 2020 · 325 citations
  5. Automated Program Repair in the Era of Large Pre-trained Language ModelsChunqiu Steven Xia, Yuxiang Wei, Lingming ZhangICSE 2023 · 321 citations

Related papers

  1. Aligning the Objective of LLM-Based Program RepairJunjielong Xu, Ying Fu, Shin Hwei Tan, Pinjia HeICSE 2025 · 5 citations
  2. Automated Repair of Programs from Large Language ModelsZhiyu Fan, Xiang Gao, Martin Mirchev, Abhik Roychoudhury et al.ICSE 2023 · 213 citations
  3. Repair Ingredients Are All You Need: Improving Large Language Model-Based Program Repair via Repair Ingredients SearchJiayi Zhang, Kai Huang, Jian Zhang, Yang Liu et al.ICSE 2026
  4. The Plastic Surgery Hypothesis in the Era of Large Language ModelsChunqiu Steven Xia, Yifeng Ding, Lingming ZhangASE 2023 · 26 citations
  5. ThinkRepair: Self-Directed Automated Program RepairXin Yin, Chao Ni, Shaohua Wang, Zhenhao Li et al.ISSTA 2024 · 37 citations
Dusk over the sea between two cliffs drawn in fine vertical lines