Abstract
Software issue localization is a critical yet challenging task in automated software engineering. Traditional Large Language Model (LLM) approaches often suffer from "narrow vision" or "context noise," leading to inaccuracies in large-scale repositories. We present COSIL (COde Graph Searching for Issue Localization), a novel framework that treats codebases as navigable graphs. By employing a two-stage search strategy—broad module-level exploration followed by iterative function-level analysis—and a specialized pruning mechanism, COSIL significantly enhances localization accuracy. Our evaluation on SWE-bench benchmarks demonstrates that COSIL achieves nearly double the function-level accuracy of existing state-of-the-art methods while remaining highly cost-effective.
Introduction
When a developer reports a bug, the first and often most difficult step is issue localization: identifying the specific files and functions that require modification. Current LLM-based approaches typically fall into two categories: prompt-based methods and agent-based methods. Prompt-based methods often suffer from "narrow vision," failing to look beyond files explicitly mentioned in the bug report. Conversely, agent-based methods can get "lost in the woods," becoming overwhelmed by context noise in large repositories. This often leads to "misalignment" where the model fails to follow formatting rules or wanders into irrelevant code branches, resulting in system crashes or incorrect localizations.
The COSIL Framework
COSIL addresses these challenges by treating the codebase as a graph of relationships rather than a collection of text. The framework operates in two distinct phases:
- Phase 1: Broad Exploration (File Level): COSIL constructs a Module Call Graph based on import relationships. This allows the system to expand its search space intelligently, identifying suspicious modules that may not be explicitly named in the issue description.
- Phase 2: In-depth Analysis (Function Level): Once suspicious files are identified, COSIL zooms in to build a Function Call Graph. An iterative search agent then "hops" between related functions to pinpoint the root cause.
To maintain focus, COSIL utilizes a dedicated Pruner LLM that evaluates potential search directions and cuts irrelevant branches early. Furthermore, a Reflective Alignment step ensures that the LLM's outputs adhere to strict data formats, preventing the common "KeyErrors" and "ToolErrors" that plague other agentic frameworks.
Evaluation and Results
COSIL was evaluated on the industry-standard SWE-bench Lite and SWE-bench Verified datasets. The results demonstrate a significant leap in performance:
- Unprecedented Accuracy: COSIL achieved a Top-1 localization accuracy of 43.3% on SWE-bench Lite and 44.6% on SWE-bench Verified using the Qwen2.5-Coder-32B model.
- State-of-the-Art Performance: On average, COSIL outperformed existing methods by 96.04% at the function level.
- End-to-End Impact: Integrating COSIL into existing bug-fixing tools like Agentless improved the final issue resolution rate by up to 30.5%.
- Cost Efficiency: The framework is remarkably economical, costing as little as $0.02 per issue when utilizing models like DeepSeek-v3.
Discussion and Conclusion
The success of COSIL highlights that for large-scale codebases, navigation is superior to simple reading. By treating the repository as a graph, the model follows the inherent logic of the software. Ablation studies confirmed that the iterative search component was the most impactful, providing a 20% performance boost.
While currently optimized for Python, the underlying logic of graph-based navigation is language-agnostic. Future work will focus on extending support to other programming languages and tighter integration with automated repair agents to create a seamless "detect and fix" pipeline. COSIL represents a major step toward truly autonomous and reliable software maintenance.
Summary updated