Detect-Localize-Repair: A Unified Framework for Learning to Debug with CodeT5

Nghi Bui, Yue Wang, Steven C.H. Hoi


Abstract
Automated software debugging is a crucial task for improving the productivity of software developers. Many neural-based techniques have been proven effective for debugging-related tasks such as bug localization and program repair (or bug fixing). However, these techniques often focus only on either one of them or approach them in a stage-wise manner, ignoring the mutual benefits between them. In this work, we propose a novel unified Detect-Localize-Repair framework based on a pretrained programming language model CodeT5 to seamlessly address these tasks, named CodeT5-DLR. Specifically, we propose three objectives to adapt the generic CodeT5 for debugging: a bug detection objective to determine whether a given code snippet is buggy or not, a bug localization objective to identify the buggy lines, and a program repair objective to translate the buggy code to its fixed version. We evaluate it on each of these tasks and their combined setting on two newly collected line-level debugging datasets in Java and Python. Extensive results show that our model significantly outperforms existing baselines from both NLP and software engineering domains.
Anthology ID:
2022.findings-emnlp.57
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2022
Month:
December
Year:
2022
Address:
Abu Dhabi, United Arab Emirates
Editors:
Yoav Goldberg, Zornitsa Kozareva, Yue Zhang
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
812–823
Language:
URL:
https://aclanthology.org/2022.findings-emnlp.57
DOI:
10.18653/v1/2022.findings-emnlp.57
Bibkey:
Cite (ACL):
Nghi Bui, Yue Wang, and Steven C.H. Hoi. 2022. Detect-Localize-Repair: A Unified Framework for Learning to Debug with CodeT5. In Findings of the Association for Computational Linguistics: EMNLP 2022, pages 812–823, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics.
Cite (Informal):
Detect-Localize-Repair: A Unified Framework for Learning to Debug with CodeT5 (Bui et al., Findings 2022)
Copy Citation:
PDF:
https://aclanthology.org/2022.findings-emnlp.57.pdf