Guide · Agentic RAG

RAG vs fine-tuning: change what the model reads, or change the model.

Retrieval adds knowledge at question time and can cite it. Fine-tuning changes the model’s weights and is best at shaping how it behaves.

Teams often reach for fine-tuning to teach a model their documents — the job retrieval does better — and overlook it for the job it does well: holding a format, a tone or a narrow task. This guide shows what each technique changes, what controlled studies found, how the costs play out over a system’s life, and a decision tree that starts from the problem you actually have.

Updated · 6 sources

change the input

RAG

Retrieval augmented generation searches your sources at question time and puts the relevant passages in the prompt.

  • Knowledge lives outside the model
  • A new document is searchable once indexed
  • Answers can cite the passage used
  • Access rules can apply per person
change the weights

Fine-tuning

Further training on your examples adjusts the model itself, so it responds in a new way without being told each time.

  • Behaviour lives inside the model
  • Changing it means training again
  • No record of where a fact came from
  • One model serves everyone who uses it
Facts, documents, fast-changing knowledgeBest atFormat, tone, task skill, a smaller model
An indexing pipelineUpfront workA labelled training set and training runs
Re-index one documentUpdate a factRetrain, or live with the old answer
Yes, to the pageShow the sourceNo
Longer prompts with passagesPer-call costShorter prompts; possibly a smaller model

What is the difference between RAG and fine-tuning?

RAG (retrieval augmented generation) leaves the model unchanged and gives it relevant passages from your sources with each question. Fine-tuning trains the model further on your examples so its weights change. In RAG vs fine-tuning, the rule of thumb is: retrieval for knowledge that must be current, cited and permissioned; fine-tuning for behaviour — format, tone, a narrow task — that prompting cannot hold. Many systems use both.

Mechanics

Where RAG and fine-tuning act on a model call.

Every answer a model gives is shaped by four things, top to bottom. Prompt engineering and RAG work on the upper layers at question time; fine-tuning rewrites the bottom one ahead of time.

What shapes one answer
01
InstructionsThe system prompt: role, rules, output format, examples.
prompt engineering
02
Retrieved contextPassages, records and facts fetched for this question.
RAGagentic RAG
03
The questionWhat the person asked, plus the conversation so far.
user input
04
Model weightsWhat the model learned in pre-training, and anything trained in since.
fine-tuningLoRARAFT

Parametric and non-parametric memory. The 2020 paper that introduced RAG framed it exactly this way: a model’s weights are parametric memory, an external searchable index is non-parametric memory, and RAG combines the two. Fine-tuning writes to the first; retrieval reads from the second.

Evidence

What controlled studies found about RAG vs fine-tuning.

Two Microsoft research papers from 2023 and 2024 tested the question directly, and an earlier one explains why fine-tuning became cheap enough to try.

RAG > FT
for injecting knowledge: retrieval “consistently outperforms” unsupervised fine-tuning, for facts seen in training and for new ones
Ovadia et al. (2023), Fine-Tuning or Retrieval?
+6 / +5 pp
accuracy from fine-tuning, then a further gain from adding RAG on top, in an agriculture question-answering study
Balaguer et al. (2024), RAG vs Fine-tuning
10,000×
fewer trainable parameters with LoRA than full fine-tuning of GPT-3 175B, with 3× less GPU memory and no added latency
Hu et al. (2021), LoRA

The pattern across studies: fine-tuning is a weak way to add facts — Ovadia and colleagues found models learned new facts better when training showed many variations of the same fact — but a good way to adapt a model to a domain’s language and tasks. The agriculture study found the two gains add up, which is why the decision is rarely either-or.

Decision guide

RAG vs fine-tuning: a decision tree that starts from the problem.

Name what is wrong with today’s answers before choosing a technique. Each symptom points to a different fix — and the first fix is almost always a better prompt.

What is wrong with the answers today?

Facts missing, stale or privateRAG. Index the sources, retrieve per question, cite the passage. Updating a fact is re-indexing a document.
Right facts, wrong format or toneBetter instructions and examples first. If the model still drifts across thousands of calls, fine-tune on examples of the output you want.
Good answers, too expensive at volumeFine-tune a smaller model on the large model’s good outputs for that one narrow task, and prove it on an evaluation set.
Retrieval works, but the model misuses passagesCombine them: retrieval-aware fine-tuning such as RAFT teaches the model to ignore distractor passages and quote the right one.
Changed at question timeTrained into the weights
12345
  1. Prompt engineeringInstructions and examples; minutes to change.
  2. RAG and agentic RAGPassages from an index, chosen per question; as current as the index.
  3. RAFTFine-tuning that teaches the model to use retrieved passages.
  4. LoRA and other adaptersA small set of trained weights added to a frozen model.
  5. Full fine-tuningEvery weight updated; the heaviest to train and to redo.
Cost and change

What RAG and fine-tuning cost over the life of a system.

