RAG or fine-tuning?
RAG gives a model knowledge. Fine-tuning changes its behavior. Most projects need RAG first.
Words on this page (9)
- RAG
- : Retrieval-augmented generation: look up relevant text first, then give it to the model to answer from.
- fine-tuning
- : Further training on a smaller, targeted set of examples to change behavior or style.
- prompt
- : The input text you give a model, including instructions, examples and data.
- weights
- : The learned numbers that define a trained model. A model whose weights are published is called open-weight.
- skill
- : A folder of instructions and scripts an agent loads only when a task needs it.
- training
- : Adjusting a model's parameters on data so its predictions improve.
- reranker
- : A second model that rescores a short list of search results by reading query and passage together.
- chunk
- : A small piece of a document, sized for indexing and retrieval.
- policy
- : A rule for choosing actions. In a language model, the model itself is the policy.
The difference
puts the right facts in the at question time. The model is unchanged. updates the model's on examples so it adopts a style, format or narrow . Fine-tuning is weak at adding facts, hard to update and hard to audit. RAG is easy to update and to cite.
A decision guide
Does the model need facts that change or are private? Use RAG. Does it need a consistent tone, a fixed output format or to follow a complicated procedure reliably? Try prompts and examples, then consider fine-tuning. Do you need a small cheap model to match a big one on a narrow task? Fine-tune it, using the big model's outputs as data. Many production systems use both: a fine-tuned model for style and format, and RAG for facts.
What each one costs you
RAG adds work on every call: a search, extra prompt text and sometimes a . Its setup is light, and updating knowledge means re-indexing a document. Fine-tuning has the opposite shape. It needs a set of good example inputs and outputs that you write or collect, a training run and a test that the model did not get worse elsewhere. Once trained, calls are not slower, and the prompt can be shorter.
Changing a fact is the clearest difference. With RAG you edit the document. With fine-tuning you must prepare new examples and train again, and you cannot easily point to where a fact lives in the weights.
A second example: neither is needed
A team wants replies in a fixed three-line format. They try a clear instruction plus three example replies in the prompt, and the format comes out right in 19 of 20 tests (invented numbers). That costs nothing to maintain. Fine-tuning would add training and testing for a gain they do not need. Always try the prompt first.
What goes wrong
A fine-tuned model states old facts with full confidence, because they are baked into its weights. To check, ask it a question whose answer changed after training. A RAG system fails differently: the right is not found, so the model guesses or declines. Look at the retrieved chunks to tell which one you have.
Fine-tuning on a small, uneven set can also narrow the model. It copies the style of the examples and gets worse on other tasks, which is why you test on questions outside the training set.
Try it yourself
Pick one task, such as answering questions about a small document. Try three setups on the same 10 questions: the prompt alone, the prompt with the document pasted in, and (if the document is too long to paste) the prompt with retrieved excerpts. Score each by counting correct answers. Expect the first to guess, and the others to improve sharply. That gap is what RAG buys, with no training at all.
Common mistake
Reaching for fine-tuning first because it sounds advanced. It is usually the more expensive, slower, harder-to-update option.
A company wants its assistant to know the new product catalog and to always answer in a formal tone. For the catalog, which changes weekly, retrieval is ideal: update the documents and the answers update. For the formal tone, fine-tuning or a good system prompt fits. The mistake would be fine-tuning on the catalog every week.
Check yourself
Your product docs change weekly and the model must answer from them. Best choice?
Not quite. Re-indexing is cheap and keeps answers citable.
When does fine-tuning make sense?
Not quite. Fine-tuning is for behavior, not for facts.
Your assistant needs both a formal tone and up-to-date prices. What fits?
Not quite. They solve different problems and are often combined.
You got 0 of 3 right.
Go deeper
- ArticleRAG vs fine-tuningArticle
IBM · A balanced comparison with trade-offs.
- Article
Eugene Yan · When to retrieve and when to fine-tune.
- Paper
Ovadia et al. · Finds retrieval beats fine-tuning for new knowledge.
Spotted a mistake or something unclear? Report it on GitHub.