The Short Answer
What is the difference between RAG and fine-tuning?
RAG (retrieval-augmented generation) finds relevant documents when a question is asked and gives them to the model to answer from. Fine-tuning trains the model further on your examples so that it behaves differently. Use RAG when the model lacks your facts. Use fine-tuning when the model has the facts but will not produce the style, format or judgement you need.
The two are often presented as rivals. They are not. RAG changes what the model knows at the moment of the question. Fine-tuning changes how the model responds in general. A product can use both, and many should start with neither: a clear prompt with a few examples is the cheapest thing to try.
Read the transcript
Train a model on your product manual, and it will sound like the manual. It will still get the details wrong. Fine-tuning doesn’t reliably teach facts. It changes behaviour. There are two ways to make a model work with your own data. RAG looks up the relevant documents when a question is asked, and hands them to the model. Fine-tuning trains the model on your examples, so it responds differently. So which does your product need? Ask what’s going wrong. If the answers are wrong because the model lacks information, that’s a knowledge problem. Add retrieval. If the facts are right but the shape or the voice is wrong, that’s a behaviour problem. Add examples, then fine-tune. RAG has three more advantages. It can cite its sources. You can update it in minutes. And it can filter what each user is allowed to see. But start with neither. A clear prompt with a few worked examples is the cheapest thing to try. Many projects stop there. RAG changes what the model knows. Fine-tuning changes how it behaves. The full guide is free at loomstrat.com.
How RAG Works
The term comes from a 2020 paper by Patrick Lewis and colleagues, Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. The idea is simple: instead of relying on what a model memorised in training, look up the relevant text and hand it over with the question.
- 1
Prepare
Split your documents into passages and store each one in a search index, usually with an embedding: a list of numbers that represents its meaning.
- 2
Retrieve
When a question arrives, search the index for the passages most likely to contain the answer.
- 3
Generate
Send the question and the retrieved passages to the model, with an instruction to answer only from them and to cite them.
Quality depends mostly on retrieval. If the right passage is not found, the model cannot use it. Combining meaning-based search with keyword search, and re-ranking the results, usually helps. Anthropic’s write-up of contextual retrieval describes one way to keep passages from losing the context of the document they came from.
How Fine-Tuning Works
Fine-tuning continues the training of an existing model on your own examples, usually pairs of input and ideal output. The result is a private version of the model that leans towards those examples. It suits tasks where the desired behaviour is hard to describe but easy to show: a house writing style, a strict output format, a classification with subtle rules.
It does not reliably teach facts. A model fine-tuned on your product manual will sound like the manual and still misstate details from it. It also fixes knowledge at the time of training, so every change to the facts needs another round.
Side by Side
| RAG | Fine-tuning | |
|---|---|---|
| What it changes | The information the model sees | The model itself |
| Best for | Answering from your documents and data | Style, format, tone and narrow judgement |
| Keeping facts current | Update the index; takes minutes | Retrain the model |
| Can cite sources | Yes | No |
| Access control per user | Yes; filter what is retrieved | No; the model knows what it was trained on |
| Up-front work | A search index and a retrieval pipeline | Hundreds to thousands of high-quality examples |
| Running cost | Longer prompts on every call | Often shorter prompts; sometimes a smaller model |
| Main failure | The right passage is not retrieved | The examples were poor or too few |
| Tied to one model | No; swap the model freely | Yes; redo it when you change model |
How to Choose
- 1
Start with the prompt
Write clear instructions, add three to five worked examples and test on real cases. Many projects stop here.
- 2
Ask what is going wrong
If the answers are wrong because the model lacks information, you have a knowledge problem. If the facts are right but the output is in the wrong shape or voice, you have a behaviour problem.
- 3
Knowledge problem: add retrieval
If everything the model needs fits comfortably in the prompt, put it there. If not, build RAG.
- 4
Behaviour problem: add examples, then fine-tune
Try more examples in the prompt first. Fine-tune when you have several hundred good examples and prompting has stopped improving.
- 5
Both problems: do retrieval first
It is quicker to build, easier to debug and often makes the fine-tune unnecessary.
When You Need Neither
Model context windows have grown large. A handbook, a price list or a set of policies that runs to a few dozen pages can be placed in the prompt whole. That avoids the retrieval pipeline and its failure modes. With prompt caching, the repeated text is charged at a much lower rate after the first call. Retrieval earns its place when the material is too large for the prompt, changes often, or must be filtered by who is asking.
Costs to Expect
| Cost | RAG | Fine-tuning |
|---|---|---|
| Build | Ingestion, chunking, index, retrieval tuning, evaluation | Collecting and cleaning examples, training runs, evaluation |
| Run | Embedding new content, index hosting, longer prompts | Model hosting or a higher per-token rate for the tuned model |
| Maintain | Re-index when content changes; monitor retrieval quality | Retrain when requirements or the base model change |
In both cases the largest cost is people, not compute. For RAG it is getting documents into a clean, current state. For fine-tuning it is producing examples good enough to be worth copying.
Common Mistakes
- Fine-tuning to add knowledge. It is the wrong tool and the facts go stale.
- No evaluation set. Without 50 or so real questions with known good answers, you cannot tell whether a change helped.
- Blaming the model for a retrieval failure. Check what was retrieved before changing the prompt.
- Indexing everything. Out-of-date and duplicate documents produce confident wrong answers. Curate first.
- Ignoring permissions. If a user must not see a document, it must not be retrieved for them.
Our guide to building an AI chatbot on your own data walks through a RAG build step by step, and the AI feature integration guide covers choosing a model. If you want a second opinion on an approach, ask us.
Frequently Asked Questions
Is RAG better than fine-tuning?
They solve different problems. RAG supplies facts the model lacks. Fine-tuning changes the style or format of the output. For answering from company documents, RAG is the right choice.
Can you use RAG and fine-tuning together?
Yes. A fine-tuned model can answer from retrieved documents. Build retrieval first; it is often enough.
Does fine-tuning stop hallucinations?
No. It can make the model follow a format more reliably, but it does not make it accurate about facts. Retrieval with citations is the stronger control.
How much data do I need to fine-tune a model?
Usually several hundred to a few thousand high-quality examples. Quality matters more than quantity; poor examples train poor behaviour.
Is RAG expensive to run?
The index is cheap. The main running cost is the longer prompt on each call, which prompt caching and tighter retrieval reduce.
Do I need a vector database for RAG?
Not always. For a small corpus, a vector extension in your existing database or plain keyword search is enough. Add a dedicated store when scale requires it.