CodeTranFix: A Neural Machine Translation Approach for Context-Aware Java Program Repair with CodeBERT
Source abstract
Abstract
Automated program repair (APR) plays a vital role in enhancing software quality and reducing developer maintenance efforts. Neural Machine Translation (NMT)-based methods demonstrate notable potential by learning translation patterns from bug-fix code pairs. However, traditional approaches are constrained by limited model capacity and training data scale, leading to performance bottlenecks in generalizing to unseen defect patterns. In this paper, we propose CodeTransFix, a novel APR approach that synergistically combines neural machine translation (NMT) methods with code-specific large language models of code (LLMCs) such as CodeBERT. The CodeTransFix approach innovatively learns contextual embeddings of bug-related code through CodeBERT and integrates these representations as supplementary inputs to the Transformer model, enabling context-aware patch generation. The repair performance is evaluated on the widely used Defects4j v1.2 benchmark. Our experimental results showed that CodeTransFix achieved a 54.1% performance improvement compared to the best NMT-based baseline model and a 23.3% performance improvement compared to the best LLMCs for fixing bugs. In addition, CodeTransFix outperformed existing APR methods in the Defects4j v2.0 generalization test.
Source: crossref · Quality: baseline
Research context
OpenAlex topics: Software Testing and Debugging Techniques · Software Engineering Research · Software Reliability and Analysis Research
SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.
Affiliations
School of Automation, Jiangsu University of Science and Technology, Zhenjiang 212100, China
Jiangsu Shipbuilding and Ocean Engineering Design and Research Institute, Zhenjiang 212100, China
Funding
Research on the Application of Artificial Intelligence Technology in Software Precision Testing · Research on Comprehensive Safeguard Technology for Complex Equipment of Large Ships Based on V-DT Driving and AI Enablement
References (33)
Show source-provided references
1. Automated program repair10.1145/3318162 ↗
2. Gao, X., Noller, Y., and Roychoudhury, A. (2022). Program repair. arXiv.
3. Lutellier, T., Pham, H.V., Pang, L., Li, Y., Wei, M., and Tan, L. (2020, January 18–22). CoCoNuT: Combining context-aware neural translation models using ensemble for program repair. Proceedings of the 29th ACM SIGSOFT International Symposium on Software Testing and Analysis, Virtual Event.10.1145/3395363.3397369 ↗
4. SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repair
5. Jin, M., Shahriar, S., Tufano, M., Shi, X., Lu, S., Sundaresan, N., and Svyatkovskiy, A. (2023, January 3–9). InferFix: End-to-End Program Repair with LLMs. Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering, San Francisco, CA, USA.10.1145/3611643.3613892 ↗
6. Wang, W., Wang, Y., Joty, S., and Hoi, S.C.H. (2023, January 3–9). RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repair. Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering, San Francisco, CA, USA.10.1145/3611643.3616256 ↗
7. Wang, Y., Wang, W., Joty, S., and Hoi, S.C. (2021). Codet5: Identifier-aware unified pre-trained encoder-decoder models for code understanding and generation. arXiv.10.18653/v1/2021.emnlp-main.685 ↗
8. Ahmad, W.U., Chakraborty, S., Ray, B., and Chang, K.W. (2021). Unified pre-training for program understanding and generation. arXiv.10.18653/v1/2021.naacl-main.211 ↗
9. Huang, K., Meng, X., Zhang, J., Liu, Y., Wang, W., Li, S., and Zhang, Y. (2023, January 11–15). An Empirical Study on Fine-Tuning Large Language Models of Code for Automated Program Repair. Proceedings of the 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE), Luxembourg.10.1109/ASE56229.2023.00181 ↗
10. Jiang, N., Liu, K., Lutellier, T., and Tan, L. (2023, January 14–20). Impact of Code Language Models on Automated Program Repair. Proceedings of the 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), Melbourne, Australia.10.1109/ICSE48619.2023.00125 ↗
11. Li, Y., Wang, S., and Nguyen, T.N. (July, January 27). DLFix: Context-based code transformation learning for automated program repair. Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering, Seoul, Republic of Korea.
12. Zhu, Q., Sun, Z., Xiao, Y.a., Zhang, W., Yuan, K., Xiong, Y., and Zhang, L. (2021, January 23–28). A syntax-guided edit decoder for neural program repair. Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Athens, Greece.10.1145/3468264.3468544 ↗
13. Mashhadi, E., and Hemmati, H. (2021, January 17–19). Applying CodeBERT for Automated Program Repair of Java Simple Bugs. Proceedings of the 2021 IEEE/ACM 18th International Conference on Mining Software Repositories (MSR), Madrid, Spain.10.1109/MSR52588.2021.00063 ↗
14. Fu, M., Tantithamthavorn, C., Le, T., Nguyen, V., and Phung, D. (2022, January 14–18). VulRepair: A T5-based automated software vulnerability repair. Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Singapore.10.1145/3540250.3549098 ↗
15. Zhu, J., Xia, Y., Wu, L., He, D., Qin, T., Zhou, W., Li, H., and Liu, T.Y. (2020). Incorporating bert into neural machine translation. arXiv.
16. Jiang, N., Lutellier, T., and Tan, L. (2021, January 22–30). CURE: Code-Aware Neural Machine Translation for Automatic Program Repair. Proceedings of the 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE), Madrid, Spain.10.1109/ICSE43902.2021.00107 ↗
17. Ye, H., Martinez, M., and Monperrus, M. (2022, January 21–29). Neural program repair with execution-based backpropagation. Proceedings of the 44th International Conference on Software Engineering, Pittsburgh, PA, USA.10.1145/3510003.3510222 ↗
18. Just, R., Jalali, D., and Ernst, M.D. (2014, January 21–25). Defects4J: A database of existing faults to enable controlled testing studies for Java programs. Proceedings of the 2014 International Symposium on Software Testing and Analysis, San Jose, CA, USA.10.1145/2610384.2628055 ↗
19. Martinez, M., and Monperrus, M. (2016, January 18–20). ASTOR: A program repair library for Java. Proceedings of the 25th International Symposium on Software Testing and Analysis, Saarbrücken, Germany.10.1145/2931037.2948705 ↗
20. Wen, M., Chen, J., Wu, R., Hao, D., and Cheung, S.C. (June, January 27). Context-aware patch generation for better automated program repair. Proceedings of the 40th International Conference on Software Engineering, Gothenburg, Sweden.
21. GenProg: A Generic Method for Automatic Software Repair10.1109/TSE.2011.104 ↗
22. Mechtaev, S., Yi, J., and Roychoudhury, A. (2016, January 14–22). Angelix: Scalable multiline program patch synthesis via symbolic analysis. Proceedings of the 38th International Conference on Software Engineering, Austin, TX, USA.10.1145/2884781.2884807 ↗
23. DeMarco, F., Xuan, J., Berre, D.L., and Monperrus, M. (2014, January 31). Automatic repair of buggy if conditions and missing preconditions with SMT. Proceedings of the 6th International Workshop on Constraints in Software Testing, Verification, and Analysis, Hyderabad, India.10.1145/2593735.2593740 ↗
24. Durieux, T., and Monperrus, M. (2016, January 14–22). DynaMoth: Dynamic code synthesis for automatic program repair. Proceedings of the 11th International Workshop on Automation of Software Test, Austin, TX, USA.10.1145/2896921.2896931 ↗
25. Nopol: Automatic Repair of Conditional Statement Bugs in Java Programs10.1109/TSE.2016.2560811 ↗
26. Le, X.-B.D., Chu, D.H., Lo, D., Goues, C.L., and Visser, W. (2017, January 4–8). S3: Syntax- and semantic-guided repair synthesis via programming by examples. Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, Paderborn, Germany.10.1145/3106237.3106309 ↗
27. Long, F., and Rinard, M. (September, January 30). Staged program repair with condition synthesis. Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, Bergamo, Italy.10.1145/2786805.2786811 ↗
28. FixMiner: Mining relevant fix patterns for automated program repair10.1007/s10664-019-09780-z ↗
29. Ghanbari, A., Benton, S., and Zhang, L. (2019, January 15–19). Practical program repair via bytecode mutation. Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis, Beijing, China.10.1145/3293882.3330559 ↗
30. Hua, J., Zhang, M., Wang, K., and Khurshid, S. (2018, January 4–9). SketchFix: A tool for automated program repair approach using lazy candidate generation. Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Lake Buena Vista, FL, USA.10.1145/3236024.3264600 ↗
31. Liu, K., Koyuncu, A., Kim, D., and Bissyandé, T.F. (2019, January 15–19). TBar: Revisiting template-based automated program repair. Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis, Beijing, China.10.1145/3293882.3330577 ↗
32. Kudo, T., and Richardson, J. (2018). Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. arXiv.10.18653/v1/D18-2012 ↗
33. Attention is all you need