AI Writing
Retrieval-Augmented Generation (RAG)
A pattern in which a model is given relevant context retrieved from your own sources before generating an answer.
Definition
Retrieval-augmented generation combines two systems. First, a retrieval step — usually vector search over an embedded corpus — pulls the most relevant content for a query. Second, a generation step passes that content to a language model along with the user's question, instructing it to answer based on what was retrieved. The pattern grounds the model in current, source-specific facts that it could not otherwise reliably know.
Why it matters
RAG addresses the most cited weakness of language models: confident wrongness about specifics. A model asked about your refund policy may invent something plausible; the same model, handed the actual policy text and asked to answer based on it, performs reliably. That makes RAG the standard pattern for customer support, internal knowledge assistants, documentation search, and any product where answers must be tied to a specific corpus. The technique also reduces the need for expensive fine-tuning. Instead of teaching the model new facts, you teach it where to look. As facts change — pricing, policies, product details — you update the corpus, not the model.
Examples
Customer support
An assistant answers refund questions by retrieving the relevant policy paragraphs and citing them, rather than relying on the model's general training.
Internal documentation
An engineering chatbot answers 'how do we deploy to staging?' by pulling the current runbook, not the version from two years ago that may be in training data.
Frequently asked
Does RAG eliminate hallucination?
Reduces it substantially when prompts instruct the model to answer only from retrieved context. Does not eliminate it entirely.
How fresh can retrieved content be?
As fresh as your indexing pipeline. Many teams re-embed updated content on save or on a schedule of minutes to hours.
What if no relevant content is found?
A well-designed RAG system tells the user it does not know, rather than improvising. That fallback behaviour is essential to trust.
Related terms
Vector Database
A specialised database optimised for storing high-dimensional vectors and retrieving nearest neighbours efficiently.
Embeddings
Numerical vector representations of text whose distances capture semantic similarity between pieces of content.
Large Language Model (LLM)
A neural network trained on very large text corpora to predict the next token in a sequence, capable of producing fluent natural-language output.
Prompt Engineering
The discipline of crafting model inputs — instructions, context, examples, and constraints — to produce reliably better outputs.
Put the concept to work
Open the rewrite engine and apply this principle to a draft of your own.
Try a rewrite