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

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

July 2024 | Soneya Binta Hossain, Nan Jiang, Qiang Zhou, Xiaopeng Li, Wen-Hao Chiang, Yingjun Lyu, Hoan Nguyen, Omer Tripp
This paper explores the use of large language models (LLMs) for automated bug localization and repair (APR). Unlike existing deep learning-based APR methods that rely on known bug locations or line-level localization tools, the proposed approach, Toggle, employs LLMs to predict bug locations at the token level and then uses these predictions for bug fixing. This methodological separation of bug localization and fixing allows for the effective integration of diverse contextual information and improved inductive biases. Toggle consists of three main components: a bug localization model, a bug fixing model, and an optional adjustment model. The bug localization model, based on the CodeT5 encoder, predicts the starting and ending positions of buggy tokens, while the bug fixing model, fine-tuned on various LLMs, generates the corrected code. The adjustment model addresses discrepancies between the tokenizers of the localization and fixing models, enhancing overall accuracy. The paper evaluates Toggle on several benchmarks, including CodeXGLUE, CodeReviewer, Defects4J, and GitHub, demonstrating state-of-the-art performance on the CodeXGLUE benchmark and comparable or superior results on other datasets. Key findings include the effectiveness of token-granular bug localization, the impact of different prompts on bug fixing accuracy, and the importance of additional contextual information. The adjustment module is shown to significantly improve bug fixing accuracy by addressing tokenizer discrepancies. Overall, Toggle offers a robust and efficient approach to automated bug localization and repair, with strong generalization to unseen data.This paper explores the use of large language models (LLMs) for automated bug localization and repair (APR). Unlike existing deep learning-based APR methods that rely on known bug locations or line-level localization tools, the proposed approach, Toggle, employs LLMs to predict bug locations at the token level and then uses these predictions for bug fixing. This methodological separation of bug localization and fixing allows for the effective integration of diverse contextual information and improved inductive biases. Toggle consists of three main components: a bug localization model, a bug fixing model, and an optional adjustment model. The bug localization model, based on the CodeT5 encoder, predicts the starting and ending positions of buggy tokens, while the bug fixing model, fine-tuned on various LLMs, generates the corrected code. The adjustment model addresses discrepancies between the tokenizers of the localization and fixing models, enhancing overall accuracy. The paper evaluates Toggle on several benchmarks, including CodeXGLUE, CodeReviewer, Defects4J, and GitHub, demonstrating state-of-the-art performance on the CodeXGLUE benchmark and comparable or superior results on other datasets. Key findings include the effectiveness of token-granular bug localization, the impact of different prompts on bug fixing accuracy, and the importance of additional contextual information. The adjustment module is shown to significantly improve bug fixing accuracy by addressing tokenizer discrepancies. Overall, Toggle offers a robust and efficient approach to automated bug localization and repair, with strong generalization to unseen data.
Reach us at info@study.space