# From Codebase to Culprit (C2C): Reducing the Search Space for Bugs with Semantic Retrieval and Hierarchical Reinforcement Learning

arXiv: https://arxiv.org/abs/2609.38402 · HTML: https://mlsanity.com/paper/2609.38402/

## Key facts

- No citing papers in the map yet (data through 14 Oct 2026).
- Builds on 14 of its 46 references that are in the map.
- First posted on arXiv 29 Sep 2026.

## Builds on (most cited first, 14 of 14)

- [SWE-bench: Can Language Models Resolve Real-World GitHub Issues?](https://mlsanity.com/paper/2310.06770/) (2023)
- [CodeBERT: A Pre-Trained Model for Programming and Natural Languages](https://mlsanity.com/paper/2002.08155/) (2020)
- [CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis](https://mlsanity.com/paper/2203.13474/) (2022)
- [Large Language Models for Test-Free Fault Localization](https://mlsanity.com/paper/2310.01726/) (2023)
- [Hard Negative Mining for Domain-Specific Retrieval in Enterprise Systems](https://mlsanity.com/paper/2505.18366/) (2025)
- [An Empirical Study of Fault Localization Families and Their Combinations](https://mlsanity.com/paper/1803.09939/) (2018)
- [Fast Changeset-based Bug Localization with BERT](https://mlsanity.com/paper/2112.14169/) (2021)
- [Bridging Bug Localization and Issue Fixing: A Hierarchical Localization Framework Leveraging Large Language Models](https://mlsanity.com/paper/2502.15292/) (2025)
- [Spectrum-based Software Fault Localization: A Survey of Techniques, Advances, and Challenges](https://mlsanity.com/paper/1607.04347/) (2016)
- [RLocator: Reinforcement Learning for Bug Localization](https://mlsanity.com/paper/2305.05586/) (2023)
- [BLAZE: Cross-Language and Cross-Project Bug Localization via Dynamic Chunking and Hard Example Learning](https://mlsanity.com/paper/2407.17631/) (2024)
- [When Deep Learning Meets Information Retrieval-based Bug Localization: A Survey](https://mlsanity.com/paper/2505.00144/) (2025)
- [Ahead of Time Mutation Based Fault Localisation using Statistical Inference](https://mlsanity.com/paper/1902.09729/) (2019)
- [An Empirical Study of Fault Localization in Python Programs](https://mlsanity.com/paper/2305.19834/) (2023)

## Abstract (arXiv)

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.
