Learn · updated 2026-11-27

RAG Explained: Grounding Answers in Retrieved Evidence

Retrieval augmented generation, RAG, retrieves relevant passages before the model writes an answer and puts that evidence in the prompt, so the response can be grounded in sources instead of model recall. The hard parts are retrieval quality, deduplication and citation binding. A RAG system that returns plausible answers without checkable sources has not solved the problem.

The pipeline in five steps

RAG starts by deciding whether retrieval is needed, then turning the question into retrieval queries. It searches an index - ideally both semantically and lexically - merges the result sets, reranks passages for relevance and source quality, and drops near-duplicates so one source does not crowd out the rest.

It then assembles a bounded evidence set that fits the context budget, generates the answer against that evidence, and binds each citation to the passage it came from. Every step can fail independently, which is why a RAG demo often looks better than a RAG product.

Where RAG fails

Retrieval misses are the first failure: the needed passage was not indexed or did not rank. Stale indexes are the second: the passage was true last quarter. Duplicate domination is the third, where ten copies of one story leave no room for the source that disagrees.

The worst failure is fabricated citation, where the answer cites a URL the model produced from memory. That is worse than an admitted gap because it defeats the only thing the user was relying on. A production RAG system must be able to return nothing found.

How Riven Grounding implements it

Riven Grounding classifies whether a question needs retrieval at all, so a rewrite request does not pay a search cost. When retrieval engages, it rewrites the query with thread context, searches the Web Index semantically and lexically, reranks and deduplicates, and assembles a diverse evidence set.

Citations are bound to passages the platform actually retrieved, and when retrieval finds nothing usable the answer says so. Grounding is reachable from the API by pinning a research-tier model, or teams can embed their own corpus with the embedding model and supply passages directly.

Measuring RAG quality

Build a question set with known correct sources. Measure retrieval recall first, because generation cannot recover evidence that was never retrieved. Then measure citation accuracy: does each citation actually support the sentence it is attached to. Then measure gap honesty: does the system say nothing was found when nothing was found.

Run the set on every index refresh and every model change. A RAG system is only as good as the last time its retrieval was measured, and vendor benchmarks do not substitute for a set drawn from your own domain.

RAG failure modes and mitigations

FailureSymptomMitigation
Retrieval missAnswer ignores a source you know existsHybrid search, query rewriting, index coverage
Stale indexConfident answer with an outdated factFreshness signals and refresh cadence
Duplicate dominationOne story fills the evidence setDeduplication and source diversity
Unsupported claimCitation does not support the sentenceCitation binding to retrieved passages
Fabricated sourceA URL the model inventedReturn an admitted gap, not a guess

Frequently asked questions

What does RAG stand for?

Retrieval augmented generation. It retrieves relevant passages before generation and puts them in the prompt, so the answer can be grounded in evidence rather than model memory.

Is RAG the same as web search?

No. Web search finds pages; RAG retrieves passages, reranks them, assembles a bounded evidence set and binds citations to what was retrieved. Search is one component of a RAG pipeline.

Does Riven Grounding always cite?

It cites when retrieval is used and a supporting passage exists. Not every question needs retrieval, and when retrieval finds nothing usable the answer says so rather than inventing a source.

Can I use my own documents with RAG on Riven?

Yes. Embed the corpus with the riven-embed model and supply passages to generation, or use the Cortex retrieval tools inside an agent workflow. Access control and refresh cadence are scoped per deployment.

More in learn

Sources and read dates

Related reading