What is RAG (retrieval-augmented generation)?
RAG (retrieval-augmented generation) is an architecture that, before letting a language model answer, goes and fetches the relevant documents and provides them to the model as the context of its answer. The model no longer answers from its internal memory alone, the one it acquired during training, but from a text retrieved at the moment of the request. Knowledge thus stays outside the model, in a corpus that the organisation controls and keeps up to date.
This separation is the heart of RAG. A small language model (SLM), a compact model of 3 to 20 billion parameters in the vocabulary adopted on this site, does not have to remember everything: it reasons over the documents presented to it. The organisation's knowledge lives in the corpus, not in the model's weights, which makes it controllable and updatable without retraining.
How does RAG anchor a small language model on documents?
RAG anchors a small language model in four steps, executed at each request. Each step serves a precise function, and the whole thing stays within the organisation's environment.
Index.
The documents are cut into fragments and converted into vectors, that is, numerical representations that bring texts of similar meaning closer together. Together they form a searchable index.
Source.
At the request, the system retrieves the fragments closest to the expressed need, not the entire corpus.
Compose.
These fragments are provided to the model as context, along with the request, so that it answers from them.
Cite.
The answer points back to the fragments used, which makes each claim verifiable at the source.
This chain makes the model a reasoner over provided documents, not a source of memory. It also makes it possible to score the answer by the quality of the anchoring, and to move it forward by correcting the corpus when a source is missing.
Why is RAG particularly well suited to a small language model?
RAG is particularly well suited to a small language model because it compensates for a compact model's main constraint: an internal memory more limited than that of a large language model (LLM), a massive model. By moving knowledge into an external corpus, RAG makes this limit irrelevant for tasks anchored on documents.
The fit between the two rests on sovereignty and freshness. The compact model runs on a controlled infrastructure, and the corpus stays within the organisation's environment, so that inference, that is, the production of each answer, requires no data export. On the Optivalue.ai platform, which publishes this site, retrieval-augmented generation runs with 0 data used outside the customer's environment. The corpus is updated without touching the model, which keeps the answers current.
RAG or fine-tuning: which to choose to specialise a small model?
RAG and fine-tuning answer two distinct needs, and often combine. Fine-tuning, targeted retraining of the model on proprietary data, inscribes a vocabulary and turns of phrase into the model itself; RAG keeps the knowledge outside and anchors it on demand. The table below contrasts what each approach brings and what it requires.
| Attribute | RAG (retrieval-augmented generation) | Fine-tuning (targeted retraining) |
|---|---|---|
| Where knowledge lives | in a controlled external corpus | in the model's weights |
| Update | corpus changed, model unchanged | a new retraining run needed |
| Traceability of the source | answer citable on the page | no native citation |
| What the approach requires | an index and clean documents | training data and compute |
The concession that clarifies everything: where RAG brings nothing
RAG brings nothing when the task rests on no reference document: rephrasing a text, producing a draft, exploring open ideas. In these cases, a simple instruction framing, or even a consumer generative AI, delivers the expected service without the infrastructure of a document index.
Recognising this limit is what makes RAG useful where it counts. The dividing line rests on the nature of the expected answer: as soon as it must draw on precise knowledge and remain verifiable at the source, document anchoring becomes the condition of reliability, not an optional refinement.
How to set up a reliable RAG on a small model?
Setting up a reliable RAG follows a procedure, because the quality of the answer depends first on the quality of the anchoring. The quality of the corpus is qualified on criteria that the ISO/IEC 25012:2008 standard, a data quality model, lists: accuracy, completeness, consistency and currentness of the documents provided to the model. The steps below are read in order.
- Prepare the corpus. Gather up-to-date, reliable documents, because a wrong source produces a wrong answer.
- Chunk carefully. Fragment the documents so as to preserve the meaning of each retrieved passage.
- Control retrieval. Check that the fragments brought back actually meet the need, and adjust the index otherwise.
- Require citation. Insist that each claim point back to its source, to make the answer auditable.
- Maintain the corpus. Correct and enrich the documents through feedback, to move reliability forward over time.
Frequently asked questions
Does RAG replace fine-tuning?
RAG does not replace fine-tuning: it keeps knowledge outside the model and anchors it on demand, whereas fine-tuning inscribes a vocabulary into the model. The two often combine, RAG for shifting, sourceable knowledge, fine-tuning for the stable terminology of a business domain.
Does RAG let a small model cite its sources?
RAG lets a small model cite its sources, because each answer points back to the document fragments retrieved to produce it. This traceability is decisive for any compliance task, where a claim without a source remains unusable.
Does RAG expose the organisation's data?
RAG does not expose the organisation's data when it runs in a controlled environment: the index and the corpus stay on the organisation's infrastructure, and inference exports nothing. The sovereignty of the arrangement is verified on the architecture that hosts it.
Does a small model with RAG rival a large model without RAG?
On a task anchored on documents, a small model with RAG handles a clear scope with sourced answers, where a large model without anchoring answers from memory, with no citation. The comparison depends on the task: RAG shifts the advantage towards anchoring rather than towards size alone.
Do you need a particular model to do RAG?
RAG does not require a particular model: it works with a small model as with a large one. A compact model gains more from it, because RAG compensates for its more limited internal memory while remaining deployable on a controlled infrastructure.