Back to Blog
Articles

The Rapid Rise and Decline of RAG for LLMs

From vector-search demos to long context, caching, and agents: what changed in the standard RAG recipe, and why finding the right evidence still matters.

In November 2025, Cursor published a research article on adding semantic search to coding agents. In its evaluations, accuracy on codebase questions improved by an average of 12.5%, ranging from 6.5% to 23.5% across models; online A/B tests also showed gains. The conclusion was confident, holding that semantic search was still necessary at the time to get the best results, especially in large codebases:

Semantic search is currently necessary to achieve the best results, especially in large codebases.

Cursor: Improving agent with semantic search

In January 2026, Cursor followed up with a detailed account of building semantic indexes for large codebases, covering how to chunk documents, which vectors could be reused, and how different engineers' copies of the code could safely share an index. Each was an engineering problem they had taken seriously. Cursor: Securely indexing large codebases

By July, a user was asking on the forum why the codebase indexing settings had disappeared after an update. The official reply was blunt:

Semantic/embeddings indexing is being turned down in favor of grep-based retrieval.

Semantic and vector indexes were on their way out, replaced by grep retrieval. Cursor forum, July 22, 2026

The current official documentation also states that the text index used for search is built on the user's own machine and that code search stores no embeddings. Cursor search documentation

Looking back, the November article had already left a clue. The conclusion said “currently,” and ended by promising to keep retesting agent tools as models improved. They kept their word.

This would be a good moment to say, “RAG is dead.”

We would hardly be the first. RAG's obituary has been published several times already. In July 2025, someone even wrote an article asking people to Stop Saying RAG Is Dead.

And after replacing its index, Cursor's agent still has to find files, read their contents, and answer from what it finds. The component that left and the work that remained neatly split the question in two.

The “decline” in this article refers to the recipe once treated as a universal starting point, in which you chunk documents, build a vector index, retrieve the top-k results, and have an LLM answer in one pass. We will follow its rise to see which assumptions changed, which work can now be skipped, and which problems are still waiting after a full trip around the block.

The Rise: A Model That Can Talk, but Has Never Seen Your Documents

LLMs learn language and plenty of general knowledge from large training datasets. Ask one what HTTP is or have it write some code, and it will usually manage.

But your company's internal rules, yesterday's deployment changes, and unpublished product documentation are things it has never read.

To give it that information, you can retrain the model or put the material into the current conversation. The second is easier to understand. If you want a colleague to answer questions from a specification, you usually hand them the specification first.

The trouble is that there are too many documents to fit at once.

So engineers can select material for the model first. That is the basic idea behind Retrieval-Augmented Generation, or RAG, which obtains relevant external information first and then lets the model generate an answer from it.

Figure: Timeline compiled for this article. Sources for each event appear in the corresponding paragraphs.

The original RAG paper by Lewis and colleagues in 2020 already connected a retriever to a generative model, using DPR to retrieve Wikipedia documents and BART to generate the answer. Retrieval and generation were fine-tuned together, and answer probabilities from different documents were combined with weights. That was a considerably more complete system than the later practice of pasting search results into a prompt.

During the LLM application boom, the name came to cover “external information plus generation” workflows more broadly. Model weights could stay unchanged while the application kept documents up to date. Businesses easily understood the promise that, once company documents were connected, the model would have material to consult.

In November 2023, AWS launched Knowledge Bases for Amazon Bedrock, managing ingestion, vector storage, retrieval, and generation—and even creating the vector database for you. AWS launch announcement

The path from research paper to cloud product was ready.

A Recipe That Makes a Great Demo

Imagine building document QA for a fictional company. It has a file service called “Island,” with folders full of operating manuals, deployment records, and product specifications from previous years.

The easiest version takes roughly four steps:

  1. Convert PDFs, web pages, and documents into text, then split them into small passages called chunks.
  2. Use an embedding model to turn each chunk into a vector and store it in a searchable index.
  3. When a user asks a question, embed the question too and retrieve the nearest chunks, such as the top five.
  4. Give those chunks and the question to an LLM, asking it to generate an answer with sources.

