Retrieval-Augmented Generation (RAG)
An AI architecture where a model retrieves relevant documents from a trusted knowledge base at question time and answers from them, instead of relying on whatever it memorized in training.
Why it matters
Plain language models guess plausibly, which is fatal for business use: stale product facts, invented prices, confident nonsense. RAG matters because it grounds answers in your actual, current content, makes them citable, and lets knowledge update by updating documents rather than retraining or rewriting prompts.
How it works
Content is split into chunks and indexed (lexically, as vectors, or both). At question time the system retrieves the most relevant chunks, injects them into the model's context with instructions to answer only from them, and ideally returns the sources used. Quality hinges on retrieval: good chunking, fresh indexing, and honest fallbacks when nothing relevant exists.
A real-world example
A company chatbot once pitched a retired product for weeks because its knowledge lived in a hardcoded prompt nobody updated. Rebuilt as RAG over the live website, the bot now learns every new page automatically at the next crawl and cites the page it answered from. Ship content, and the bot is current, no prompt edits.
Common mistakes
- ✗ Indexing everything, including private documents, into a bot exposed to the public
- ✗ Letting the model answer from general knowledge when retrieval finds nothing, hello hallucinations
- ✗ Never refreshing the index, recreating the stale-prompt problem with extra steps
- ✗ Skipping source citation, which removes the user's ability to verify
Best practices
- ✓ Index only content the audience is entitled to see; public bot, public content
- ✓ Instruct the model to say 'I do not have that' when retrieval is empty, and escalate to a human
- ✓ Automate index refresh from the source of truth
- ✓ Show sources with answers; verifiability builds trust and catches errors
Frequently asked questions
Does RAG eliminate hallucinations?
It reduces them sharply when paired with strict grounding rules and honest empty-retrieval behavior. Discipline in the prompt and architecture matters as much as retrieval itself.
Do I need a vector database?
Not always. Small, well-structured corpora often do excellently with lexical retrieval plus query expansion; vectors earn their complexity as scale and ambiguity grow.
Is RAG secure by default?
No. Retrieved content is untrusted input (see prompt injection), and the index defines what can leak. Security comes from what you index and how the model is constrained.
Aira, the consultant on this site, is RAG over aegibit.com itself: it auto-learns every published page weekly and cites sources under its answers.
Ask Aira anything about AEGIBIT →