The first version is the cheap part. The difference shows when a policy changes, a person leaves, an auditor asks for a source, or the base model is retired.

With RAG

  • A policy changesReplace the document; the next answer uses it.
  • Someone may not see a fileFilter retrieval by their permissions.
  • An auditor asks whyShow the cited passage and page.
  • A document must be deletedRemove it from the index.
  • A better model shipsPoint the system at it; the index stays.

With fine-tuning

  • A policy changesThe old answer stays in the weights until you retrain.
  • Someone may not see a factEveryone using the model can draw on what it learned.
  • An auditor asks whyThere is no record of which example taught it.
  • Training data must be deletedRetrain without it.
  • A better model shipsRebuild the training run on the new base model.

Fine-tuned models follow their base model. OpenAI’s model-optimization guide states that fine-tuned models stay available for inference until their base models are deprecated — so a fine-tune is a recurring project tied to the provider’s model schedule, rather than a one-off cost.

Combined

Combining RAG and fine-tuning with retrieval-aware training.

RAFT (retrieval augmented fine-tuning, 2024) trains a model in the “open book” setting it will face in production: a question, some passages that help and some that do not, and an answer that quotes the right one.

  1. Collect questions

    Real questions from your domain, each with the document that answers it.

    dataset
  2. Add distractors

    Pair each question with passages that look relevant but do not answer it.

    distractors
  3. Write cited answers

    Target answers quote the supporting passage verbatim.

    citations
  4. Fine-tune

    Often with an adapter such as LoRA, so training stays affordable.

    LoRA
  5. Deploy with retrieval

    The tuned model reads live retrieved passages; facts still come from the index.

    RAG
  6. Evaluate both ways

    Score against the untuned model with the same retrieval, on the same questions.

    evals
On Botminds

How Botminds keeps knowledge in retrieval and models swappable.

On Botminds, enterprise knowledge lives in knowledge collections that agents search — so it stays current, permissioned and citable — and the model behind each agent is a setting.

What the platform does for knowledge
  • Indexing with no pipeline to wireEvery document added to a knowledge collection is cut into passages, embedded with your chosen embedding model and indexed.
  • Updates without stale answersEach pass over a document is numbered and only the newest counts, while the rest of the library keeps answering.
  • Permissions inside every searchThe asker’s read rules apply to each search, so nothing outside them reaches the model.
  • Answers cited to the pageThe passages the answer relied on are the sources shown.
  • Any model, one settingAzure OpenAI and Azure AI Foundry deployments, Google Gemini, and models added to the gateway’s model list — including models you host.
  • Choices provenModel choices per agent are backed by evaluations.

Read agentic RAG and the LLM gateway, and see indexing in the Academy lesson search indexes and vectorization.

Questions people ask

RAG vs fine-tuning: common questions.

The technology behind itAgentic RAGEvery way to search, at any scale
RAG vs fine-tuning: which is better?

Neither in general. In RAG vs fine-tuning, RAG is better for knowledge — facts that change, must be cited or are restricted by person. Fine-tuning is better for behaviour — output format, tone, a narrow task, or moving that task to a smaller model. Studies find the gains from each can add up.

When should you use fine-tuning instead of RAG?

When the problem is how the model responds rather than what it knows: a strict output format it keeps breaking, a house style, a specialised classification, or a high-volume task you want a smaller, cheaper model to handle. Try better instructions and examples first.

Can fine-tuning teach a model new facts?

Poorly. A 2023 Microsoft study found RAG consistently outperformed unsupervised fine-tuning for knowledge, and that models learned new facts better when training showed many variations of each fact. Fine-tuned facts also cannot be cited or updated without retraining.

What about RAG vs fine-tuning vs prompt engineering?

Prompt engineering changes the instructions, RAG changes the context, fine-tuning changes the weights. Start with the prompt, add retrieval when the model lacks knowledge, and fine-tune only when behaviour still falls short at volume.

What is LoRA?

Low-Rank Adaptation trains a small set of extra weights beside a frozen model instead of updating every weight. Its authors report 10,000 times fewer trainable parameters and 3 times less GPU memory than full fine-tuning of GPT-3 175B, with no added inference latency.

Is RAG cheaper than fine-tuning?

Upfront, usually: RAG needs an indexing pipeline, fine-tuning needs labelled data and training runs. Per call, RAG prompts are longer because they carry passages. Over time, fine-tunes must be redone when facts change or the base model is retired.

What is RAFT?

Retrieval augmented fine-tuning: training a model on questions paired with helpful and distracting passages, with answers that quote the right passage verbatim. It prepares a model to use retrieval well in a specific domain.

Does Botminds fine-tune models on my documents?

Knowledge on Botminds lives in knowledge collections that agents search, so answers stay current, permissioned and cited. Your documents never train shared or third-party models. Agents can use any model added to the gateway, including models you host.

See it on
your own work.

Bring one process and its documents. We’ll show you the agents, the controls and the record, running on your data.