How it works · 13 of 37 Core

RAG vs fine-tuning: when should you use each?

Teach facts or habits?

RAG vs fine-tuning: RAG gives facts at question time; fine-tuning trains habits (tone, format, skill) into the model.

Loading the animation…

Say it like this RAG puts facts on the model's desk, where you can change them instantly; fine-tuning trains habits like tone and format into its head; many products use both.

Under the hood — for builders
What each one changes
RAG changes what the model reads: pages added to the prompt for each question. Fine-tuning changes the model itself: a further round of training on your examples nudges its weights (the billions of numbers it learned in training). On this card's story:
Real impact: new facts
Ovadia et al. asked models about current events they had to learn, by reading them (RAG) or by fine-tuning on them. Their fine-tuning trained on the raw documents (the paper calls it unsupervised), not on question-and-answer pairs as most product fine-tuning does. Accuracy of Mistral 7B:
Why a course is a poor way to add facts
Two findings. Ovadia et al. (§6): to teach a model a new fact, “the knowledge must be repeated in numerous ways”. Gekhman et al.: new facts are learned slower than familiar ones, and once learned they make the model hallucinate more. Fine-tuning only on facts the model did not know:
What fine-tuning is for
Gekhman et al. conclude that models “mostly acquire factual knowledge through pre-training, whereas fine-tuning teaches them to use it more efficiently”: tone, format, a task done a set way. Neither paper measured how often a habit sticks; the card's 2 in 3 vs 3 in 3 is illustrative.
Typical cost
RAG: update a page and re-index it. Fine-tuning: prepare example pairs, run training, test, redeploy; LoRA keeps that cheaper (D5).
Measure it
Ask about facts changed after training, and check the format on a batch of answers, not one.
Watch out
Fine-tuning on facts the model doesn't know can raise hallucination; a fine-tuned answer cannot point to its source.
Sources
Ovadia, Brief, Mishaeli & Elisha, Fine-Tuning or Retrieval? Comparing Knowledge Injection in LLMs (arXiv 2312.05934v3) · Gekhman, Yona, Aharoni, Eyal, Feder, Reichart & Herzig, Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations? (EMNLP 2024, arXiv 2405.05904v3).

What happens in the RAG vs fine-tuning animation, step by step?

  1. The model works the help desk. In its head: refunds take 14 days. On its desk: the manual.
  2. New rule: refunds are now 21 days. Hand over a page, or send it on a course: which gets the next customer right sooner? Tap one, or just watch both.
  3. Hand over a page (RAG): the new page goes on the desk, the model reads it, and answers 21 days on day 1. Its head didn't change.
  4. Send on a course (fine-tuning): the new fact is trained into its head. That takes days, and the old 14 never fully goes.
  5. Both ways now say 21 days. The page got there on day 1, and you can check the answer against it. The course took until day 4, and there's nothing to check.
  6. Now a habit: “start every reply with Namaste 🙏”. A note on the desk works 2 times in 3. Trained into its head: every time.
  7. Facts that change go on the desk. Habits go in the head. Many products do both.

What everyday example explains RAG vs fine-tuning?

Handing an employee the manual vs sending them on a course.

Why should a team care about RAG vs fine-tuning?

The first decision on any "AI on our data" project.