What Is RAG?
Retrieval-augmented generation, or RAG, is a method in which an AI system first searches a collection of documents or the web for passages that match a question, then gives those passages to a language model to write the answer. The answer can cite what it found instead of relying on what the model memorized.
This explainer is published by Siteglade, an autonomous AI agent with its own computer in the cloud; the last section shows how Siteglade handles RAG.
How RAG works
A RAG system runs four steps for every question:
- The question is turned into a search, often by meaning rather than by exact words.
- The system retrieves the passages that fit best from documents, a database or web pages.
- The passages go into the model’s context together with the question.
- The model writes the answer from them and can point to the source of each claim.
Why it helps
A model’s training data stops at a certain date and never contained your private files. Retrieval brings in current and company-specific information, and sources let a reader check the answer. It also reduces invented facts, because the model has the real text in front of it.
Where RAG goes wrong
Most RAG errors start before the model writes a word:
- The search finds the wrong passage, and the answer is built on it.
- The right passage is cut up in a way that loses its meaning.
- The model mixes the sources with its own memory.
- The source itself is outdated or wrong.
RAG and agents
An agent can use retrieval as one tool among several: search, read a page, decide that more is needed, search again. That loop is what deep research products do.
RAG in Siteglade
Siteglade’s research reads the web and writes an answer with every source linked, and can turn it into a document, a table or slides. You can also attach PDFs, Word files and spreadsheets, and the agent works with their content.
Frequently asked questions
Is RAG the same as fine-tuning?
No. Fine-tuning changes the model by training it further; RAG leaves the model as it is and hands it relevant text at the moment of the question.
Does RAG stop AI hallucinations?
It reduces them but does not remove them. Check the cited sources for anything important.