Why AI Coding Assistants Are Shifting from Vector Search to Tool-Driven Retrieval
Some AI coding assistants are reducing their reliance on vector search and using tools to explore repositories directly. This article examines why semantic similarity can miss critical code relationships, how tool-driven retrieval works, and the trade-offs in accuracy, infrastructure, latency, context management, and security.
Over the past two years, retrieval-augmented generation (RAG) has become a default architecture for many large language model applications. The familiar workflow—chunk documents, generate embeddings, store them in a vector database, retrieve the top-k passages, and pass them to the model—has worked reliably for question answering and knowledge bases.
In software development, however, some mainstream coding tools and agent systems have begun reducing or even removing vector search pipelines. Instead, they let models explore repositories through tools: searching for keywords, opening files, reading through code, and editing specific lines.
There are concrete technical reasons for this shift, but the trade-offs deserve a balanced assessment. The key questions are where vector retrieval falls short for code, how tool-driven retrieval works, and what costs it introduces.
1. Where Vector Search Falls Short for Code
Semantic Similarity Is Not the Same as Code Relevance
Embedding models are trained primarily on natural language and are good at identifying passages with similar meanings. Relationships in code, however, are largely structural: imports, type definitions, inheritance, and function call chains.
When modifying a function, the most useful context may be its callers and the functions it calls. Those relationships are not directly represented by semantic similarity in a vector space. A retrieved snippet may look closely related in meaning yet offer little help with the actual change.
Exact Identifier Lookups Can Be Unreliable
When developers search for the definition of processPayment, they need an exact match. Vector retrieval might return a similarly named function such as handlePayment, or rank a comment containing related vocabulary above the actual definition.
Keyword search avoids this particular ambiguity. Its results are reproducible, and whether an identifier matches is immediately clear.
Indexes Fall Behind Code Changes
Repositories change with daily commits. A vector index must either be rebuilt periodically or updated incrementally. Both approaches incur computational costs, and both can leave a gap between the current code and its indexed representation.
Incremental indexing can reduce that gap, but it does not eliminate it entirely.
Maintenance Becomes an Ongoing Burden
A vector-based pipeline requires continued maintenance of chunking strategies, embedding model versions, vector database settings, and update workflows. Upgrading the embedding model typically means recomputing the existing vectors.
When the resulting retrieval gains are modest, that infrastructure can become technical debt.
One benchmark detail is worth clarifying: the retrieval baseline in the original SWE-bench paper used BM25 keyword retrieval, not vector retrieval. Under that baseline, models resolved roughly 2% of real-world issues.
That result illustrates how poorly a one-shot retrieve-and-generate workflow performed on real repair tasks in that setting. It does not, by itself, establish that vector retrieval is ineffective, nor does it represent the capabilities of today’s models and retrieval methods.
2. How Tool-Driven Retrieval Works
Unlike one-shot retrieval, a tool-driven agent lets the model decide what to inspect at each step. A typical workflow looks like this:
- Read the task description, list directories, and identify likely entry-point files.
- Use keyword search tools such as
greporripgrepto locate symbols and error messages. - Open files and read further through the relevant sections as needed.
- Use abstract syntax tree (AST) or language server tools to inspect function definitions, references, and type information.
- Edit the code and run tests or compilation commands.
- Continue iterating based on the results until the task is complete or the budget limit is reached.
A central benefit is auditability. Each step exposes concrete inputs and outputs, such as file contents or command results, that developers can inspect and reproduce. The agent’s context contains code it has actually opened and read, rather than only snippets selected by semantic similarity.
3. Benefits and Costs of Tool-Driven Retrieval
Benefits
More accurate reconstruction of code relationships. Following imports and tracing call chains aligns more closely with the actual structure of a program than estimating relevance in a vector space.
Access to current workspace state. Tools read workspace files directly, avoiding stale vector indexes. Reading files is usually fast; the more significant bottleneck is often bringing their contents into the model’s context.
Simpler infrastructure. Removing the vector database, embedding service, and chunking configuration makes the deployment environment lighter.
Costs
More calls, higher token usage, and greater latency. A single repair may require dozens of tool calls, increasing both the amount of processing and the time needed to finish.
Limited context capacity. The more code a model reads, the more it must compress or discard irrelevant material. Otherwise, important information can be pushed out of the context window.
The risk of exploring the wrong path. A model may spend many steps investigating modules that have little to do with the task.
Greater importance of security boundaries. Those boundaries become especially important when an agent can write files.
