Enhancing Fault Localization Through Ordered Code Analysis with LLM Agents and Self-Reflection
<|reference_start|>Enhancing Fault Localization Through Ordered Code Analysis with LLM Agents and Self-Reflection: Locating and fixing software faults is a time-consuming and resource-intensive task in software development. Traditional fault localization methods, such as Spectrum-Based Fault Localization (SBFL), rely on statistical analysis of test coverage data but often suffer from lower accuracy. Learning-based techniques, while more effective, require extensive training data and can be computationally expensive. Recent advancements in Large Language Models (LLMs) offer promising improvements in fault localization by enhancing code comprehension and reasoning. However, these LLM-based techniques still face challenges, including token limitations, degraded performance with long inputs, and difficulties managing large-scale projects with complex systems involving multiple interacting components. To address these issues, we introduce LLM4FL, a novel LLM-agent-based fault localization approach that integrates SBFL rankings with a divide-and-conquer strategy. By dividing large coverage data into manageable groups and employing multiple LLM agents through prompt chaining, LLM4FL navigates the codebase and localizes faults more effectively. The approach also incorporates self-reflection and chain-of-thought reasoning, enabling agents to iteratively generate fixes and re-rank suspicious methods. We evaluated LLM4FL on the Defects4J (V2.0.0) benchmark, comprising 675 real-world faults from 14 open-source Java projects. Our results demonstrate that LLM4FL outperforms AutoFL by 19.27% in Top-1 accuracy and surpasses state-of-the-art supervised techniques such as DeepFL and Grace, all without task-specific training. Additionally, we highlight the impact of coverage splitting and prompt chaining on fault localization performance and show that different method ordering can improve Top-1 accuracy by up to 22%.<|reference_end|>
@article{rafi2024enhancing,
    title={Enhancing Fault Localization Through Ordered Code Analysis with LLM
  Agents and Self-Reflection},
    author={Md Nakhla Rafi, Dong Jae Kim, Tse-Hsun Chen, Shaowei Wang},
    journal={arXiv preprint arXiv:2409.13642},
    year={2024},
    archivePrefix={arXiv},
    eprint={2409.13642},
    primaryClass={cs.SE}
}