🤖 AI Summary
This study addresses the challenges of large search spaces and low efficiency in multi-granularity codebase bug localization by proposing a two-stage hierarchical framework. The approach first employs CodeBERT-based contrastive learning embeddings with semantic retrieval to narrow the candidate set. Subsequently, it leverages hierarchical reinforcement learning (HRL) combined with reward shaping to simulate developers' top-down debugging workflows, enabling precise multi-resolution localization from the file level down to individual code lines while preserving contextual consistency across decision levels. Experimental results demonstrate that the proposed method significantly improves both retrieval precision and localization accuracy on Java and Python datasets, validating the effectiveness of hierarchical decomposition and structured signals for automated fault localization.
📝 Abstract
We introduce C2C (From Codebase to Culprit), a framework for precise bug localization that progressively reduces the debugging search space across multiple levels of granularity: files, functions, and lines of code. To mirror developer's natural top-down debugging workflows, C2C integrates semantic retrieval and Hierarchical Reinforcement Learning (HRL) in a two-stage process. First, it performs recall-oriented retrieval of buggy candidates via semantic vector similarity search using bug-report text, including available stack-trace information, against a database of embeddings, where the embeddings are fine-tuned via contrastive learning with CodeBERT. Building on this reduced search space, the HRL framework incrementally localizes bugs, reasoning from files to functions and ultimately to individual lines of code. Unlike prior approaches which operate at a single granularity, C2C enables multi-resolution localization while maintaining contextual consistency across decisions. Experiments on real-world Java and Python datasets demonstrate that C2C improves retrieval precision and localization accuracy. Ablation studies further highlight the contributions of hierarchical decomposition, structured learning signals, and reward shaping in advancing multi-level bug localization.