The first two steps can run ahead of time. The last two wait until a question arrives.

There is a lot to like about this workflow. Long documents can be split up, large collections narrowed to a few passages, and unfamiliar company information attached after retrieval. Every step has ready-made components, and the demo's value is immediately visible. As long as the answer happens to be written in a particular passage, the system looks reliable. Source links make it look even better.

Then users start asking their own questions.

A Horse by the Book: How Far Is Relevant from Correct?

Let's stay with Island. The following numbers are invented to illustrate the workflow.

The document collection contains three items:

SourceContents
Old 2024 manualMaximum upload size is 10 MB per file
2026 product manualThe default limit has increased to 100 MB
This company's deployment settingsThe administrator has set the limit to 20 MB

The user asks, “What is the largest file we can upload right now?”

All three sources are relevant, and all use similar words like file, upload, size, and limit. In vector space, they cluster around the question.

Figure: Illustration created for this article. Real vectors have hundreds or thousands of dimensions; two dimensions make the idea of distance easier to see.

If retrieval returns only the nearest product manual, the model can politely answer “100 MB,” provide a valid source link, and be wrong. All three at once.

That link really does support the product's default value. But this deployment has a 20 MB limit. A user who follows the answer and uploads an 80 MB file will be greeted by an error message.

The Ming-dynasty writer Yang Shen recorded a story in Yilin Fashan1. Bole's book on judging horses described a fine horse as having a raised forehead, prominent, lively eyes, and hooves shaped like stacked fermentation cakes. Bole's son went out looking for a horse with the book in hand. He brought back a large toad and reported, “It mostly matches. Only the hooves look a little different.” Bole did not know whether to laugh or cry: “This horse is good at jumping, but rather difficult to ride.”

Searching by features can easily bring back something that “mostly matches.” Embeddings score textual similarity. Deciding which document is currently valid, whether a default has been overridden, and which deployment “we” refers to requires version, environment, and override relationships. The nearest document may simply be the toad that looks most like a horse.

Chunking can lose more clues. Suppose a passage says only, “This limit applies to older clients,” while the heading identifying the version was split into the preceding chunk. Read alone, the sentence lacks the background needed to interpret it.

Anthropic's Contextual Retrieval, introduced in September 2024, addresses this kind of problem. It first adds each chunk's context within its original document, then combines embeddings, BM25, and reranking. On their test data, the rate at which relevant evidence was missing from the top 20 results fell from 5.7% to 1.9%.

That same article on improving RAG pauses to say, “Sometimes the simplest solution is the best.” At the time, they recommended putting the whole knowledge base into the prompt if it was smaller than 200,000 tokens, or about 500 pages. For information that fits, you can skip building a RAG system first.

We will come back to that.

Once information is retrieved, there is still the second half of the job. The model may ignore exceptions, mix old and new versions, or answer only part of the question. From three engineering case studies, Barnett and colleagues identified seven failure points, ranging from information that does not exist, information that exists but is not retrieved, information retrieved but left out of the context, all the way to a model failing to extract the answer or giving an incomplete one. A better embedding model reaches only some of these problems.

Finding relevant information gets you halfway there. A reliable answer still needs the applicable conditions and complete evidence connected together.

By now, the short demo program has grown document parsing, version management, permission filters, query rewriting, a reranker—a model that reassesses and orders candidate passages—and evaluation datasets. The system has finally met its workload.

The First Blow: The Whole Book Fits Now

One reason for selecting passages in the first place was that the model could not take everything. In February 2024, Google introduced Gemini 1.5, offering selected developers and enterprise customers a preview with a million-token context window. Anthropic's earlier threshold was 200,000 tokens; a model like this could fit several times as much material at once.

If Island's entire manual fits, why chop it up and guess which passages matter most?

Handing over the whole document preserves sections, exceptions, and clues across pages. It also removes one opportunity to retrieve the wrong passage. For questions requiring an overall understanding, that is an attractive option.

But it hands the work to the model. All the information is present; the model still has to find it and use it correctly.

