Slides · Evaluation and model adaptation

Fine-tuning vs RAG vs prompting

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

LeverWhat it changesQuestion it answersTime to iterate
PromptingInstructions and examples in the inputDid I explain the task clearly?Minutes
RAGWhat the model sees at answer timeDoes the model have the facts?Minutes to hours
Fine-tuningThe model’s weightsCan 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

Diagram: Going down from the question, missing facts lead to RAG, unclear instructions lead to a better prompt, and consistent behaviour backed by...

needs facts

unclear task

consistent behaviour
+ labelled examples

still inconsistent
after real effort

What is the
actual problem?

Use RAG

Improve the prompt

Consider fine-tuning

Diagram summary: Going down from the question, missing facts lead to RAG, unclear instructions lead to a better prompt, and consistent behaviour backed by labelled examples leads to fine-tuning. A prompt that stays inconsistent after real effort also joins the fine-tuning branch.

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

Diagram: Going down, retrieval supplies current, citable facts into the prompt, and the model supplies the consistent format and behaviour.

User question

RAG: retrieve
current facts

Prompt: question
+ passages

Tuned or well-prompted
model: format, tone

Grounded answer
with citations

Diagram summary: Going down, retrieval supplies current, citable facts into the prompt, and the model supplies the consistent format and behaviour. Each part does the job the other does badly.

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.
LeverWhat it takes to update one fact
PromptingEdit the text in the prompt
RAGUpdate the document and re-index it
Fine-tuningNew 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.

Source1 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.

Sources2 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

Diagram: Going down, a fine-tune starts only after all five gates pass: labelled examples, a measured strong baseline, an evaluation, a reason...

1 Labelled examples

2 Measured strong baseline

3 Eval + regression checks

4 Reason prompting
cannot meet

5 Plan to retrain
on a new base

Start the fine-tune

Diagram summary: Going down, a fine-tune starts only after all five gates pass: labelled examples, a measured strong baseline, an evaluation, a reason prompting cannot meet, and a retraining plan.

Process

What each gate means

  1. Labelled examples. Often hundreds to thousands of good input and output pairs; start small and measure. Noisy labels train noisy behaviour.
  2. A baseline to beat. The best prompt, with RAG if facts matter, measured on an eval set.
  3. An evaluation. Task metrics, a regression check on general abilities, a held-out set.
  4. 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.
  5. 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=500\text{saved tokens per call} = 620 - 120 = 500saved tokens per day=500×300,000=150,000,000\text{saved tokens per day} = 500 \times 300{,}000 = 150{,}000{,}000

At an assumed $0.50 per million input tokens:

150×0.50=75 per day150 \times 0.50 = 75 \text{ per day}
CheckResult
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,000500 \times 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

RequirementLeverWhy
Each answer must show the handbook paragraph it relied onRAGThe retrieved passage is the citation
Free-plan users must not see answers drawn from enterprise-only contractsRAG with a plan-tier filterRetrieval can filter by who is asking; weights are shared
Say which of 40 products ship to Canada; the table changes weeklyRAG (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 existFine-tuning candidate, after recording the baselinePrompting 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.

Source2 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

  1. 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

    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.

  2. 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

    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.