Skip to content

RAG

RAG explained: answers grounded in your own documents

A language model knows a lot about the world and nothing about your business. Retrieval-augmented generation, usually called RAG, is the standard way to close that gap without retraining a model.

By the Vertex Bytes team5 min read

The idea in one paragraph

Instead of asking the model to answer from memory, a RAG system first searches your own content, such as manuals, policies, tickets and product data, finds the passages most relevant to the question, and gives them to the model together with the question. The model then writes an answer based on those passages and can point to where each part came from.

The pieces of a RAG system

  1. Ingestion: collect documents from your systems and split them into sensible chunks, keeping titles, dates and permissions.
  2. Embeddings: turn each chunk into a vector, a list of numbers that captures its meaning, so similar ideas sit close together.
  3. Retrieval: store vectors in a vector database or a search index, and combine meaning-based search with keyword search for better recall.
  4. Re-ranking: reorder the candidates so the best passages come first.
  5. Generation: the model writes the answer from the retrieved passages and cites them.

Why RAG instead of fine-tuning

Fine-tuning changes how a model behaves; it is a poor way to teach it facts that change. With RAG, updating the knowledge means updating the documents. Answers can show sources, and you can control who may see what by filtering on permissions at retrieval time.

Where RAG systems fail

  • Poor chunking: passages cut in the wrong place lose their meaning.
  • Stale or duplicated content: the system faithfully retrieves outdated answers.
  • Missing permissions: users see snippets from documents they should not access.
  • No evaluation: nobody measures whether the right passage is retrieved or whether the answer is faithful to it.

Related service

AI & Machine Learning

Practical AI built into your products and operations.

Learn more

Building with AI?

Tell us what you want to automate or build. We will respond with a clear plan and an honest estimate.