In 2023, Lost in the Middle found that the models tested were more likely to use an answer near the beginning or end of a multi-document input, and often ignored one in the middle. The 2025 NoLiMa benchmark was trickier, deliberately giving questions and evidence almost no words in common to force models to find clues through semantic associations. At a length of 32K, 11 of the 13 tested models scored below half their own short-context performance.

First look at the original position experiment: the x-axis locates the answer-bearing document among twenty documents.

The y-axis measures QA accuracy. The high ends and low middle come from holding document count fixed while moving the answer-bearing document. Lost in the Middle (TACL 2024) — Figure 1, Nelson F. Liu et al., CC BY 4.0.

For NoLiMa, each pair of points compares advertised capacity with the length at which the model still answers reliably.

DOCSAID chart from Table 3 data. Effective length is the largest tested length retaining 85% of the model’s short-context baseline; testing stops at 32K. NoLiMa — Table 3, Modarressi et al.; DOCSAID, Apache-2.0.

Fitting the information and understanding it need separate tests.

Li and colleagues compared the two approaches in their 2024 paper RAG or Long-Context LLMs?. In their GPT-4o setup, simple RAG averaged 32.60, versus 48.67 for the full input—a substantial gap.

They also proposed Self-Route, which first tries to answer from retrieved results and switches to the full text if the model judges the information insufficient. This hybrid scored 48.89 while using about 61% of the full-context approach's tokens. These scores average nine tasks from LongBench and ∞Bench, with different metrics for different tasks.

Compare LC, RAG and Self-Route in the GPT-4O group, then read the token % row below.

Avg averages nine task scores; token % is relative to full-context input. The table shows Self-Route’s 48.89 score alongside its 61.40% token usage. Retrieval Augmented Generation or Long-Context LLMs? A Comprehensive Study and Hybrid Approach — Table 1, Zhuowan Li et al., CC BY 4.0.

Connecting the two routes kept the score up while saving roughly 40% of the tokens.

The Second Blow: Memorize the Whole Book First

If every question refers to the same manual, it is natural to ask whether we really have to read it from the beginning every time.

That brings us to the KV cache. As a generative Transformer reads input, each layer computes keys and values for every token to use in attention. Save those intermediate results, and later generation can reuse them. When multiple questions share the same document prefix, the computation for that prefix can also be reused.

Uploaded in late 2024, Don't Do RAG calls this Cache-Augmented Generation, or CAG, which reads the whole knowledge base once, saves its KV cache, and then continues generating when a question arrives. It is like memorizing the entire handout before an exam. What gets saved is intermediate computation; the model weights stay unchanged.

The title is bold, but the experiment is straightforward. The model is Llama 3.1 8B, with knowledge bases drawn from SQuAD and HotPotQA and about 21k to 85k tokens of material that can all be preloaded.

Here is the time each of three approaches takes in the paper's largest HotPotQA setting:

Figure: CAG amortizes the cost of rereading the full text. BM25 retrieving only three passages still takes less time per question.Source: CAG v2, Tables 2–3, HotPotQA Large. BM25 includes 0.0008 seconds for retrieval and 0.6667 for generation. The full-rereading row has no corresponding BERTScore. CAG reports per-question time after preloading; all methods exclude offline index or cache construction. Hardware: eight V100 32G GPUs.

Reading the whole knowledge base from scratch for every question takes 92 seconds, like rereading the entire employee handbook before every meeting. Memorize it first, and that falls to 2.26 seconds, roughly 40 times faster. That is the cost caching amortizes.

But BM25, looking up just three passages, needs only 0.67 seconds for retrieval and generation, with a slightly higher BERTScore of 0.7463 versus 0.7407. BERTScore measures semantic similarity between an answer and its reference, with higher scores being better. Here the gap is only about 0.006.

To be fair, CAG leads in the SQuAD column of the same table, with 0.7734 versus 0.7634 for BM25 top-3. The authors also notice that simple sparse retrieval beats dense retrieval on these datasets. They suggest the datasets may be easy enough for traditional retrieval to find most of the needed information.

