Fine-tuning vs RAG
Fine-tuning changes how a model behaves. RAG changes what it knows at the moment you ask. Choosing the wrong one is the most expensive mistake in applied LLM work.
The short answer
Fine-tuning teaches behaviour — tone, format, a domain's conventions, a task the base model performs badly. RAG supplies facts at query time from a source you control. If your problem is that the model does not know something, RAG is almost always the answer, and fine-tuning facts into weights is unreliable and stale the moment the facts change. If your problem is that the model knows but answers wrongly shaped, fine-tune. Production systems frequently do both.
Fine-tuning
Changes the weights. Teaches form, style and task behaviour.
RAG
Changes the prompt. Supplies current facts from your own data.
Fine-tuning vs RAG at a glance
| Factor | Fine-tuning | RAG |
|---|---|---|
| What it changes | The model's weights | The context passed at query time |
| Good at | Format, tone, domain conventions, narrow task performance | Facts, documents, anything that changes |
| Updating knowledge | Retrain | Update the index — effective immediately |
| Infrastructure | GPU time, training data, evaluation | Embedding model, vector store, retrieval pipeline |
| Inference cost | None extra — the model is the same size | Retrieved context consumes tokens on every request |
| Can you cite sources | No | Yes — retrieved chunks are traceable |
| Time to first result | Days: data preparation, training, evaluation | Hours: index documents and retrieve |
Why fine-tuning is bad at facts
Training adjusts weights to make certain continuations more likely. Show a model a thousand statements about your company and it will become more likely to produce text in that shape — but there is no mechanism guaranteeing any individual fact survives intact, and no way to check which ones did short of testing each one.
Worse, it makes hallucination more confident rather than less. A model fine-tuned on your domain has learned the domain's style, so its invented answers sound exactly like its correct ones. Without retrieval there is nothing to check them against.
And facts change. A fine-tune is a snapshot: prices, policies, staff, product details all drift, and every drift is a retraining cycle. RAG updates by reindexing a document.
What fine-tuning is genuinely good at
Output shape. If you need every response in a specific JSON structure, or in a house style, or following a clinical or legal convention, a few hundred good examples teach that far more reliably than instructions in a prompt — and without spending context tokens on those instructions every single call.
Narrow task performance. A small model fine-tuned on one classification or extraction task routinely matches a much larger general model on that task, which matters when you are running locally and the large model does not fit.
And implicit conventions — the things domain experts do without being able to articulate them, which are therefore hard to write into a prompt but visible across enough examples.
Doing both, in the right order
The standard production shape is RAG for knowledge and a fine-tune for behaviour: retrieval finds the relevant documents, and a fine-tuned model has learned how to use retrieved context, when to say the answer is not in the sources, and what format to answer in.
The order matters for your own effort. Build RAG first. It is faster, it usually solves more of the problem than expected, and it tells you what is actually wrong — if answers are correct but badly shaped, you now know a fine-tune is worth it, and you have real examples to train on.
Starting with the fine-tune means spending days on GPU time before learning whether the problem was ever about behaviour. That is the expensive mistake, and it is common.
Choose Fine-tuning when
- Output must follow a specific format or style every time
- A small local model needs to match a larger one on one narrow task
- The domain has conventions you cannot easily write down
- You want to stop spending context tokens on long instructions
Choose RAG when
- The model needs to know things it was never trained on
- The facts change — documentation, policies, prices, inventory
- You need citations back to source documents
- You want something working this week
Work it out for your own setup
Common questions
- Can I fine-tune facts into a model if I really want to?
- You can train on factual statements, and some of them will stick. You will not know which, you cannot cite a source, and every change requires retraining. For a stable, closed body of knowledge it is occasionally defensible; for anything that moves it is the wrong tool.
- Does RAG need a vector database?
- Not always. For a few thousand chunks, an in-memory index or even a well-built keyword search can be enough, and hybrid retrieval combining both often beats vectors alone. A dedicated vector store earns its place at scale, not at the start.
- How much data do I need to fine-tune?
- For style and format, a few hundred high-quality examples often suffice with LoRA. For a genuinely new capability, thousands. Quality dominates quantity — a small consistent set beats a large noisy one.
- Can I do either of these locally?
- RAG, comfortably: an embedding model and a vector index run on modest hardware. Fine-tuning locally depends on method — QLoRA puts a 7B or 8B model within reach of a 12GB card, while full fine-tuning of the same model needs far more memory than any consumer GPU has.
Guides that go deeper
Longer reads on the concepts behind this comparison.
- Best Local Embedding Models for RAGDimensions, licences and what vector storage really costs.Read the guide
- How Much RAM and VRAM Do You Need to Run Local LLMs?Model weights, KV cache and OS overhead, tier by tier.Read the guide
- Best Local LLM Runners: Ollama vs LM Studio vs Jan vs llama.cpp vs vLLMWhich runner suits your hardware and workflow.Read the guide