Aperçu
RAG (retrieval-augmented generation) is an AI technique that lets a large language model look up relevant information in an external knowledge source before it answers. The system retrieves passages that match the question, adds them to the prompt, and the model writes a response grounded in that retrieved content instead of relying only on its training data.
A RAG application’s answers are only as reliable as its retrieval layer. So, enterprise teams need to govern data freshness, access controls, and chunking strategies as carefully as they choose the model.
Key takeaways
- RAG keeps knowledge in a searchable store that can be updated daily, so the model does not need retraining when information changes
- Use RAG when the model needs facts it was not trained on; use fine-tuning when the model needs to learn new behavior, syntax, or domain-specific vocabulary
- RAG reduces hallucinations but does not remove them; retrieval quality, evaluation and access controls decide whether answers can be trusted
Where RAG comes from
The term comes from a 2020 research paper by Lewis and colleagues, which paired a large language model with an external memory that is searched at the moment a question is asked. The idea is often compared to an open-book exam. Instead of answering from memory, the model looks up the right pages first.
Why large language models need retrieval
A language model knows only what was in its training data, and that knowledge stops at a cutoff date. It may have never seen an organization’s contracts, product manuals, support tickets, or policies. When asked about them, it may produce a fluent answer that is wrong, which is known as a hallucination. Retraining the model every time information changes is slow and expensive. RAG solves the problem at query time. The knowledge stays in a searchable store that can be updated daily, and the model reads the relevant parts when it needs them. Because the answer is built from retrieved passages, the application can also show its sources.
RAG is a technique, not a model
People often search for a “RAG model”, but RAG is a technique that wraps around an existing model. The same generative AI model can serve many RAG applications, each pointed at a different knowledge source. Changing what the application knows means changing the documents and the index, not the model’s weights.
How does RAG work?
A RAG pipeline runs in four steps across two distinct operational halves. An offline ingestion pipeline prepares and structures the knowledge base, while a real-time query pipeline executes on every user request.
Step 1: Ingest and chunk the source content
The ingestion phase collects the raw domain knowledge, such as PDFs, wiki pages, support tickets, and database records, and normalizes it into clean text. Because much of this corpus is unstructured data, failing to correctly parse dense tables, headers, or embedded images creates immediate retrieval failures downstream. Each cleaned document is systematically split into smaller chunks. Chunk sizing creates a permanent architectural trade-off. Small chunks maximize retrieval precision but strip away critical surrounding context, while large chunks preserve narrative context but dilute semantic relevance and inflate prompt costs.
Step 2: Create vector embeddings and index them
An embedding model converts each text chunk into a vector embedding, mapping its semantic meaning into a dense numerical array so that conceptually similar passages cluster together, regardless of exact keyword overlap. The system stores each vector together with its original chunk text and key metadata, such as the source, timestamps and access permissions. These records go into a vector database or another store that supports vectors. A vector index then maintains rapid similarity search, even at large scale.
Step 3: Retrieve the most relevant context
When a user submits a question, the query pipeline embeds the prompt using the exact same model and scans the index to isolate the nearest mathematical neighbors. Many production systems use hybrid search. That combines semantic retrieval with keyword search so that exact terms such as product codes, error messages, and names are not missed. The query layer applies metadata filters to discard stale or unauthorized records, and a reranking model reorders the remaining candidates so only the best few passages—the top-K—go forward to the prompt.
Step 4: Augment the prompt and generate a grounded answer
The system concatenates the retrieved passages alongside the original question and system instructions, demanding the model “answer exclusively using the provided context and cite all sources.” This is a form of in-context learning. The language model synthesizes its response directly from the data injected into the prompt rather than relying on its internal static weights. The model streams the generated answer and retrieved source passages back to the application layer for user verification.
RAG architecture: The core components
All RAG systems rely on these essential elements:
| Component | What it does | What to get right |
|---|---|---|
| Knowledge source | Holds the raw documents and records the application queries | Continuous freshness pipelines, clear ownership, and granular permissions |
| Ingestion and chunking | See Step 1. | Accurate parsing of tabular layouts; optimal chunk sizing and overlap thresholds |
| Embedding model | See Step 2. | Mandating the same model for both documents and queries; re-embedding when the model shifts |
| Vector store and index | See Step 2. | High-concurrency scale, rapid metadata filtering, and keeping vectors tightly bound to governed data |
| Retriever and reranker | See Step 3. | Tuning hybrid (semantic plus keyword) search weights; restricting the top-K limit |
| Generator (LLM) | See Step 4. | Hardening system prompts to enforce context boundaries and mandatory citations |
| Orchestration and evaluation | Chains the pipeline steps, logs telemetry, and continuously scores output quality | End-to-end lineage tracing from answer back to source; automated regression benchmarks |
RAG vs. fine-tuning vs. long context windows
Three common ways to give a model knowledge it lacks are RAG, fine-tuning (retraining the model on additional examples), and placing whole documents into a long context window. Simpler techniques such as prompt engineering come first, and the three options below are often combined.
| Dimension | RAG | Fine-tuning | Long context window |
|---|---|---|---|
| What changes | The information supplied with each prompt | The model’s weights | The amount of text supplied with each prompt |
| Best for | Facts that change or are private, such as policies, products, records | New behavior, tone, format, or domain vocabulary | Reasoning over a handful of known documents |
| Keeping knowledge current | Update the index; no retraining | Retrain to change behavior; new facts need new training | Resend the documents on every request |
| Cost profile | Retrieval infrastructure plus short prompts | Training compute and repeat runs | Large prompts on every call |
| Traceability | Answers can cite retrieved sources | Knowledge is blended into the weights | Sources are known but citation is not built in |
| Access control | Can filter what each user retrieves | Anything trained in is visible to every user | Limited to what the caller includes |
A practical rule: use RAG when the model needs to know something, and fine-tuning when it needs to behave differently. Many teams start with RAG because it avoids training costs, then fine-tune a model for format or terminology and keep RAG for the facts.
When to use RAG (and when not to)
Common enterprise use cases
RAG fits any application where people ask questions in natural language and the answer lives in documents or data the model has not seen.
- Customer support: Assistants answer from current product documentation, policies and past tickets, and show agents the source.
- Enterprise search and knowledge assistants: Employees ask questions across wikis, HR policies, and project files instead of hunting for documents.
- Regulated and technical domains: Work such as claims processing, compliance review, contract analysis, and engineering manuals needs every answer to trace to a source.
- Analytics and decision support: Applications combine retrieved documents with structured records, such as a customer’s complaints alongside their account history.
Where RAG falls short
- Retrieval failures: The search step can return the wrong passages, so the model produces a confident, wrong answer; many RAG errors start here.
- Remaining hallucinations: Grounding reduces hallucinations, but benchmark studies show models still add unsupported details or contradict the context.
- Added latency and cost: Every question adds embedding, search, and reranking steps, plus longer prompts, which raises latency and cost.
- Aggregation questions: Questions such as “What was revenue by region last quarter?” are queries over structured data, not searches over text; RAG works best alongside SQL or tool calls.
- Stale or overshared content: An index built from outdated or overshared documents spreads stale or ungoverned content faster.
Types of RAG: from basic retrieval to agentic RAG and GraphRAG
The standard four-step pipeline is widely categorized as basic or naive RAG. Most production systems extend it in one or more of the ways below.
Agentic RAG
Agentic RAG lets an autonomous AI agent decide when and how to retrieve data, route queries across several indexes, and reformulate its search when the retrieved context is weak, at the cost of more model calls and higher latency. The Model Context Protocol (MCP) is one way agents connect to the data sources and tools they retrieve from.
GraphRAG
GraphRAG traverses explicit entity relationships inside a knowledge graph—mapping nodes like customers, supply chains, and legal contracts—instead of relying purely on floating text chunks. Following explicit relationships helps with multi-hop questions that chunk similarity misses, such as “Which tier-1 suppliers of this specific widget also provision our largest competitor?” GraphRAG depends on well-defined entities and a consistent semantic layer to ensure retrieval accuracy.
How to evaluate and govern a RAG system
Measure retrieval and generation separately
Score the retrieval and generation phases independently to isolate prompt errors from search failures. Common metrics include:
- Context relevance: Whether the retrieved passages are about the question.
- Faithfulness or groundedness: Whether every claim in the answer is supported by the retrieved passages.
- Answer relevance and completeness: Whether the answer addresses what was asked.
- Context utilization: Whether the model uses the right passages or ignores them.
Build a test set of real questions with known answers and sources, and run it after every change to chunking, embeddings, prompts, or models.
Carry access controls into retrieval
The fastest way to leak data with RAG is to index everything and let every user retrieve it. Store permissions with each chunk and filter at query time, so users retrieve only what they could already open. Track lineage from each answer back to its source document and version, and set retention rules for the index as well as the originals. With sound AI governance in place, RAG can support privacy compliance. The data stays in a governed store instead of being trained into a model. Germany’s data protection authorities have concluded that RAG can have a positive effect on privacy compliance.
Bringing RAG to governed enterprise data
Most RAG architectures copy documents and embeddings into a separate vector database. That creates another store to secure, sync, and govern.
Teradata Enterprise Vector Store takes a different approach. It keeps vectors in the same governed database as the structured data they relate to—across cloud, on-premises and hybrid deployments. Hybrid and fusion search can then retrieve across tables and documents together, so an answer can draw on a contract and the customer’s account record in one step. Teams can work in Python, SQL or LangChain, and bring their own LLM, including open-weight models, so the generator runs under the same governance as the data.
Overall, RAG is only as trustworthy as the data it retrieves. See how the Teradata Autonomous Knowledge Platform grounds generative AI and AI agents in governed enterprise data.
Frequently asked questions
RAG nécessite-t-il une base de données vectorielle distincte ?
RAG nécessite-t-il une base de données vectorielle distincte ?
Pas nécessairement. RAG a besoin d’un magasin capable de vectoriel qui indexe les embeddings avec leur texte et métadonnées de blocs tels que la source, les horodatages et les permissions d’accès. De nombreuses architectures copient les documents et les embeddings dans une base de données vectorielle distincte, qui ajoute un autre magasin pour sécuriser, synchroniser et gouverner. Conserver les vecteurs dans la même base de données gouvernée que les données structurées associées évite cette copie.
Quelle est la différence entre RAG et un LLM ?
Quelle est la différence entre RAG et un LLM ?
Un LLM est le modèle qui génère du texte. RAG est une technique qui fournit au LLM les informations récupérées à chaque question et laisse le modèle lui-même inchangé.
RAG est-il encore pertinent pour les modèles à long contexte ?
RAG est-il encore pertinent pour les modèles à long contexte ?
Oui. Les entreprises contiennent souvent plus de contenu qu’une fenêtre de contexte ne peut en prendre, donc la récupération doit toujours sélectionner ce qui compte. De nombreuses équipes considèrent désormais RAG comme faisant partie intégrante de l’ingénierie contextuelle plus large.
Qu’est-ce que RAG vs. IA générative ?
Qu’est-ce que RAG vs. IA générative ?
L’IA générative est la grande catégorie de modèles qui créent du texte, des images ou du code. Dans une application RAG, un tel modèle répond à partir de passages récupérés, ce qui rend la sortie plus précise et vérifiable pour des domaines spécifiques.
Comment sécuriser un système RAG d’entreprise ?
Comment sécuriser un système RAG d’entreprise ?
Appliquez les contrôles d’accès au moment de la récupération. Étiquetez chaque bloc avec ceux qui peuvent le lire, filtrez les résultats selon les autorisations de la personne demandant, et appliquez les règles de lignée et de rétention à l’index ainsi qu’aux originaux.