They solve different problems. RAG injects knowledge; fine-tuning changes behavior. The decision criteria, the hybrid pattern, and what we'd do over.
The discussion online flattens this into a debate: "RAG vs fine-tuning, which wins?" Wrong framing. They solve different problems. Pick the wrong one and you spend three months building something that doesn't address your actual issue.
After running both in production for ~18 months, here's the framework we use.
RAG (Retrieval-Augmented Generation). At inference time, fetch relevant text from a knowledge base, stuff it into the prompt, ask the model to answer using that context. The model itself doesn't change. The knowledge is in the retrieval system.
Fine-tuning. Take a base model and continue training it on examples of input → output. The model's weights change. New behavior is baked in.
The core distinction:
This is the single most important distinction; everything else falls out of it.
The problem requires the model to know facts it doesn't know:
The signals that RAG fits:
We use RAG for: customer support (answers come from product docs + tickets), internal Q&A (answers from company wiki), compliance lookup (answers from policy documents).
The problem requires the model to behave differently:
The signals that fine-tuning fits:
We use fine-tuning for: classification of support tickets into our internal taxonomy, generation of structured extracts from documents, translation to a domain-specific style.
In most production AI systems we've built, we use both. RAG for the knowledge, fine-tuning for the behavior.
Example: a support agent.
Each solves a problem the other can't. RAG can't make the model talk like our support team; fine-tuning can't keep up with weekly product changes.
RAG operational cost:
Fine-tuning operational cost:
For an MVP, RAG is cheaper to start. Build the retrieval, point at the base model, ship. Fine-tuning has more upfront cost (data prep, training runs).
For sustained operation, fine-tuning can be cheaper. A fine-tuned model that uses 500-token prompts instead of 5000-token RAG prompts is 10x cheaper per call.
Fine-tuning to inject knowledge. Fine-tuned a model on our documentation. Worked OK on what was in the training set. New docs didn't help. The model "knew" what it knew at training time, period. Fine-tuning is not the right tool for knowledge.
RAG for behavior. Tried to push the model toward a specific output format by including format examples in the retrieved context. Worked sometimes; failed inconsistently. The model would format correctly when retrieval was clean and badly when retrieval included noisy context. Fine-tuning to bake in the format worked far better.
Massive context windows in lieu of retrieval. When context windows expanded to 1M tokens, the temptation was to stuff the entire knowledge base in the prompt. Two issues: cost (1M tokens per query is expensive) and quality ("needle in haystack" — models still struggle to use deeply-buried context). RAG with targeted retrieval beats raw context stuffing for accuracy.
Ask in order:
Is this a knowledge problem (model doesn't know facts) or a behavior problem (model can't act the way I need)? If knowledge → RAG. If behavior → fine-tuning. If both → both.
Does the data change frequently? If yes → RAG (fine-tuning freezes knowledge). If stable → either works.
Can I produce 1000+ high-quality training examples? If no, fine-tuning is unlikely to work well. RAG doesn't need labeled examples.
What's the inference cost / latency budget? Tight → fine-tuning (shorter prompts). Looser → RAG (longer prompts OK).
Do I need citations? If yes → RAG returns sources naturally; fine-tuned outputs don't.
The biggest practical issue with RAG: retrieval quality is the ceiling. If retrieval brings the wrong documents, the model answers wrong. Time spent improving retrieval (better embeddings, hybrid search, re-ranking, query rewriting) usually beats time spent on model selection.
Pattern we use:
Each adds latency and cost; each meaningfully improves quality. The cost-quality tradeoff is workload-specific.
Fine-tuning small models is underused. A small fine-tuned model often outperforms a big base model on a narrow task. We have a fine-tuned 7B model that beats Sonnet at our specific classification task at 1/20 the cost.
RAG quality plateaus faster than you'd think. First 80% of RAG quality is "embed and retrieve." Next 15% takes 10x the effort (re-ranking, query rewriting, careful chunking). Last 5% is hand-tuning that may never converge.
Most "RAG vs fine-tuning" debates online conflate them. Articles compare a barely-tuned RAG against a well-tuned fine-tune (or vice versa) and conclude their preferred approach wins. The fair comparison requires investment in both.
RAG and fine-tuning are different tools. Pick by the problem shape; don't pick by what's trending. The hybrid approach is what most serious production AI systems converge to. The framework above is the one we use to decide where each one fits — we don't pretend it's the only one.
Get the latest tutorials, guides, and insights on AI, DevOps, Cloud, and Infrastructure delivered directly to your inbox.
Default-deny, namespace isolation, egress control — the patterns we use, the gotchas around DNS, and where Cilium changed our calculus.
The architectural choice is presented as binary; the practical answer is "depends on the workload." The patterns that earn their place and the failure modes we've hit.
Explore more articles in this category
Small language models now handle most agent steps at a fraction of the cost, so pick per step instead of defaulting to a frontier model.
AI agents went from demos to production this year. This is the map: the frameworks, the protocol tying them together, and the patterns that actually ship.
A practitioner's tour of the reusable patterns for building reliable LLM agents, and when each one earns its keep.
Evergreen posts worth revisiting.