Retrieval-Oriented Code Representations in Agentic Bug Localization
Summary
This study investigates how textual code representations affect file-level retrieval for agentic bug localization. It compares five representations: file paths, raw source code, and three LLM-generated summaries (role-aware, detailed technical, bug report) across two datasets, Long Code Arena (LCA) and SWE-bench Verified (SWE). Experiments involve lexical, semantic, and LLM-based retrieval, followed by LLM-based post-retrieval ranking. The study quantifies representation footprint and generation costs. Key findings include that role-aware summaries outperform file-path representations by up to 40% Hit@5 while being 10.4 to 20.9 times smaller than raw source code. Combining complementary representations and LLM-based ranking further improves gains by up to 31.9% and 42.0% respectively. A case study with Agentless showed a 4.7% Hit@6 improvement, reaching 94% on file localization. The research concludes that code representation is a first-class design choice in agentic localization pipelines, balancing cost and accuracy.
Key takeaway
For AI Scientists and ML Engineers designing agentic bug localization pipelines, you should prioritize "role-aware summaries" to balance cost and accuracy. These summaries reduce token footprint by up to 20.9x compared to raw code, improving your LLM-based retrieval and ranking efficiency. Combine them with raw source retrieval via BM25 for comprehensive coverage. This strategy optimizes your resource use while enhancing localization effectiveness, especially with limited LLM context windows.
Key insights
Role-aware code summaries offer the best cost-effectiveness for agentic bug localization by compressing information while preserving file responsibilities.
Principles
- Code representation significantly impacts localization effectiveness.
- Combining diverse representations improves retrieval coverage.
- Optimize representation choice based on pipeline stage and cost.
Method
The study evaluates five code representations using lexical, semantic, and LLM-based retrieval, followed by LLM-based post-retrieval ranking, quantifying effectiveness and representation footprint.
In practice
- Use role-aware summaries for cost-effective LLM-based ranking.
- Combine BM25 over raw code with dense embeddings for coverage.
- Cache generated summaries for repeated repository queries.
Topics
- Fault Localization
- Code Representation
- LLM Agents
- Information Retrieval
- Retrieval-Augmented Generation
- Cost-Effectiveness
Code references
Best for: AI Engineer, AI Scientist, Machine Learning Engineer, Research Scientist
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by cs.SE updates on arXiv.org.