Skip to main content
QUICK REVIEW

[Paper Review] Entropy Guided Spectrum Based Bug Localization Using Statistical Language Model

Saikat Chakraborty, Yujian Li|arXiv (Cornell University)|Feb 20, 2018
Software Engineering ResearchComputer Science48 references7 citations
TL;DR

This paper proposes EnSpec, a hybrid approach that enhances spectrum-based bug localization (SBL) by integrating code entropy—measured via a statistical language model—to improve fault localization accuracy. By combining SBL scores with entropy-based suspiciousness, EnSpec outperforms SBL alone, especially in low-coverage test scenarios, and demonstrates effectiveness across both Java and C projects.

ABSTRACT

Locating bugs is challenging but one of the most important activities in software development and maintenance phase because there are no certain rules to identify all types of bugs. Existing automatic bug localization tools use various heuristics based on test coverage, pre-determined buggy patterns, or textual similarity with bug report, to rank suspicious program elements. However, since these techniques rely on information from single source, they often suffer when the respective source information is inadequate. For instance, the popular spectrum based bug localization may not work well under poorly written test suite. In this paper, we propose a new approach, EnSpec, that guides spectrum based bug localization using code entropy, a metric that basically represents naturalness of code derived from a statistical language model. Our intuition is that since buggy code are high entropic, spectrum based bug localization with code entropy would be more robust in discriminating buggy lines vs. non-buggy lines. We realize our idea in a prototype, and performed an extensive evaluation on two popular publicly available benchmarks. Our results demonstrate that EnSpec outperforms a state-of-the-art spectrum based bug localization technique.

Motivation & Objective

  • To address the limitations of spectrum-based bug localization (SBL) when test suites have poor code coverage or fail to distinguish buggy lines.
  • To investigate whether code entropy—measuring unnaturalness via statistical language models—can serve as a reliable, orthogonal signal for identifying buggy code.
  • To develop a hybrid, language-agnostic fault localization technique that requires only source code and does not depend on bug reports or extensive test coverage.
  • To evaluate the effectiveness of combining SBL with entropy in both intra-project and cross-project fault localization settings.

Proposed method

  • Train a statistical language model (n-gram) on source code to compute entropy per program line, where higher entropy indicates lower naturalness and higher likelihood of being buggy.
  • Compute standard spectrum-based suspiciousness scores using test execution data (passing and failing test coverage).
  • Combine the entropy score and SBL suspiciousness score using a machine learning model (e.g., logistic regression) to generate a final ranked list of suspicious lines.
  • Use a hybrid scoring function that weights both entropy and spectrum information to improve ranking precision.
  • Evaluate the method on two public benchmarks: Defects4J (Java) and ManyBugs (C), covering over 500 bugs and 3,715 buggy lines.
  • Perform cross-project evaluations to assess generalization and robustness in real-world scenarios with limited historical bug data.

Experimental results

Research questions

  • RQ1Can code entropy, derived from statistical language models, serve as a reliable indicator of buggy code?
  • RQ2Does combining entropy with spectrum-based suspiciousness improve fault localization accuracy compared to SBL alone?
  • RQ3How does EnSpec perform in cross-project fault localization, where historical bug data is limited?
  • RQ4Is the proposed method effective and generalizable across different programming languages such as Java and C?

Key findings

  • EnSpec significantly improves fault localization accuracy over standard SBL by incorporating code entropy as an additional suspiciousness signal.
  • The integration of entropy with SBL reduces reliance on high-coverage test suites, making the method robust even when test coverage is low.
  • EnSpec outperforms SBL in both intra-project and cross-project settings, demonstrating generalization across different software projects.
  • The method is effective across programming languages, showing consistent improvement in both Java and C projects.
  • Code entropy is positively correlated with buggy lines, confirming that less natural (higher entropy) code is more likely to contain faults.
  • The approach does not require bug reports or external metadata, making it applicable in early development phases where such data may be unavailable.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.