Prompting vs RAG vs Fine-Tuning
The ExampleCo assistant has three reported problems:
- It writes answers that are too long.
- It does not know the policy published yesterday.
- It inconsistently maps unusual policy questions into the company’s internal categories.
The team proposes “fine-tune the model” for all three. That skips the most important question: Is the failure about instructions, missing information, or a learned task behavior?
Three Different Levers
| Technique | What changes? | What stays unchanged? |
|---|---|---|
| Prompting | Instructions, examples, and context for a request | Model weights |
| Retrieval-augmented generation (RAG) | External evidence supplied at request time | Answer model’s weights |
| Fine-tuning | Model parameters using additional training examples | Facts are not automatically synchronized with live systems |
These are not mutually exclusive architectures. A fine-tuned model still receives a prompt and can still use RAG.
Diagnose Before Choosing
flowchart TD
F["Observed failure"] --> D{"Is required evidence available?"}
D -->|"No"| R["Improve source access and retrieval"]
D -->|"Yes"| I{"Are task and output rules clear?"}
I -->|"No"| P["Improve prompt and examples"]
I -->|"Yes"| E["Measure repeated behavioral errors"]
E --> T{"Enough representative training data and measurable value?"}
T -->|"No"| S["Simplify task, use rules, or review"]
T -->|"Yes"| M["Evaluate fine-tuning against the baseline"]A missing database row is not a training problem. A confusing instruction is not automatically a model-capacity problem.
Prompting: The Lowest-Cost First Experiment
If answers are too verbose, first try:
Explain the applicable policy in at most three short sentences.
State the annual entitlement, applicability, and source.
Do not add general HR advice.If categories are unclear, define them and supply a few contrasting examples.
Prompting is attractive because it is easy to revise and evaluate. It can become unwieldy when instructions or examples grow very large, and behavior is still probabilistic.
Do not keep extending a prompt to compensate for a task that should be a deterministic lookup.
RAG: Bring the Current Book to the Exam
Use retrieval when correctness depends on current or private information:
- The active annual leave policy.
- A newly published exception.
- A document that only some employees may access.
- An answer requiring a verifiable citation.
The benefit is externalized knowledge: changing the authoritative source and its index can update future answers without training the model again.
The cost is an evidence pipeline. Retrieval can miss a passage, return stale data, or supply distracting text. Fix and measure those failures directly.
See RAG for the request flow.
Fine-Tuning: Practice a Repeatable Task
Fine-tuning adjusts a model using additional examples. In supervised fine-tuning, examples demonstrate desired input/output behavior.
A possible ExampleCo use:
Input:
Question: "Can I move unused holiday into next year?"
Desired classification:
{"intent": "carryover", "needs_account_data": false}If thousands of representative, reviewed examples exist and prompting has a measured ceiling, fine-tuning might improve this mapping or allow a smaller model to meet the task requirements.
It is a poor first solution for:
- Yesterday’s policy update.
- Per-user authorization.
- Exact remaining balances.
- Reliable deletion of one learned fact.
- A schema constraint that application code can enforce.
Fine-tuning can teach facts, but facts stored in weights are difficult to update, inspect, cite, and selectively forget. That makes it a weak source of authority for changing company policy.
A Responsible Training/Evaluation Loop
- Define the failure and business metric.
- Establish prompt-only and retrieval baselines.
- Collect reviewed examples with appropriate consent and data handling.
- Split data by meaningful units, such as document family or time.
- Train using the training split only.
- Tune decisions on validation data.
- Compare once against a held-out test set.
- Test safety, refusal behavior, latency, and cost.
- Roll out gradually and retain the old model/configuration.
Randomly splitting near-duplicate policy questions can leak the same pattern into training and testing. A high score then overstates generalization.
LoRA Without the Matrix Derivation
Low-Rank Adaptation (LoRA) is a parameter-efficient fine-tuning method. It keeps base weights frozen and trains small additional parameter sets, often called adapters, for selected model layers.
Think of it as learning a compact adjustment instead of rewriting every learned weight.
| Property | Implication |
|---|---|
| Fewer trainable parameters | Can reduce training-memory and storage requirements |
| Base model remains needed | An adapter is not generally a standalone model |
| Adapter tied to a compatible base | Model/version mismatches can break deployment |
| Learned behavior still changes | Evaluate quality and safety, not just memory savings |
LoRA does not mean training is free. You still need data preparation, compute, evaluation, deployment, and model lifecycle ownership. Its effectiveness depends on the task and configuration.
Combine the Techniques Deliberately
An eventual architecture might use:
Clear application instructions
+ fine-tuned intent classification
+ authorized retrieval of current policies
+ grounded generation
+ deterministic validationBut the first version can be:
Clear instructions + current evidence + validationOnly add the classifier or fine-tuning when a measured problem justifies it.
A Small Decision Experiment
PSEUDOCODE
cases = load_held_out_cases()
baseline = evaluate(prompt_version="v1", retrieval="current", cases=cases)
prompt_change = evaluate(prompt_version="v2", retrieval="current", cases=cases)
retrieval_change = evaluate(prompt_version="v1", retrieval="improved", cases=cases)
compare_error_categories(baseline, prompt_change, retrieval_change)
if repeated_behavioral_gap_remains and enough_reviewed_training_data:
tuned_model = train_on_training_split_only()
evaluate_quality_safety_latency_and_total_cost(tuned_model, held_out_cases)In real experimentation, do not repeatedly optimize against the final held-out test set. Use a validation set for iterative decisions and protect the final test for unbiased comparison.
Total Cost, Not Training Cost Alone
Include:
- Labeling and review.
- Training and experiments.
- Deployment and adapter/base-model management.
- Inference latency and token use.
- Monitoring, rollback, and future retraining.
- Security and privacy review of training data.
A fine-tuned smaller model can lower serving cost for a stable task. A prompt change that solves the same problem may still be simpler and cheaper overall.
Related Concepts
- Prompt design establishes the baseline.
- Evaluation separates improvement from leakage.
- ML platform design covers model registration and rollout.
Trade-offs
| Requirement | Start with | Why not the other lever first? |
|---|---|---|
| Shorter, clearer answers | Prompting | Training may be unnecessary |
| Current policy facts | RAG or direct structured lookup | Weights are not a live database |
| Repeated specialized mapping | Examples, then possibly fine-tuning | Retrieval alone does not teach a mapping |
| Exact authorization | Application code | Neither prompting nor training enforces access |
| Verifiable calculation | Deterministic service | Fluent generation is not arithmetic authority |
| Stable high-volume behavior | Evaluate tuning after baselines | Added lifecycle complexity must pay off |
Test Your Understanding
Try answering before expanding. Explain the missing assumption, not just the vocabulary.