CodeGrep: An RL-Trained Retrieval Agent for LLM Coding Agents
- Source
- arxiv.org
- Author
- Wuya Chen, Yihao yang, Yang Cao, Yue Lin
- Date

Context
CodeGrep aims to reduce the time a coding spends finding the files it needs to change. The research places a separately trained retrieval agent ahead of an unchanged coding agent. It searches and reads repository files, then supplies candidate paths; the coding agent still has to produce the fix.
Across 500 issues, the reported resolution rate was 27.0% with CodeGrep versus 25.8% without it. The headline 19% reduction in processed text compares each system's own set of solved issues. On the 96 issues both systems solved, the reduction was 15%. That matched comparison supports a narrower finding: useful file suggestions reduced the coding agent's work on shared successes, while resolution rates stayed similar.
- AI agent — An AI system that doesn't just answer once but works toward a goal in a loop — taking actions, reading the results, and deciding what to do next.
- SWE-bench — The standard benchmark for AI coding agents: real GitHub issues from real repositories, scored by whether the agent's patch passes the project's own tests.
- token — The chunk of text a model reads and writes in — roughly three-quarters of a word — and the unit AI usage is billed in.
“Modern LLM coding agents such as Claude Code and OpenHands share a common inefficiency: they spend much of their token budget finding the file to patch, rather than patching it.”
“On SWE-Bench Verified, a 30B OpenHands agent averages 23 rounds and 631K tokens per resolved issue, with many calls spent on grep, glob, and view_file during repository exploration.”
“On all 500 SWE-Bench Verified instances, CodeGrep preserves resolve rate while substantially improving efficiency: 27.0% versus 25.8% for the no-retrieval baseline, with 15% fewer rounds and 19% fewer tokens on resolved instances.”
“Across retrievers, downstream utility follows a precision threshold: BM25 with precision 0.375 degrades the agent, Jina with precision 0.445 is neutral, and CodeGrep with precision 0.677 crosses the threshold at which retrieval begins to reduce rollout cost.”
articleBetter Call Grep: Evaluating and Improving Grep-Like Lexical Retrieval for Repository-Level Code CompletionBaoyi Wang, Xingliang Wang, Guochang Li, Chen Zhi, Junxiao Han, Xinkui Zhao, Nan Wang, Shuiguang Deng, Jianwei Yin
articleSkip the Compressor: Coding Agents Fix More Issues When They Pick Whole FilesXiaocong Yang, Rishit Chatterjee, Himanshu Udupi, Vikram Ramavarapu, ChengXiang Zhai
articleCode RetrievalRelace
Checking sign-in…
Loading comments…