LanguageENES
RetrievalSep 10, 2026 · 7 min read

What is RAG? Retrieval-augmented generation explained

A language model does not know your refund policy. RAG is how it reads your documents at the moment of the question, and answers from what it read.

Hernan MoyaCo-Founder
Four retrieved passages ranked by score, the strongest at 0.71 and the weakest at 0.35
Four retrieved passages ranked by score, the strongest at 0.71 and the weakest at 0.35

A language model does not know your refund policy. It was trained on public text months before anyone asked, and your documentation was not in it.

RAG is how you close that gap without retraining anything. The model reads your documents at the moment of the question, then answers from what it read.

The four steps, every time

Retrieval-augmented generation is two words describing two halves. Retrieval finds the relevant passages; generation writes the answer using them. Nothing is memorised in between.

Step through one question below and watch what the model has, and has not, been given at each stage.

InteractiveStep through one question

The fourth step is the one that surprises people. The model is not recalling your policy; it is reading a passage of it that arrived half a second ago, the way you would read a page someone slid across the table.

Why the documents are cut up first

Before any of this, your documents are split into passages and each passage is turned into a vector. That vector is a position in a space where things that mean similar things sit near each other.

This is why a question phrased nothing like your documentation still finds it. "Can I send this back?" and "Returns are accepted within 30 days" share no useful words, and they land close together anyway.

Why not just paste everything into the prompt

The obvious alternative is to skip retrieval and hand the model your whole help centre. Three things go wrong.

Problem
What happens
It does not fit
A mid-sized help centre runs to hundreds of thousands of tokens; context windows are large now, but not that large, and not for free
It costs on every question
You pay for input tokens each time somebody asks, so a full dump makes the cheapest question as expensive as the hardest one
Accuracy drops
A model given forty pages finds the answer less reliably than one given the four passages that matter

The third is the counterintuitive one. More context is not more accuracy. Retrieval is a filter, and the filter is what makes the answer specific.

What RAG is not

Three things get confused with it constantly, and each changes something different.

Approach
What it changes
When it fits
RAG
What the model can read at answer time
Facts that change, and must be current and citable
Fine-tuning
How the model writes, its format and tone
A consistent output shape or a house style
Training
The base model itself
Not something a company does to add its own policy
Chat memory
What it recalls of this conversation
Continuity within a session, not company knowledge

Fine-tuning a model on your help centre is the expensive way to get a worse result: the facts get baked in, so updating one means training again, and the model cannot tell you which page an answer came from.

Citations come free, and that is the point

Because the passages are known before the answer is written, the system can show them. That turns an answer from a claim into something checkable.

The sources are not a footnote. They are the passages the answer was written from.

It also gives you a repair path. When an answer is wrong you can read the passage behind it and tell immediately whether the document is wrong or the retrieval missed.

Where it breaks

RAG fails at retrieval far more often than at generation. If the right passage never reaches the model, no amount of prompting saves the answer.

The usual causes are passages cut at the wrong size, documents that contradict each other, and content that was never written down. All three are fixable, and none of them are model problems.

welcomeai.devHow to fix bad retrieval scores by changing chunk size

What a working setup needs

  1. Somewhere to keep the documents, and a way to keep them current
  2. An embedding model, used identically for documents and questions
  3. A vector index that can be searched fast enough to sit in a request
  4. A retrieval step that returns passages with scores you can read
  5. A model instructed to answer from those passages, and to say so when they do not cover the question

The fifth line is what separates a system that says "I don't know" from one that invents an answer.

Questions people ask

If you are deciding whether RAG fits, the question is not technical. It is whether the answers you need depend on documents that change, and whether the person reading them needs to see where each one came from.

Taggedragretrievalembeddingsknowledge-basecitations
Written byHernan Moya

Keep reading