Skip to main content

RAG (Retrieval-Augmented Generation)

RAG (Retrieval-Augmented Generation) is an architectural pattern that supplies an LLM with content from external knowledge sources at answer time: first, documents matching the request are retrieved (retrieval), then the model generates the answer on this basis (generation).

How does RAG work?

A RAG system operates in two phases. In the preparation phase, the knowledge base is processed: documents are broken into manageable sections (chunking) and indexed so they can be searched by content — usually via vector embeddings that capture semantic similarity, often combined with classic full-text search.

At answer time, every request then runs through three steps:

  1. Retrieval: The sections of the knowledge base that best match the user’s question are retrieved.
  2. Augmentation: The retrieved sections are inserted into the input to the LLM together with the question.
  3. Generation: The model formulates the answer based on the supplied content — and can name the sources used.

The decisive effect: the model no longer answers only from its training knowledge, but from the current, controlled content of the company.

When is RAG useful?

RAG plays to its strengths when the required knowledge is current, company-internal or subject to verification. Typical reasons for RAG:

  • Currency: Content changes continuously — the knowledge base is simply updated, without retraining the model.
  • Traceability: Answers can be supported with source references, which considerably eases review and trust.
  • Access control: Who may see which content can be controlled at the level of the knowledge base — the model only receives what the requester is allowed to see.
  • Hallucination reduction: Grounding in supplied documents noticeably lowers the risk of freely invented statements — but does not replace review of critical statements.

RAG or fine-tuning?

The two approaches solve different problems and are often confused:

RAGFine-tuning
Changesthe knowledge available at answer timethe behavior of the model itself
Suitable forfacts, documents, current company knowledgetone, format, domain language, specialized tasks
Updatingmaintaining the knowledge base is enoughretraining required
Source attributionpossible, answers are verifiablenot possible, knowledge is “baked into” the model

As a rule of thumb: if it is about knowledge, RAG is the first choice. If it is about behavior, fine-tuning (or training adapters) is the appropriate means. In practice, the two are frequently combined.

Limits of RAG

RAG is not a sure-fire success. Answer quality stands and falls with retrieval: if the wrong sections are found — because the documents were chunked unfavorably, the search misses the domain terminology or the knowledge base is outdated — the model still produces a fluent-sounding answer from poor material. Ambiguous questions or questions spread across many documents also remain challenging. And RAG does not teach the model new skills: it delivers content, not competence.

RAG in practice: data quality decides

In real projects, in our experience, the largest part of the work goes not into the model but into the knowledge base: reviewing content, clarifying responsibilities for its maintenance, mapping access rights and measuring retrieval against the actual questions users ask. A RAG system built on top of an unmaintained document repository only makes its contradictions visible faster — the real investment is a knowledge base you can trust.

Frequently asked questions

Does RAG reduce hallucinations?
Yes, considerably — but it does not eliminate them. Because the model grounds its answer in supplied documents and can cite sources, the risk of freely invented statements decreases. However, if retrieval delivers unsuitable or outdated content, the model still formulates a convincing-sounding answer from it. The quality of the knowledge base remains decisive.
RAG or fine-tuning — which is appropriate when?
RAG is the first choice when it comes to knowledge: current, changeable, verifiable content that should be supported by source references. Fine-tuning is worthwhile when the model’s behavior needs to be adapted — tone, format, domain language or specialized tasks. The two approaches are not mutually exclusive and are often combined.
Which data sources are suitable for RAG?
In principle, all searchable text collections: documentation, wikis, policies, contracts, tickets, emails or product data. The prerequisite is that the content is maintained, correct and cleanly separated in terms of access rights — an outdated or contradictory knowledge base delivers poor answers even with the best model.

Related terms

Reviewed by Christoph Hess, Head of Artificial Intelligence on July 20, 2026