Fine-tuning vs RAG: which one your task needs
Fine-tuning vs RAG for buyers: when to train a model, when to retrieve documents, and how to test which one your task needs before you commit.
Updated
Fine-tuning and RAG solve different problems. Fine-tuning changes how a model behaves on one task by training its weights on labeled examples. RAG (retrieval-augmented generation) leaves the model alone, searches your documents for each request, and places the matching passages in the prompt. Choosing between them is mostly a question of where the knowledge should live: inside the model, or in your document store.
What each method changes
Fine-tuning teaches a pattern. The model learns your label set, your output format, and the judgment calls your reviewers make, such as which clause counts as a termination right. Once trained, it needs fewer instructions and examples in every prompt.
RAG adds knowledge at query time. A search step finds passages, and the model answers from what it was handed. If the search misses the right passage, the model has nothing correct to work from, and it may still write a fluent answer. Neither method covers the other’s weak spot. A fine-tuned model does not know facts that changed after training, and a RAG system still depends on the base model reading the passages the way your reviewers would. New to training? Read what fine-tuning is first.
A worked example: one team, two questions
A procurement team receives vendor contracts and needs two things from its AI tool.
The first request is the same every time: for each new contract, return the governing law, the termination notice period, and the liability cap as a fixed JSON object, with the exact quoted sentence beside each field. The fields never change, and the reviewers have agreed what counts as a notice period. This is a repeated task with a strict shape, so it suits fine-tuning. The trained model learns the schema and the judgment, and the prompt can stay short.
The second request changes every time: “Does our 2024 master agreement with this supplier allow assignment without consent?” The answer lives in one specific document, the document set grows each month, and the reviewer needs to see the clause. This suits RAG. The index updates when a new contract is filed, and the answer carries its source passage.
Most real teams have both kinds of request. The two methods are rarely rivals inside one team, so test each request type separately before you design the system.
Where each approach fits
Fine-tuning fits when:
- the same task runs over and over with the same input type and output shape
- the output must follow a strict format that downstream code parses
- a general model makes the same mistake on your data and better prompting does not fix it
- the rules are stable enough that you will not retrain every week
RAG fits when:
- the answer depends on documents that change faster than you could retrain
- a reader must see the source passage behind each answer
- the questions are open-ended and cannot be predicted from a fixed label set
- you need to start quickly and have documents but no labeled examples yet
Fine-tuning also helps at volume. A trained model does not need retrieved passages added to every request, and those passages are the main reason a RAG prompt grows.
Mistakes that skew the comparison
Most bad comparisons come from the test, not from the method.
- Splitting by chunk. If passages from the same contract land in both training and test data, the model is scored on text it has effectively seen. Split by document.
- Weak baselines. A trained model that beats a lazy prompt proves little. Write the best prompt you can, with a few examples, and score it first.
- Judging retrieval only by the final answer. When a RAG answer is wrong, check whether the right passage appeared in the top results. If it did not, the model is not the problem.
- Training on facts that expire. If the rule changes each quarter, a fine-tuned model goes stale. Keep changing facts in the document store and train only the stable behavior.
- Adding retrieval to a trained model without measuring. Extra passages can distract a model that learned its judgment from examples. Score with and without retrieval.
How to run the test
- Write the task as input and expected output. Name each field and its allowed values before you collect anything.
- Build a test set from your real documents, with answers checked by the people who will use the tool. Include the messy cases, not only clean ones.
- Split by document, and keep every document in one set only.
- Score the current approach on the test set. This is your baseline.
- Sort every error into one of three bins: wrong format, wrong judgment, or missing source. Wrong format and wrong judgment point toward fine-tuning. Missing source points toward retrieval.
- Score the candidate on the same test. With a small data set, use cross-validation so every document is scored by a model that never trained on it. A single split can swing a lot on a few dozen documents.
For the mechanics, read how to test an LLM on your own data and how much data you need to fine-tune.
What a public exam shows
On a public contract-clause exam, a model trained only to quote ten passage types exactly beat Claude Opus given one prompt in every fold, which shows what narrow training can do, not how it will do on your contracts. Full results.
Not sure which side your task falls on? Own Weights starts with a free audit that maps your AI spend by task from your code. For a task that fits, we train on your own data, and the trained model must beat the current one on your test before it is deployed. It is served in your cloud account or on-prem, and you own the weights. Book a free audit to find out which of your tasks fit.
Questions
Is fine-tuning better than RAG?
Neither is better in general. Fine-tuning fits a repeated task with a stable output shape, and RAG fits answers that depend on documents that change. Score both on your own test set before you pick one.
Can you use fine-tuning and RAG together?
Yes. A trained model can read passages that a retrieval step supplies, which helps when a task needs a fixed output format and current facts. Start with the simpler setup and measure whether retrieval changes the score.
What does a RAG system cost to run?
The main cost is the retrieved passages sent with each request, since they count as input tokens. Claude Haiku lists at $0.10 per million input tokens and Claude Opus at $4 per million input tokens, for prompts up to 100K tokens. Check your provider's current pricing page for storage and search costs.