When should you fine-tune instead of using RAG?
Explain when fine-tuning is the better choice over RAG, and vice versa.
Fine-tune to change behavior, style, or domain reasoning. Use RAG when you need fresh or private facts. Most production systems use both.
Imagine teaching a smart assistant. Fine-tuning is like sending it to a training course that rewires its habits, after the course it talks, formats, and reasons differently forever. RAG is more like handing it a folder of notes right before each question, the assistant itself is unchanged, but it can read fresh facts from the folder. If you want your assistant to always answer in a polite legal tone, you train it. If you want it to know what your company shipped yesterday, you give it the folder. Most real systems do both, train the tone and hand over the folder.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: behavior vs knowledge framing + fine-tune triggers + RAG triggers + cost and latency trade-offs + combined-stack production reality + eval differences.
| Concern | Fine-tuning | RAG |
|---|---|---|
| Best for | Behavior, style, format, domain reasoning | Fresh or private facts, citations, large corpora |
| Update cadence | Days (data, train, eval, deploy) | Seconds to minutes (reindex) |
| Latency | Lower (no retrieval hop) | Higher (retrieval adds 100-300ms) |
| Per-query cost | Lower (smaller prompt) | Higher (retrieved context inflates tokens) |
| Operational complexity | Training pipeline, eval suite | Index, retriever, reranker, freshness |
Real products, models, and research that use this idea.
- Perplexity uses RAG over live web results combined with lightly fine-tuned Claude and GPT models for citation-style synthesis.
- GitHub Copilot Chat retrieves from open files and project context via RAG while the underlying model is fine-tuned for code completion behavior.
- Anthropic's Claude for Enterprise customers typically fine-tune for tone and refusal policy, then layer RAG over internal Notion and Confluence corpora.
- OpenAI's fine-tuning API is widely used to enforce strict JSON schemas on GPT-4o-mini, paired with retrieval from Pinecone or Weaviate for fresh data.
- Together.ai and Modal Labs publish reference stacks where customers fine-tune a Llama 4 variant for domain reasoning and retrieve documents with BGE-reranker on top.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy can't you use RAG to teach a model to output strict JSON?
QHow would you decide between LoRA, QLoRA, and full fine-tuning for a behavior change?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating RAG and fine-tuning as competing solutions to the same problem. They solve different layers, behavior versus knowledge, and the strongest production stacks combine both.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.