The cache also needs somewhere to live. Take Llama 3.1 8B: it has 32 layers, eight KV heads per layer, and 128 dimensions per head. Every token needs one K and one V:

  • Per token: 2 × 32 × 8 × 128 = 65,536 values
  • In bf16: 65,536 × 2 bytes = 128 KiB
  • Whole knowledge base: 128 KiB × 85,000 ≈ 11.1 GB, or about 10.4 GiB

The model weights themselves occupy about 16 GB in bf16.

That memorized handout is roughly two thirds the size of the model. These are our estimates for unquantized bf16 storage, excluding inference-framework overhead.

For a service with a small, stable document collection and frequent repeated questions, removing the retrieval pipeline is certainly worth evaluating. But data updates require cache recomputation, and if users have different access permissions, shared prefixes must be separated accordingly.

The Third Blow: The Model Can Browse for Itself

Back to Island. If a single retrieval returns the 2026 product manual and the model can only answer next, the workflow stops at 100 MB.

Now give it tools for searching, reading files, and checking deployment settings, and let it decide the next step. Look first at the three keywords searched in parallel in the diagram, then at how each round's clues change the search direction.

Figure: Illustration created for this article. Results from each search round determine what to look for next.

Each step's result changes what the next step should look for. Agentic search is useful because search becomes an action that can be repeated.

This approach has a research history too. ReAct in 2022 alternated reasoning and actions, using a Wikipedia API to look up information. Self-RAG in 2023 let the model decide whether to retrieve and assess its own generated content.

More recent engineering designs give the model file paths, queries, and links first, loading content only when needed. Anthropic uses Claude Code to illustrate this just-in-time context in its article on context engineering. It also acknowledges that exploration at runtime is slower and can take a wrong turn.

This direction comes naturally to codebases. File names, directories, function names, and error messages are already useful clues.

Back on the Cursor forum, one user raised a practical objection:

Grep needs a seed token.

Their example was wanting to find where shipping-status updates are handled without knowing the responsible class's name. This is exactly where embeddings can help. Grep needs you to name a keyword first, like giving a password. An agent can invent its own passwords, but that takes extra rounds, and inconsistent naming makes it easier to miss.

The official response was:

the Agent doesn’t bet on one seed

In that same reply, Cursor explained that current models handled grep well in their tests. Searches are fast enough for an agent to try several candidate terms at once, list directories, read files, and adjust direction. It can spread its bets across several keywords.

That exchange almost captures the whole article. Vector retrieval used to handle “I don't know what it's called.” Now the model is willing to guess several names at once, then guess again if they are wrong.

Another small detail appeared in the thread. A user asked whether the 250,000-file limit remained. The official answer was that this had been a semantic-index limit; grep has no cap on the number of searchable files.

These are Cursor's own test conclusions, and the complete setup has not been published. At least in this product, the work left behind by semantic indexing has been taken over by an agent willing to make a few more guesses.

A Hundred Files and Half a Million Documents Are Different Jobs

The codebase experience is easy to get excited about, since a model given grep finds things on its own. What happens when the data grows?

In their 2026 paper BM25 Wins at Scale, Wang and colleagues ran a clean experiment. Questions and key evidence stayed fixed while the surrounding simulated enterprise corpus grew layer by layer, from 1,144 documents to about 510,000, spanning documents, messages, and tickets. This separates “harder questions” from “more places to look.”

In a controlled experiment using the same 150 questions, rescored together:

Table: v3 of the paper, Table 4. The small corpus contains 1,144 documents; the large one contains 511,959. Scores combine answer correctness and completeness. One simulated corpus, a fixed model, and an 80-tool-call budget per question.
Method1,144 documents511,959 documents
File exploration87.136.9
Single-pass BM2581.354.8
Agent plus BM2590.169.4

On the small corpus, the file-browsing agent scores above single-pass BM25, though the paper's statistical test treats them as tied. As the corpus grows, the agent falls from 87.1 to 36.9. BM25 falls too, but holds at 54.8. The paper's main results show the two curves crossing near ten million corpus tokens, after which BM25 leads at every level.

The cost is even more striking. On the large corpus, the file-exploration agent averages 36 tool calls and about 895,000 tokens per question, earning the lowest score. Hard-working, just in the wrong places.

