From Codebase to Culprit (C2C): Reducing the Search Space for Bugs with Semantic Retrieval and Hierarchical Reinforcement Learning
Ankur Garg, Corey Yang-Smith, Rishav Rishav, Ahmad Abdellatif, Samira Ebrahimi Kahou
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.
Create a lesson
Metadata
- Categories
- cs.SE, cs.LG
Related papers
Separating Configuration from Adaptation: Verifiable Semantic-to-Executable Search for Financial Web Agents
Shared title terminologycs.SEChenxi Wang, Ye Tao, Juncheng Su et al.
DreamTest: World-Model Surrogates for Search-Based Testing of Deep Reinforcement Learning Agents
Shared title terminologycs.SEQinghua Xu, Guancheng Wang, Boxi Yu et al.
Doing More with Less Tokens: Hierarchical Reinforcement Learning for Efficient Coding Agents
Shared title terminologycs.SEHaobin Li, Liang Jiang, Zhenyu Huang et al.
Memory Matters, but Retrieval Is Not Enough: An Empirical Study of Memory Systems
Shared title terminologycs.SEMuhammad Waseem, Md Nasir Uddin Shuvo, Md Aidul Islam et al.
Generating Property-Based Regression Tests from Source Code Semantics
Shared title terminologycs.SEClemens Bauer, Johann Glock, Martin Pinzger
RAPO-Sol: Retrieval-Augmented Preference Optimization for Repository-Level Solidity Code Generation
Shared title terminologycs.SERongcun Wang, Shi Chen