Slides · Evaluation and model adaptation
Fine-tuning vs RAG vs prompting
1 / 21
Fine-tuning vs RAG vs prompting
Three ways to change what a model does, and how to pick the right one before you spend weeks on the wrong one.
Concept
“Let’s fine-tune it so it knows our product”
- A common proposal, and often the wrong one.
- Weeks of work can end with answers that are still wrong, still uncited, and stale after the next price change.
- Today: match the lever to the kind of problem, then prove a fine-tune is worth it.
Compare
Three levers, three different things changed
| Lever | What it changes | Question it answers | Time to iterate |
|---|---|---|---|
| Prompting | Instructions and examples in the input | Did I explain the task clearly? | Minutes |
| RAG | What the model sees at answer time | Does the model have the facts? | Minutes to hours |
| Fine-tuning | The model’s weights | Can it do this reliably without long instructions? | Days, with data and training |
Only fine-tuning touches the weights.
Concept
Reference book or coaching?
- RAG hands someone the right reference book before they answer.
- Fine-tuning coaches how they work: house style, checklists.
- After coaching they still do not carry today’s price list in their head.
- Ask for a fact they never saw and they may still produce a fluent guess.
Diagram
Start from the problem, not the tool
Concept
Cheapest first, and they combine
- Prompting and RAG are reversible in minutes. A fine-tune needs a data pipeline, a training run and an evaluation.
- “Cheapest first” is about iteration speed and risk, not a strict ladder.
- A common production system: a tuned or well-prompted model that holds a strict format, fed by RAG for the facts.
Diagram
One request through a combined design
Concept
What fine-tuning does poorly (1): changing facts and citations
- Changing facts. Knowledge in the weights goes stale, and updating it means another training run. Facts are also hard to remove or correct later.
- Citations. A tuned model has no source passage to point at. Retrieval gives you the passage to cite and audit.
| Lever | What it takes to update one fact |
|---|---|
| Prompting | Edit the text in the prompt |
| RAG | Update the document and re-index it |
| Fine-tuning | New data, new training run, new evaluation |
Concept
What fine-tuning does poorly (2): per-user access
- Weights are shared by every user of the model.
- A retrieval step can filter documents by who is asking. Knowledge inside the weights cannot be filtered that way.
- Training on restricted data risks leaking it to everyone who can query the model.
Rule of thumb: if access differs by user, the data belongs behind a retrieval filter.
Concept
What fine-tuning does poorly (3): teaching new facts
- Gekhman et al. (EMNLP 2024) varied how many tuning examples carried facts the model lacked, in a controlled closed-book QA setup.
- Those examples were absorbed much more slowly than ones matching the model’s existing knowledge.
- After they were absorbed, the model hallucinated more.
- The authors’ reading: most factual knowledge arrives in pretraining; tuning mainly teaches the model to use it.
This is one setting: treat it as a warning about the mechanism, not a law.
Source[1] Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations?
Concept
Does fine-tuning cure hallucination? Not by itself
- Training on new facts may raise it (previous slide).
- But behaviour can be tuned: R-Tuning (Zhang et al., NAACL 2024) builds training data that teaches the model to decline questions beyond what it already knows.
- The authors report better answers on questions the model knows and more refusals on ones it does not.
- A model can also be tuned to answer in a fixed grounded format, for example always quoting a passage id from the supplied context.
Those are behaviours. Correct facts still come from retrieval.
Sources[2] R-Tuning: Instructing Large Language Models to Say 'I Don't Know'[1] Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations?
Concept
Where fine-tuning earns its place
- Field accuracy, token cost and consistency in a structured task at high volume.
- A house style or tone that prompts reproduce unevenly.
- Domain jargon or a routine such as triage categories, given many labelled examples.
- Tool-use habits for a specific tool set.
- Distillation: a small model trained on a large model’s outputs for a narrow task.
Schema validity is a separate matter: it comes from constrained decoding or a validator, not training.
Diagram
Five gates, all must pass
Process
What each gate means
- Labelled examples. Often hundreds to thousands of good input and output pairs; start small and measure. Noisy labels train noisy behaviour.
- A baseline to beat. The best prompt, with RAG if facts matter, measured on an eval set.
- An evaluation. Task metrics, a regression check on general abilities, a held-out set.
- A reason prompting cannot meet. Consistency across millions of calls, a latency or cost target needing a smaller model, a prompt too long to maintain.
- A maintenance plan. A fine-tune is tied to one base model, and base models get replaced.
Worked example
Worked example: is “a reason prompting cannot meet” real?
All numbers are illustrative. A ticket classifier makes 300,000 calls a day. Its prompt carries 620 tokens of instructions and examples, and a tuned model would need only 120.
saved tokens per call=620−120=500saved tokens per day=500×300,000=150,000,000At an assumed $0.50 per million input tokens:
150×0.50=75 per day| Check | Result |
|---|---|
| Is the saving large enough to justify a pipeline? | Maybe: $75 a day is about $27,000 a year, to weigh against data, training and eval work |
| Same saving at 3,000 calls a day? | 500×3,000=1,500,000 tokens, about $0.75 a day: no |
| What must still be measured? | Whether the tuned model matches the best prompt on accuracy, not just cost |
Volume turns “nice to have” into a reason. Without volume, keep the prompt.
Worked example
Worked example: assign the lever
| Requirement | Lever | Why |
|---|---|---|
| Each answer must show the handbook paragraph it relied on | RAG | The retrieved passage is the citation |
| Free-plan users must not see answers drawn from enterprise-only contracts | RAG with a plan-tier filter | Retrieval can filter by who is asking; weights are shared |
| Say which of 40 products ship to Canada; the table changes weekly | RAG (or a lookup) | Facts that change belong in retrieval |
| Replies must always follow a Decision / Reason / Next step shape; several prompt versions were tried and the shape still breaks at high volume; approved replies exist | Fine-tuning candidate, after recording the baseline | Prompting has had real effort; labelled data exists |
Check yourself
Check: which gate is missing?
A team has 1,200 clean labelled pairs and a measured baseline of its best prompt plus retrieval. It has no held-out set and no general-ability tests. A manager says “start training Monday”. Which prerequisite is missing, and what is the first action?
Answer
The evaluation is missing: there is no held-out set and no regression check. A fine-tune could not be shown to beat the baseline or to avoid breaking general abilities. First action: build a held-out set from real inputs (kept out of training) and a small general-ability check, then rerun the baseline on it.
Check yourself
Check: the section number that does not exist
A model tuned on a policy library to “cite the section” sometimes answers “see Section 4.2” for a section the library does not contain. Why does this happen, and what design makes the section number checkable?
Answer
Tuning taught the shape of a citation, not a lookup: the number is generated and can look right without being right. A retrieval design takes the section id from the retrieved passage’s own metadata, so the system can show the passage and verify that the id exists.
Check yourself
Check: too many refusals
After refusal-style tuning, an assistant says “I can’t find that” to many questions it used to answer correctly. What went wrong with the training data, and what do you measure?
Answer
Likely the refusal examples included questions the base model actually knew, so it learned to decline too broadly. R-Tuning builds refusal data from questions beyond the model’s existing knowledge, so check how each question was labelled against what the model can answer. Measure both sides: the refusal rate on truly unanswerable questions and the accuracy on answerable ones.
Source[2] R-Tuning: Instructing Large Language Models to Say 'I Don't Know'
Summary
Recap
- Prompting changes instructions, RAG changes the information in the prompt, fine-tuning changes weights.
- Facts that change, need citations or depend on the user belong to RAG.
- Fine-tuning suits consistent format, style and behaviour at volume, and distillation.
- It may help abstention, but it does not cure hallucination by itself.
- Before tuning: labelled data, a strong measured baseline, an evaluation, a reason prompting cannot meet, a maintenance plan.
References
References & Sources
Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations? (opens in a new tab)
Zorik Gekhman, Gal Yona, Roee Aharoni, Matan Eyal, et al.2024EMNLP 2024Paper
DOI 10.18653/v1/2024.emnlp-main.444 (opens in a new tab)arXiv 2405.05904 (opens in a new tab)https://aclanthology.org/2024.emnlp-main.444
Used for In a controlled closed-book QA study, fine-tuning examples that introduce new knowledge are learned more slowly, and once learned they raise the tendency to hallucinate.
R-Tuning: Instructing Large Language Models to Say 'I Don't Know' (opens in a new tab)
Hanning Zhang, Shizhe Diao, Yong Lin, Yi Fung, et al.2024NAACL 2024Paper
DOI 10.18653/v1/2024.naacl-long.394 (opens in a new tab)arXiv 2311.09677 (opens in a new tab)https://aclanthology.org/2024.naacl-long.394
Used for R-Tuning builds refusal-aware training data from questions outside the model's knowledge and reports more refusals of unknown questions and better answers to known ones.
Keys: ← → move, Home End first and last, F full screen.