Home / AI glossary / What is RAG (retrieval-augmented generation)?
AI glossary

What is RAG (retrieval-augmented generation)?

RAG lets a language model look up your own documents while answering, so responses stay grounded and current.

In short

RAG gives a large language model access to your own documents at answer time. It retrieves the most relevant passages from your knowledge base and feeds them to the model, so answers are grounded in your data — with sources — instead of the model's training alone. It's the main technique for reducing hallucinations. See LLM Optimisation →

RAG (retrieval-augmented generation) lets a language model search your own documents at the moment it answers, then write its response from what it found. The model supplies the language; your content supplies the facts.

It exists to solve one problem: a model only knows what was in its training data, which never includes your prices, policies or product details. RAG closes that gap without retraining anything, you update the document, and the answer changes with it.

How RAG works, in four steps

Your documents are split into chunks and converted into embeddings stored in a vector index. When a question arrives it is embedded the same way, and the closest chunks are retrieved. Those chunks are placed into the model prompt as context. The model then generates an answer from them, ideally citing which chunk it used. Most RAG quality problems are retrieval problems, not model problems.

RAG vs fine-tuning vs long-context

These solve different problems and get confused constantly. RAG supplies facts and keeps them current. Fine-tuning teaches style, format and tone, it is a poor and expensive way to teach facts, which change. Long-context means pasting everything into the prompt: simplest to build, but cost and latency scale with every call. Rule of thumb: facts that change → RAG; consistent output format → fine-tuning; a small fixed document set → long-context.

When you do not need RAG

If your knowledge base is a handful of pages that rarely change, long-context is simpler and often better. If the task is summarising or rewriting text the user supplies, there is nothing to retrieve. And if your documents are contradictory or out of date, RAG will faithfully surface that, it is a retrieval system, not a fact-checker. Fix the content first.

How to tell whether it is working

Measure retrieval, not vibes. Build an evaluation set of real questions with known correct sources, then check how often the right chunk is retrieved at all, if it is not retrieved, the model cannot use it. Ask any supplier for retrieval accuracy on your documents rather than a benchmark. At Crux Digits a RAG pilot is scoped inside the €20,000 Production-ready MVP, delivered in 4–6 weeks.

Frequently asked questions

What is RAG in simple terms?

It lets an AI look things up in your documents before answering. Instead of relying on what the model memorised during training, the system searches your content, finds the relevant passages, and writes the answer from those: usually with a citation showing where it came from.

  • The practical benefit: update a document and the answer updates immediately, with no retraining.
  • Citations make answers auditable, which matters for policy, pricing and warranty questions.
  • RAG reduces hallucination substantially but does not eliminate it, keep a human escalation path.

Should we use RAG or fine-tuning?

RAG for facts, fine-tuning for style. If the AI needs to know your prices, policies or products, use RAG, those change, and retraining a model every time is impractical. If you need consistent tone or a rigid output format, fine-tuning helps. Many production systems use both.

  • Fine-tuning is a poor way to teach facts: the model cannot tell you which source an answer came from.
  • RAG is usually less expensive to build and far less expensive to keep current.
  • A third option, long-context, beats both when your document set is small and stable.

Do we have enough documents for RAG to work?

Usually yes, quality matters far more than quantity. A few hundred accurate, current pages outperform thousands of contradictory ones. The real prerequisite is that your content is correct and consistent, because RAG will faithfully retrieve whatever is there, including outdated policies.

  • Good sources: product documentation, policies, price lists, past support tickets, handbooks.
  • Clean up contradictions before you build. RAG surfaces them rather than resolving them.
  • Keep the index synced to the live source, or the assistant will quote last year's version.
Go deeper with Crux Digits

Want this applied in your business? See how we take it to production:

← All AI terms

From concept to working tool?

We build this AI in production, at fixed prices, with one named expert. Start with a free consultation.

Book a free consultation →