Menu

Glossary

What is RAG?

RAG (retrieval-augmented generation) fetches relevant documents and hands them to a language model as context, so it answers from evidence.

Copy as MarkdownOpen in ChatGPT (opens in a new tab)Open in Claude (opens in a new tab)

RAG (retrieval-augmented generation) is a technique where an AI system fetches relevant documents from a search index, a database or the web, then passes them to a large language model as context for its answer. Instead of relying on training data alone, the model answers from retrieved evidence, which reduces hallucinations and keeps responses current.

How does retrieval-augmented generation work?

A RAG pipeline runs four steps on every request:

  1. Query. The user's question, or an agent's sub-task, is turned into one or more search queries.
  2. Retrieve. Those queries run against a knowledge source: a vector database, a keyword index, internal documents or a web search API.
  3. Augment. The top results are cleaned, trimmed and inserted into the model's prompt next to the original question.
  4. Generate. The model writes its answer from that evidence and, ideally, cites which document supported each claim.

The model's weights never change. All of the new knowledge lives in the prompt, which is why a RAG system can be updated without retraining: change the documents and the answers change with them.

What problem does RAG solve?

Language models have two structural gaps. Their training data has a cutoff date, so they know nothing about later events. And they have no access to your private data, such as tickets, contracts and internal wikis. Without retrieval, a model asked about either will guess, and guesses are where many hallucinations come from.

RAG closes both gaps at answer time. It also makes answers auditable: because the evidence is in the prompt, the system can point to the passage behind a claim. That is the core idea of LLM grounding. RAG reduces hallucination and does not end it. A model can still misread or ignore what it was given.

What does a RAG pipeline retrieve from?

Many production systems mix sources: a store of internal documents, and a search API for the web when a question concerns the outside world. Retrieval quality is the ceiling on answer quality. A pipeline fed duplicate, heavily optimized pages inherits their errors, a failure mode known as RAG noise.

Where MillionShort fits

MillionShort is the retrieve step for the web. One call to POST /v1/search returns ranked results with snippets of up to 2,000 characters and their URLs, from 1 to 5 of 13 sources, and your model does the generating. It does not write the answer. When a question needs more than a snippet, include_content: true adds the page text we hold to web and news results. That is our stored copy. For a page as it is now, Extract fetches the URL and returns clean text.

The Search for RAG guide has working code, and the RAG use case describes the fit.

This page as Markdown ยท llms.txt