LLM4SZZ: Enhancing SZZ Algorithm with Context-Enhanced Assessment on Large Language Models

Lingxiao Tang, Jiakun Liu, Zhongxin Liu, Xiaohu Yang, Lingfeng Bao · DOI

Introduction

Identifying bug-inducing commits is a critical task in software maintenance, enabling developers to understand the origin of defects and improve software quality. The industry-standard approach, the SZZ algorithm, has long relied on line-level version control history. However, traditional SZZ suffers from significant limitations due to its reliance on simple heuristics. This paper introduces LLM4SZZ, a novel framework that leverages Large Language Models (LLMs) to perform semantic analysis of code changes and commit messages, significantly improving the accuracy of bug-inducing commit identification.

Problem Statement

The traditional SZZ algorithm operates on the assumption that a bug is located within the lines deleted or modified during a fix. This heuristic leads to three primary issues:

  1. Low Precision: SZZ often flags non-buggy changes like refactoring or formatting as bug-inducing.
  2. Inability to Detect "Addition-Only" Bugs: If a bug is fixed by adding code (e.g., a missing null check), SZZ has no deleted lines to trace and fails entirely.
  3. Context Blindness: By ignoring the semantic meaning of commit messages and surrounding code, SZZ misses crucial "why" information.

Methodology

LLM4SZZ addresses these challenges through a three-stage pipeline designed to act as an expert reviewer.

The LLM4SZZ framework pipeline, illustrating the three main stages: Preparation, Context-enhanced Assessment, and Commits Identification.

1. Preparation

The process begins by summarizing the root cause of the bug using the fix and the commit message. The LLM filters out irrelevant files to minimize noise and manage input length, ensuring the model focuses on the most pertinent code segments.

2. Context-Enhanced Assessment (The "Ability Check")

A key innovation of LLM4SZZ is the "Ability Check." Before the system identifies the bug-inducing commit, it verifies the LLM's understanding of the bug. The model is presented with both "buggy" and "fixed" versions of the code. If the LLM can correctly distinguish between them, it proceeds with high-confidence identification.

3. Adaptive Identification

Based on the results of the ability check, the system employs one of two strategies:

  • Context-Enhanced Identification: If the LLM passes the ability check, it identifies the bug-inducing commit by comparing the semantic root cause against candidate changes.
  • Rank-Based Identification: If the LLM's understanding is less certain, the system asks the model to rank code statements by their likelihood of being buggy, then traces these statements back using traditional version control tools.

Evaluation

The researchers evaluated LLM4SZZ against three high-quality, developer-annotated datasets: DS_LINUX (1,500 commits), DS_GITHUB (361 commits), and DS_APACHE (241 commits). These datasets provide a more reliable ground truth than standard automated benchmarks.

Key Findings

  • Performance Gains: LLM4SZZ achieved a 6.9% to 16.0% improvement in F1-score over traditional baselines, including deep learning models like NeuralSZZ.
  • Identifying "Invisible" Bugs: The framework successfully identified 148 bug-inducing commits that were missed by all other baselines, particularly "addition-only" bugs.
  • Robustness via Ability Checks: The ability check mechanism effectively mitigated LLM hallucinations, ensuring higher precision in identification.
  • Efficiency: Despite the complexity of LLM processing, the tool averages approximately 30 seconds per commit, making it suitable for modern CI/CD pipelines.

Conclusion and Future Work

LLM4SZZ demonstrates that semantic understanding via LLMs can overcome the inherent limitations of heuristic-based SZZ algorithms. While the model faces challenges with extremely long contexts ("lost in the middle" problem) and very subtle logic reorderings, it represents a significant step forward. Future research will focus on fine-tuning smaller, open-source models to reduce operational costs and improve performance on specialized programming languages.

Summary updated

BibTeX
@article{tang2025llm,
  author = {Lingxiao Tang and Jiakun Liu and Zhongxin Liu and Xiaohu Yang and Lingfeng Bao},
  title = {{LLM4SZZ: Enhancing SZZ Algorithm with Context-Enhanced Assessment on Large Language Models}},
  journal = {Proc. ACM Softw. Eng.},
  year = {2025},
  doi = {10.1145/3728885},
}
Figure