Table of Contents
Fetching ...

Impact of Large Language Models of Code on Fault Localization

Suhwan Ji, Sanghwa Lee, Changsup Lee, Hyeonseung Im, Yo-Sub Han

TL;DR

This work tackles fault localization without runtime test data by fine-tuning large language models of code through a sequence-generation task conditioned on short, line-numbered functions. By adding line numbers and training encoder, decoder, and encoder-decoder LLMCs to predict fault locations, the approach leverages pre-trained code understanding while avoiding explicit program execution. Empirical evaluation on Defects4J and multiple benchmarks shows UniXcoder-based models achieving state-of-the-art results, with Top-1/Top-3/Top-5 improvements up to around 1.7x over baselines and strong cross-language performance. The findings underscore the importance of bidirectional code representations and pre-training choices for fault localization and point to promising directions for automated program repair and debugging using LLMCs.

Abstract

Identifying the point of error is imperative in software debugging. Traditional fault localization (FL) techniques rely on executing the program and using the code coverage matrix in tandem with test case results to calculate a suspiciousness score for each function or line. Recently, learning-based FL techniques have harnessed machine learning models to extract meaningful features from the code coverage matrix and improve FL performance. These techniques, however, require compilable source code, existing test cases, and specialized tools for generating the code coverage matrix for each programming language of interest. In this paper, we propose, for the first time, a simple but effective sequence generation approach for fine-tuning large language models of code (LLMCs) for FL tasks. LLMCs have recently received much attention for various software engineering problems. In line with these, we leverage the innate understanding of code that LLMCs have acquired through pre-training on large code corpora. Specifically, we fine-tune representative encoder, encoder-decoder, and decoder-based 13 LLMCs for FL tasks. Unlike previous approaches, LLMCs can analyze code sequences even with syntactic errors, since they do not rely on compiled input. Still, they have a limitation on the length of the input data. Therefore, for a fair comparison with existing FL techniques, we extract methods with errors from the project-level benchmark, Defects4J, and analyze them at the line level. Experimental results show that LLMCs fine-tuned with our approach successfully pinpoint error positions in 50.6\%, 64.2\%, and 72.3\% of 1,291 methods in Defects4J for Top-1/3/5 prediction, outperforming the best learning-based state-of-the-art technique by up to 1.35, 1.12, and 1.08 times, respectively. Our findings suggest promising research directions for FL and automated program repair tasks using LLMCs.

Impact of Large Language Models of Code on Fault Localization

TL;DR

This work tackles fault localization without runtime test data by fine-tuning large language models of code through a sequence-generation task conditioned on short, line-numbered functions. By adding line numbers and training encoder, decoder, and encoder-decoder LLMCs to predict fault locations, the approach leverages pre-trained code understanding while avoiding explicit program execution. Empirical evaluation on Defects4J and multiple benchmarks shows UniXcoder-based models achieving state-of-the-art results, with Top-1/Top-3/Top-5 improvements up to around 1.7x over baselines and strong cross-language performance. The findings underscore the importance of bidirectional code representations and pre-training choices for fault localization and point to promising directions for automated program repair and debugging using LLMCs.

Abstract

Identifying the point of error is imperative in software debugging. Traditional fault localization (FL) techniques rely on executing the program and using the code coverage matrix in tandem with test case results to calculate a suspiciousness score for each function or line. Recently, learning-based FL techniques have harnessed machine learning models to extract meaningful features from the code coverage matrix and improve FL performance. These techniques, however, require compilable source code, existing test cases, and specialized tools for generating the code coverage matrix for each programming language of interest. In this paper, we propose, for the first time, a simple but effective sequence generation approach for fine-tuning large language models of code (LLMCs) for FL tasks. LLMCs have recently received much attention for various software engineering problems. In line with these, we leverage the innate understanding of code that LLMCs have acquired through pre-training on large code corpora. Specifically, we fine-tune representative encoder, encoder-decoder, and decoder-based 13 LLMCs for FL tasks. Unlike previous approaches, LLMCs can analyze code sequences even with syntactic errors, since they do not rely on compiled input. Still, they have a limitation on the length of the input data. Therefore, for a fair comparison with existing FL techniques, we extract methods with errors from the project-level benchmark, Defects4J, and analyze them at the line level. Experimental results show that LLMCs fine-tuned with our approach successfully pinpoint error positions in 50.6\%, 64.2\%, and 72.3\% of 1,291 methods in Defects4J for Top-1/3/5 prediction, outperforming the best learning-based state-of-the-art technique by up to 1.35, 1.12, and 1.08 times, respectively. Our findings suggest promising research directions for FL and automated program repair tasks using LLMCs.
Paper Structure (26 sections, 2 figures, 7 tables)

This paper contains 26 sections, 2 figures, 7 tables.

Figures (2)

  • Figure 1: Workflow for FL based on fine-tuning LLMCs using our approach
  • Figure 2: RQ1. FL performance based on model size