Fine-tune vs RAG vs Prompt
LoRA and QLoRA made fine-tuning cheap enough that you can train. This page is about whether you should. Before you spend a single GPU-hour, there are two ways to change a model’s behavior that involve no training at all — and they are often the right answer. The throughline for this whole part lands here: the cheapest training is the training you don’t do, so we hold every approach up against its cost in dollars, effort, and per-request latency.
Three tools, three jobs
Section titled “Three tools, three jobs”Prompt engineering changes behavior by changing the input. No training, no infrastructure — you rewrite the instructions, add a few examples, fix the output format. It is instant and free to iterate, and it is where you should always start. The cost is per-request: a longer prompt is more tokens, and tokens are latency and dollars on every single call, forever.
RAG (Retrieval-Augmented Generation) changes behavior by changing the knowledge available at inference time. You retrieve relevant documents and inject them into the prompt, so the model answers from current, citable facts it was never trained on. RAG is how you get freshness (today’s data, not the training cutoff) and provenance (a link to the source). The cost is a retrieval pipeline to build and run, plus extra context tokens per request.
Fine-tuning changes the weights — it bakes a behavior in. Use it to teach a consistent style or format, to nail a narrow task the base model fumbles, or to shorten prompts by moving instructions-and-examples out of the context window and into the weights. The cost is mostly one-time (the training run) plus hosting the adapter; in return, per-request prompts get shorter, which can lower ongoing inference cost.
They are complementary, not exclusive
Section titled “They are complementary, not exclusive”The framing “fine-tune or RAG” is a trap. Production systems stack all three: a model fine-tuned to always answer in your support voice and JSON schema, fed retrieved knowledge-base articles for the specific ticket, inside a prompt template that sets the task. Each tool does the job it is best at — the fine-tune fixes form, RAG supplies facts, the prompt orchestrates. They compose.
Cost, effort, and latency at a glance
Section titled “Cost, effort, and latency at a glance”| Dimension | Prompt | RAG | Fine-tune |
|---|---|---|---|
| Upfront cost | ~zero | Build retrieval pipeline | One training run (LoRA: cheap) |
| Per-request cost | Higher (long prompts) | Higher (retrieved tokens) | Lower (shorter prompts) |
| Iteration speed | Seconds | Hours–days | Hours–days per run |
| Best for | Behavior, format, quick wins | Fresh / large / citable knowledge | Style, format, narrow tasks |
| Knowledge freshness | Manual | Live (re-index) | Frozen at train time |
| Changes the weights? | No | No | Yes |
Notice the per-request column: prompt and RAG add tokens to every call, while fine-tuning can remove them by internalizing instructions. At low volume the prompt’s zero upfront cost wins; at high volume, a one-time fine-tune that trims 500 tokens off every request can pay for itself many times over. (The token-economy side of this — and how RAG keeps its injected context lean — is the subject of RAG efficiency.)
A practical decision guide
Section titled “A practical decision guide”Need fresher / external / citable knowledge? → RAGNeed a consistent style, format, or narrow skill? → fine-tuneJust need different behavior or output shape? → prompt (try this first)Prompt works but is enormous and high-traffic? → fine-tune to shorten itStill wrong after all three? → revisit the data / the base modelWork top-down and stop at the first tool that solves it. Reach for fine-tuning when a prompt can express the behavior but is too long, too brittle, or too slow to do so at your traffic — that is when baking it into the weights earns its one-time cost.
The architect’s lens
Section titled “The architect’s lens”This page is a decision, so turn the five questions on the choice itself:
- Why does it exist? Because the three tools change different things — prompt changes the input, RAG changes the retrieved knowledge, fine-tuning changes the weights — and conflating them wastes GPU-hours on problems a prompt could solve.
- What problem does it solve? Spending the right resource: “fine-tune for form, RAG for facts, prompt first,” so you don’t pay a training run for what a prompt edit fixes, nor re-train weights for knowledge that changes weekly.
- What are the trade-offs? Prompt and RAG add tokens to every call (higher per-request cost) while fine-tuning is one-time and can shorten prompts; at low volume the prompt’s zero upfront cost wins, at high volume a fine-tune that trims ~500 tokens/call pays back many times over.
- When should I avoid it? Don’t fine-tune to add facts — models memorize them poorly, you must retrain to update, and a 2024 study found new-knowledge fine-tuning can raise hallucination; use RAG for what the model should know.
- What breaks if I remove it? The composition — treating the three as exclusive is a trap; production stacks layer all of them (fine-tuned voice + retrieved facts + a prompt template), and dropping one forces another to do a job it’s bad at.
Check your understanding
Section titled “Check your understanding”- What does each of the three tools change — input, retrieval, or weights?
- State the “form / facts / first” mnemonic and what each word maps to.
- Why is it a mistake to treat fine-tuning and RAG as mutually exclusive?
- Per request, how does fine-tuning’s cost profile differ from prompt and RAG, and when does that flip the economics?
- A team wants their assistant to cite the latest internal docs. Which tool, and why not fine-tuning?
Show answers
- Prompt changes the input (instructions/examples), RAG changes the retrieved knowledge injected at inference, fine-tuning changes the model’s weights.
- “Fine-tune for form, RAG for facts, prompt first”: form = style/format/narrow skills (weights), facts = fresh/large/citable knowledge (retrieval), and you try a prompt before either.
- They solve different problems and compose — a single system can be fine-tuned for form, fed retrieved facts, and orchestrated by a prompt template all at once.
- Prompt and RAG add tokens to every request (higher per-request cost), while fine-tuning can shorten prompts and lower per-request cost; at high traffic, a one-time fine-tune that trims tokens off every call can outweigh its upfront cost.
- RAG — it provides fresh, citable knowledge from the live docs; fine-tuning memorizes facts poorly and would need retraining every time the docs change.