RAG vs Fine-tuning
Two approaches to giving LLMs domain specific knowledge
Reach for RAG when knowledge changes or must be cited; fine-tune when you need the model to change how it behaves, not what it knows.
RAG
Glossary →Retrieval-Augmented Generation (RAG) augments an LLM at inference time by retrieving relevant documents from an external knowledge base and injecting them into the prompt context. The model itself is never modified.
Best for: Fresh, citable knowledge over a changing corpus.
Fine-tuning
Glossary →Fine-tuning adapts a pre-trained model by continuing training on a curated dataset. The model weights are permanently changed to embed new knowledge or behavior patterns.
Best for: Baking in a tone, format, or reasoning pattern.
At a glance
| Dimension | RAG | Fine-tuning |
|---|---|---|
| Knowledge freshness | Real-time (update docs anytime) | Stale until retrained |
| Cost to update | Low (re-index docs) | High (GPU hours for retraining) |
| Latency | Higher (retrieval + generation) | Lower (single forward pass) |
| Hallucination risk | Lower (grounded in retrieved docs) | Higher (learned patterns may generalize incorrectly) |
| Setup complexity | Medium (vector DB, embeddings, chunking) | Medium-High (training infra, dataset curation, eval) |
| Best for | Factual Q&A, support bots, search | Style transfer, domain adaptation, classification |
Key differences
- 1RAG adds knowledge at runtime; fine-tuning bakes it into weights
- 2RAG can be updated instantly by changing the knowledge base; fine-tuning requires retraining
- 3Fine-tuning changes model behavior and style; RAG only provides context
- 4RAG needs a retrieval pipeline (embeddings, vector DB, reranking); fine-tuning needs training infrastructure (GPUs, datasets, evaluation)
- 5RAG is better for factual recall over large, changing corpora; fine-tuning is better for style transfer and domain specific reasoning patterns
In the interview
- Claiming fine-tuning is how you add fresh facts to a model
- Saying RAG changes the model's behavior or writing style
- Defaulting to fine-tuning for a knowledge base that changes weekly
- Ignoring cost: retraining per update versus re-indexing documents
How to choose
Changing or citable knowledge → RAG. A fixed behavior or style → fine-tune. Most production systems end up doing both.
Common misconceptions
Myth: Fine-tuning is how you teach a model new facts.
Reality: Fine-tuning is unreliable for factual recall and can't be updated without retraining. RAG is the tool for knowledge; fine-tuning is for behavior.
Myth: RAG and fine-tuning are competing choices, you pick one.
Reality: They operate on different axes (knowledge vs behavior) and compose well: fine-tune for style, then ground answers with RAG.
Myth: RAG eliminates hallucination.
Reality: RAG reduces it by grounding answers, but the model can still ignore or misread retrieved context. Retrieval quality and prompting still matter.
Memory aid
RAG is an open-book exam (look facts up as you answer); fine-tuning is studying until the material changes how you think. You can do both: study for skill, keep the book open for facts.
Can you combine them?
Yes, and it's increasingly common. Fine-tune the base model for domain specific reasoning, then layer RAG on top for factual grounding. This gives you both behavioral adaptation and real-time knowledge access.
Quiz yourself
Related topics
Related comparisons
Bi-encoder vs Cross-encoder
Two ways embeddings power retrieval and reranking
Chunking strategies: fixed vs semantic vs recursive
Three ways to slice documents before they hit the vector store
DDP vs FSDP vs ZeRO
Three ways to shard distributed LLM training across GPUs
Distillation vs Quantization
Two orthogonal ways to shrink a large language model
DPO vs PPO
Direct Preference Optimization vs Proximal Policy Optimization for RLHF
Hallucination Mitigation vs Context Window Management
Two critical challenges in production LLM systems