Retrieval-Augmented Generation (RAG)

A technique that lets an AI model look up relevant information from your own documents or databases before answering, so responses are grounded in your data.

Also known as: RAG

Related terms in this glossary

Retrieval-Augmented Generation (RAG) in depth

How a RAG system works, step by step

RAG has two halves: preparing your knowledge so it can be searched, and using it at question time.

Indexing (done ahead of time):

  1. Collect sources: PDFs, wiki pages, help articles, tickets, database records.
  2. Extract clean text, including tables, using OCR for scans.
  3. Split into passages through chunking, keeping headings and metadata such as source, date and access group.
  4. Convert each passage to embeddings and store them in a vector database, often alongside a keyword index.

Answering (at request time):

  1. Rewrite the user's question if needed, for example to resolve "it" from earlier turns.
  2. Retrieve candidates with hybrid search, filtered to what this user may see.
  3. Apply reranking and keep the best few passages.
  4. Ask the LLM to answer only from those passages and cite them.
  5. Return the answer with links to sources, or say the information is not available.

Example: a dealer support assistant

Example: an equipment manufacturer's dealers ask about warranty terms, spare part numbers and service procedures, in English and Hindi. Manuals, bulletins and the warranty policy are indexed, each passage tagged with product line and validity dates. When a dealer asks whether a pump model's seal is covered after 14 months, the assistant retrieves the current warranty clause and the model's bulletin, answers with the relevant clause cited, and notes any condition, such as proof of installation date. If the documents do not cover the question, it says so and offers to raise a ticket. Superseded bulletins are excluded by date filters, so old answers do not resurface.

Evaluating RAG

Evaluate retrieval and generation separately, then together:

LayerMeasures
RetrievalRecall at k: is the right passage retrieved for each test question?
GenerationFaithfulness: is every claim supported by the passages? Relevance: does it answer the question?
End to endCorrect, complete answers on a labeled question set; correct "not found" responses
OperationsLatency, tokens per answer, index freshness

Build the question set from real user questions, including ones the documents cannot answer. Faithfulness can be scored at scale with an LLM judge validated against people. Our document Q&A tool shows grounded answers with sources on sample files.

Common mistakes

  • Ignoring permissions, so the assistant shows content a user could not open directly.
  • Poor text extraction from PDFs and tables, which no model can fix later.
  • Stale indexes after documents change, and no date or version metadata.
  • Only vector search, which misses part numbers and codes that keyword search finds.
  • No "I don't know" path, which pushes the model toward hallucination.

RAG versus fine-tuning, and what comes next

RAG supplies facts at request time and keeps them current; fine-tuning changes behavior, style or format. Most knowledge assistants need RAG, and some add fine-tuning later. Variants include agentic RAG, where an agent decides which sources to search and when, and graph-based retrieval using a knowledge graph. RAG is the main technique behind grounding. Gepton builds RAG systems in AI-powered search and knowledge management agents; see also the knowledge management solution.

Questions about Retrieval-Augmented Generation (RAG)

Something else? Send us your question and an engineer replies with next steps.

Does RAG stop an AI model from making things up?

It reduces the problem but does not remove it. With the right passages in front of it and instructions to answer only from them, a model is far less likely to invent facts, and citations let users check. It can still misread a passage, combine facts wrongly or answer when retrieval failed. Measure faithfulness on a test set, show sources with every answer, and make sure the system can say the information was not found.

How do we keep a RAG index up to date?

Connect indexing to the systems where documents live, so additions, edits and deletions trigger re-indexing automatically, through webhooks or scheduled syncs. Store a version or modified date with each passage and filter out superseded content. Deletions matter as much as additions: removed documents must disappear from the index, especially when they contain personal data. Monitor index freshness as an operational metric alongside answer quality.

Can RAG work with documents in Hindi and English together?

Yes, with the right components. Use a multilingual embedding model so a Hindi question can find an English passage and the reverse, and test it on real queries in both languages, including romanized Hindi. Keyword search may need transliteration handling. The answering model should reply in the user's language while citing the source passage in its original language. Evaluate retrieval separately for each language, since quality often differs.

Articles that mention Retrieval-Augmented Generation (RAG)

All articles

Jump to

↑↓ to move↵ to open