Skip to content
← All guides

Knowledge architecture / Guide

What is RAG? Retrieval-augmented generation with a worked example

Follow a source from retrieval to an AI answer. Inspect a worked example, citation limits and a practical review worksheet.

A curved library wall lined with books.
Photography by Patrik Göthe / Unsplash

The short answer

RAG supplies retrieved evidence to a model before it answers.

Separate retrieval results from generated claims.

What does RAG add to an AI answer?

Retrieval-augmented generation, or RAG, retrieves external material and supplies it to a model before the model answers. The retrieved material can contain facts that were absent from the model's training or changed afterwards.

The retrieval step selects evidence. The generation step interprets that evidence and writes a response. Either step can fail, so keep them distinguishable when you test a system.

The original RAG paper combines a retriever with a generative model for knowledge-intensive tasks. Its particular architecture and results do not describe every product now called RAG.

Follow a source from document to answer

Suppose your project folder contains a fictional schedule:

The Monday schedule sets the inspection for 18 October.

You ask, "When is the inspection in the Monday schedule?" The system retrieves the schedule passage. It supplies the passage and your question to the model, which can answer with the date and source.

StageInputOutput to inspect
PrepareOriginal schedule.A searchable passage with its source location.
RetrieveYour question.The selected schedule passage.
GenerateQuestion and selected passage.An answer that preserves the source's meaning.
ReviewAnswer and citation.Supported claims and any missing evidence.

This pipeline is a conceptual explanation. It does not claim that the model-generated answer was executed in our local component test.

Inspect the part we ran

Our connected-source demonstration used Gigabrain's local memory service, hybrid retrieval and graph expansion. It returned the schedule passage from a fictional project set.

After the disposable schedule changed to 25 October, its old citation failed verification. Refreshed retrieval returned the new passage. We reproduced that behavior against the System and Full 1.1.0 archives.

Open the recorded result. It contains retrieved quotations, not a benchmark of a model's generated answers. The distinction matters when deciding what the experiment proves.

Understand what RAG does not fix

RAG can retrieve an outdated document, miss a qualifier or select a passage about the wrong project. A model can also misread a correctly retrieved passage.

Ask how long the supplier's warranty lasts. The schedule cannot answer that question. Returning a related passage does not create the missing warranty term.

Our retrieval comparison includes that kind of failure: every tested mode returned passages for an unsupported question. Citation matching and answer support require separate checks.

Choose how to retrieve the material

Keyword search helps with exact identifiers. Vector search helps compare meaning. A graph can connect facts across source documents. These are retrieval choices within the larger workflow.

Begin with direct retrieval for questions that resolve to one clear passage. Read the GraphRAG guide when recurring questions need relationship paths.

Preserve document identity when you choose chunk boundaries. A passage separated from its heading or exception can become misleading.

Try a small RAG review

  1. Select one source with a known answer.
  2. Write one answerable question.
  3. Write one question the source cannot answer.
  4. Save the retrieved passages.
  5. Compare each generated claim with those passages.
  6. Repeat after adding a dated amendment.

Use the source-to-answer worksheet to separate retrieval results from generated claims. Continue with the citation review.

For Gigabrain, check your agent's integration before choosing a package.

Method note: Gigabrain Labs prepared this guide with AI assistance. The example uses fictional data and preserves the measured limits of the linked demonstration.

About this publication

Gigabrain Labs publishes practical guidance for people using file-capable AI agents. Our guides explain the product and link to supporting tests. We label practice exercises separately from recorded results.

About Gigabrain ↗
One complete system

Get Gigabrain.

Give your AI agent persistent, source-linked knowledge from the files you already own.

Gigabrain System
Complete core system

$79 once

The complete knowledge and memory system for your AI agent.

Try Gigabrain
7-day money-back guaranteeNot satisfied? Request a full System refund within seven days of delivery.
  • Persistent, source-linked memory
  • Semantic and lexical retrieval
  • Connected knowledge graph
  • Guided agent setup
  • Tools for building your own workflows
  • Twelve months of core updates

One-time purchase · No coding required · Knowledge stored locally · Model accounts and usage fees are separate

Gigabrain

Gigabrain System 1.1.0

Your context, ready for the next conversation.Keep your files, decisions and previous work ready for your AI.

7-day money-back guarantee

Not satisfied? Request a full System refund within seven days of delivery.

  • Keep every conversation connectedYour AI starts with the decisions and work already done.
  • Set up with a guided walkthroughStart your first project with clear, practical steps.
  • 12 months of core updatesKeep your system current as your work develops.
  • Your licence and download linkSet up on your computer. Keep your files local.

One payment. Yours to keep. No subscription.

Your AI agent and model usage fees are separate.

Secure checkout

Stripe handles your payment details. Your final total, including any tax, appears in the payment form before you pay.

Preparing secure checkout.