CursorStefan Heule, Emily Jia & Naman JainBenchmark
Improving agent with semantic search
Summary
Cursor describes semantic search as a complement to grep for helping coding agents locate relevant code in large codebases. Its evaluation used Cursor Context Bench across widely used models, comparing tool sets with and without semantic search, and found an average 12.5% accuracy improvement, with gains ranging from 6.5% to 23.5%. In an online A/B test, semantic search increased code retention by 0.3% overall and 2.6% on codebases with at least 1,000 files, while its absence produced a 2.2% increase in dissatisfied follow-up requests. The retrieval system uses a custom embedding model trained from agent session traces, with an LLM ranking helpful content and training aligning embedding similarity scores to those rankings. The conclusion is that combining semantic search with grep produces the best outcomes, especially for large codebases.
Context
Coding agents need to understand a codebase by reading files and searching for relevant information. The work evaluates whether semantic search improves on traditional regex-based tools such as grep, particularly for large codebases and real user tasks.
Approach / What changed
A custom embedding model is trained from agent session traces. An LLM ranks the content that would have been most helpful at each step, and the embedding model is trained to align its similarity scores with those rankings. The approach is evaluated through Cursor Context Bench and an online A/B test comparing agents with and without semantic search.
Takeaways
Semantic search improved answer accuracy by an average of 12.5% in offline evaluations, with model-dependent gains from 6.5% to 23.5%.
In the A/B test, code retention rose 0.3% overall and 2.6% for codebases with 1,000 or more files when semantic search was available.
The strongest results came from combining semantic search with grep rather than relying exclusively on either search method.
Source and freshness
- Source
- cursor.com
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.