The problem is finding the evidence. The paper picks out the questions where each method retrieves at least one correct document, and on those hit subsets the agent scores 85.9, versus 73.8 for BM25. These are different question sets, but they show how the agent performs once it finds evidence. Yet the agent retrieves a correct document for only 39.0% of questions, versus 71.6% for BM25.

If it never reaches the right corner, more reasoning cannot make up for the missing document.

Replace the agent's tools with BM25 search, and it can start with ranked candidates, then investigate them further. Its score rises to 69.4, average calls fall to 5.8 per question, and tokens drop to about 100,000—roughly one ninth of the original usage. The index scoops a few worthwhile buckets from the ocean; the agent examines each bucket carefully.

There is another set of numbers directly relevant to this article's title. In the main-results table, the conventional dense-vector retrieval pipeline ranks last among these three methods at every corpus size. At full scale, BM25 scores 50.5, the file-exploration agent 30.7, and dense retrieval 29.9. This experiment uses the small Qwen3-Embedding-0.6B model, so stronger embeddings could change the numbers. But in this three-way comparison on a simulated enterprise corpus, the “chunk, embed, top-k” recipe comes last.

So after “let the model find it itself,” we still have to ask what tools it uses to look.

A Tool's Name Tells Only Half the Story

The 2026 paper Is Grep All You Need? compares grep and vector retrieval for long-term conversational-memory QA, crossing different agent harnesses with different ways of delivering tool results. A harness is the program around the model that calls tools and organizes results. The paper describes an initial block of 15 vector-retrieved memories in the Chronos workflow, but leaves unclear whether this step is removed for grep-only. In the subsequent search-tool comparison, grep wins every combination when results go straight into the conversation. When results are written to files for the model to read, vector retrieval takes the lead in five of ten combinations.

Another code QA study that year pits two agents against each other on SWEQA's 720 questions across 15 Python projects, one with vector retrieval and the other delegating exploration to subagents. The former passes an average of 65.2%, versus 46.2% for the latter, with gaps of 5.6 to 49.6 percentage points across models. Vector retrieval wins this time, already installed inside an agent. “Pass” here is the paper's metric, in which an LLM judge scores answers against references and a score of at least 70 passes. The gap varies greatly across the four tested models, with one model pulling the average farther apart.

Whether search results are truncated, how many follow-up searches are allowed, how usable the source-reading tools are, and how results reach the model can all change the winner. The same vector index may perform differently in a one-shot pipeline and inside an agent.

The Autopsy: What Died, and What Is Still Alive?

Now we can return to the title. We have a named product replacing its embeddings index; small, fixed knowledge bases moving to full context or caching; control flows that let models retrieve, read sources, and search again as needed; and a large-corpus experiment where dense top-k ranks last among three approaches at every scale.

Put together, the report might read like this:

  • On the way out: treating “chunk, embed, top-k, answer once” as the default starting point for every requirement, along with the semantic index in at least one major product.
  • Alive and well: retrieval itself, old-fashioned search such as BM25, and data concerns such as versions, permissions, and update frequency.
  • Moved elsewhere: retrieval has gone from a fixed pipeline stage to a tool in an agent's hands. The task determines when to use it, how often, and which kind.

If we rebuilt Island's QA system today, we would probably start with four questions:

  1. Does the information fit? If so, try the full text first. Consider caching when questions recur frequently.
  2. Can one search return all the evidence? If the next step depends on reading the results, put search in a loop.
  3. How large is the corpus? If it is too large for the agent to browse, use an index to rank candidates first, then let the agent investigate.
  4. Which version, permissions, and effective deployment settings does the answer require? Whichever route we take, this question remains.

Early RAG was appealing because a short flowchart answered “How do we get information to the model?” Engineering experience has since made the question more specific: what information does this task need, at what point, and at what cost?

So you needn't worry too much about whether RAG is dead or alive. It has been here all along.

In ways you didn't expect, and forms you aren't familiar with.

Footnotes

  1. The story appears in Yang Shen's Yilin Fashan, volume 7, “Xiang Ma Jing.” See the quotation in Taiwan's Ministry of Education idiom dictionary. Retold here in plain language. ↩