TL;DR
OrcaLoca is a new open-source framework that helps Large Language Model (LLM) agents navigate massive codebases to find bugs with surgical precision. By combining graph-based navigation, smart action scheduling, and "distance-aware" context pruning, it achieves a state-of-the-art 65.33% function match rate on the SWE-bench Lite benchmark.
The Challenge of Software Issue Localization
In the rapidly evolving field of Autonomous Software Engineering (ASE), LLMs have proven highly capable at writing and fixing code. However, they struggle significantly with localization—the preliminary step of finding exactly where a problem resides within a vast repository.
Modern software repositories are massive, often containing thousands of files and hundreds of thousands of lines of code. When an AI agent attempts to locate a bug, it faces a classic "Goldilocks" problem:
- Too little context: Providing only code skeletons or high-level summaries causes the agent to miss critical implementation details.
- Too much context: Dumping entire files into the prompt overwhelms the agent with noise, leading to hallucinations, redundant searches, and wasted token limits.
Existing tools often rely on rigid graph traversals or unstable LLM-only planning. OrcaLoca addresses this by creating a system that is flexible enough to explore autonomously, yet disciplined enough to stay focused on the most relevant code paths.
How OrcaLoca Works
OrcaLoca introduces three core components to streamline the search and localization process:
- Priority-Based Scheduling (ASQ): Instead of letting the LLM wander aimlessly, OrcaLoca utilizes an Action Scheduler Queue (ASQ). It dynamically reorders search actions based on their relevance and urgency. For instance, if the LLM repeatedly requests information from the same file, the system recognizes this focus and bumps that file's priority in the queue.
- Action Decomposition with Relevance Scoring: When an agent encounters a massive class or file, it doesn't just dump the entire text into the prompt. Instead, a specialized sub-agent scores the individual methods or sub-components, passing only the most relevant snippets to the main agent.
- Distance-Aware Context Pruning: Operating as the "Context Manager," this component treats the codebase as a heterogeneous graph (CodeGraph), where nodes are files/methods and edges are relationships (like "contains" or "calls"). It calculates the mathematical "distance" between search results and potential bug locations. If a piece of code is too far away from the suspected bug site, it is pruned from the context window to keep the LLM's attention sharp.
Additionally, the framework employs an auxiliary Reproducer Agent that attempts to run the reported issue to generate stack traces, providing a valuable "warm start" for the localization process.
Datasets and Evaluation
The researchers evaluated OrcaLoca using the SWE-bench family of datasets, which consist of real-world GitHub issues from popular Python repositories:
- SWE-bench Lite: 300 instances used for the main leaderboard comparison.
- SWE-bench Verified: 500 instances manually validated by human annotators.
- SWE-bench Common: A custom subset of 93 instances (the intersection of Lite and Verified) used for targeted ablation studies to ensure high reliability.
Key Insights
- The Graph is the Map: By representing the codebase as a graph, OrcaLoca leverages mathematical distance to determine actual relevance, rather than relying solely on the LLM's intuition.
- Multi-Agent Specialization: Breaking the task into a main "Searcher" and a sub-agent "Scorer" prevents the primary agent from getting bogged down by evaluation tasks, leading to more stable reasoning.
- Handling Ambiguity: The system includes a robust disambiguation mechanism. If a search query (e.g., a common class name) appears in multiple places, OrcaLoca identifies all locations and forces the agent to choose or explore them systematically, preventing hallucinations of a single incorrect path.
State-of-the-Art Results
OrcaLoca sets a new benchmark for open-source agents on SWE-bench Lite:
- Function Match Rate: Achieved 65.33%, the highest among open-source solutions.
- Resolved Rate: Successfully fixed 41.00% of issues. When integrated with the patch-generation components of the "Agentless" framework, it improved the final resolved rate by 6.33 percentage points.
- Cost Efficiency: The system is highly cost-effective, averaging about $0.87 per instance for the localization phase.
- Unique Successes: OrcaLoca uniquely localized 6 issues and resolved 8 issues that other top-tier open-source agents (like OpenHands or AutoCodeRover) missed entirely.
Limitations and Future Work
While powerful, OrcaLoca currently has a few hurdles to clear:
- Language Specificity: The current implementation is optimized for Python. Expanding to other languages would require building new syntax parsers and handling cross-language dependencies.
- Computational Overhead: Shortest-path calculations on the CodeGraph are currently performed on-the-fly. Implementing a caching mechanism for frequently queried repositories could significantly speed up the process.
- Model Dependency: While the framework is technically model-agnostic, the experiments primarily utilized Claude-3.5-Sonnet. Future work will explore its performance with fully open-source models like Qwen or Llama.
Summary updated