Developer Tools

CodeGrep's RL-trained retriever cuts coding agent token waste by 19%

A 14B retrieval agent slashes token spend while nudging resolve rates up on SWE-Bench Verified.

Deep Dive

LLM coding agents like Claude Code and OpenHands waste a huge portion of their token budget on repository exploration—grepping, globbing, and reading files just to locate the right code to patch. On SWE-Bench Verified, a 30B OpenHands agent averages 23 rounds and 631K tokens per resolved issue. A new paper introduces CodeGrep, a 14B retrieval agent trained with reinforcement learning (GRPO) that offloads those search tool calls, returning candidate files to a frozen downstream coding agent. The result: resolve rate improves to 27.0% versus 25.8% for a no-retrieval baseline, while consuming 15% fewer rounds and 19% fewer tokens on resolved instances.

The authors mine supervision from 67K open-source agent trajectories using CATM and build a Git-worktree environment to support multi-turn agent RL. A key insight is that downstream utility follows a precision threshold—BM25 at 0.375 precision degrades the agent, Jina at 0.445 is neutral, and CodeGrep at 0.677 crosses the point where retrieval begins to lower rollout cost. They also find that applying the efficiency signal at the advantage layer (rather than the reward layer) reduces KL drift and transfers more cleanly to downstream efficiency. The team plans to release the model, training pipeline, RL environment, and evaluation harnesses, making this a significant contribution to making coding agents more token-efficient and faster in real-world development workflows.

Key Points
  • CodeGrep is a 14B retrieval agent trained with GRPO to issue parallel grep, glob, and read tool calls for coding agents
  • On SWE-Bench Verified, CodeGrep achieves 27.0% resolve rate (vs. 25.8% baseline) with 15% fewer rounds and 19% fewer tokens
  • Trained on 67K open-source agent trajectories with CATM; code, pipeline, RL env, and harnesses will be open-sourced

Why It Matters

Cutting token waste in coding agents means lower costs and faster iteration for developers building on LLM-powered tools.

📬 Get the top 10 AI stories daily