RAG vs fine-tuning: which one when
By Philipp Kant 4 min read
Retrieval-augmented generation (RAG) and fine-tuning are two ways to adapt a language model to a company. RAG hands the model the matching passages from your documents with every question, and the model answers from them. Fine-tuning trains the model further on examples so it behaves differently for good. RAG changes what the model knows. Fine-tuning changes how it answers.
For most companies the answer is RAG, often with a good prompt, and fine-tuning only for narrow tasks.
The comparison at a glance
| Criterion | RAG | Fine-tuning |
|---|---|---|
| Changes | Knowledge at answer time | The model’s behavior |
| Needs | Your documents, clean and current | Hundreds to thousands of good examples |
| New facts | Immediately, once the document is indexed | Only after retraining |
| Sources citable | Yes, every answer with its passage | No |
| Hallucinations | Fewer, because facts come along | Remain a risk |
| Upfront cost | Building search and index | Collecting examples, training |
| Running cost | Somewhat more text per request | Often a cheaper, smaller model |
| Switching models | Easy, the index stays | Retraining for every model |
| Typical use | Knowledge, manuals, product data, support | Fixed format, tone, classification |
What RAG does well
RAG is built for knowledge that changes and has to be backed up: prices, product data, policies, contracts, support history. A new manual version shows up in answers after the next indexing run, with nothing done to the model. Every answer can cite its source, and users only see the documents they are allowed to see.
Quality depends almost entirely on search: if it finds the right passage, the model answers correctly. How that works in detail is in what is RAG?.
What fine-tuning does well
Fine-tuning pays off when a model should always answer the same way: a fixed output format for downstream processing, a specific tone in customer replies, a classification with your own categories. A smaller fine-tuned model can do such a task cheaper and faster than a large one with a long prompt.
What fine-tuning does poorly: reliably build in facts. A model trained on your price lists remembers them vaguely, cites no source, and knows the wrong thing after the next price change.
What each costs
RAG’s effort is in the data work: collecting documents, cleaning them, splitting them, mapping permissions, testing search. After that, each request costs a little more, because the passages found are sent along.
Fine-tuning’s effort is in the examples: hundreds to thousands of pairs of input and correct output, checked by experts. Then comes training, and it repeats with every model change. Because new models appear monthly, that is an often underestimated cost.
Which one when: the decision
| Your task | Choice |
|---|---|
| Answer questions about manuals, policies, products | RAG |
| Answers must cite sources | RAG |
| Knowledge changes weekly | RAG |
| Output always in the same structured format | Prompt with examples first, then fine-tuning |
| Your own tone in customer replies | Prompt with examples first, then fine-tuning |
| Very many similar requests, cost matters | Fine-tuning a smaller model |
| Knowledge and a fixed format at once | Both combined |
Before either comes a step that is often enough: a better prompt with a few good examples. Only when that falls short is RAG or fine-tuning worth the effort.
Combining RAG and fine-tuning
The two don’t exclude each other. A fine-tuned model can deliver format and tone, RAG the current facts. In practice the combination is rarely needed; most projects get by with RAG and a clean prompt. For a small, curated collection there is a third way that consolidates the knowledge upfront: an LLM wiki.
How RAG works with your own content is shown in the free chat with your website demo: enter an address, and a chat answers from your pages, with sources. We build AI agents for business that work with your knowledge and systems, at a fixed price.
FAQ
Is RAG or fine-tuning cheaper? For company knowledge almost always RAG, because it needs no training and survives every model change. Fine-tuning can be cheaper in operation when a small model handles very many similar requests.
How many examples does fine-tuning need? Usually hundreds for a narrow task, thousands for harder ones, each checked. The model learns bad examples just as well as good ones.
Does a model learn from RAG? No. The model stays unchanged; it gets the matching passages with every question. That is why new knowledge is there at once, and gone just as fast when you delete a document.
Do we need our own model for RAG? No. RAG works with the major models such as Claude, GPT, or Gemini, and with a model on your own servers.
Ask an AI about this post