RAG vs Fine-tuning
34 sourced facts · updatedRAG or fine-tuning: which should you use?
Use RAG when the model needs facts that change or are private and each answer should point to where it came from; use fine-tuning to teach behavior that has stopped changing, such as a format, a judgment or a style. The rule of thumb in the sources: if the model lacks facts, retrieve them; if its output's structure or behavior is off, tune it. Most teams start with a frontier model and better context, and tune only once a use case is stable. [1][2][3][4]
In the knowledge graph: Facts that change belong in retrieval, so the weights only carry behavior and format.
The difference between RAG and Fine-tuning
| RAG | Fine-tuning | |
|---|---|---|
| Where the knowledge lives | In documents outside the model: a question is embedded, searched by meaning and by keyword, and the top chunks are put in the prompt. [5] | In the weights: the model is trained further on example prompts and answers, usually through a small adapter on frozen base weights. [6][7] |
| What it is good for | Facts that change or are private: rulebooks, filings, prices, each answer citing its page. [3][8] | Reflexes that have stopped changing: an input format, which of several formats is right, a judgment, a tone. [9][2] |
| When the facts change | Re-file the changed documents: parsing and embedding is a one-time cost per document, and the model is untouched. [10] | Retrain: one team's full cycle of data, labels, tuning and deploy took about a week, and an old catalog baked into the weights kept coming back. [11][12] |
| Where the cost goes | Into every request: the LLM and the reranker are the largest parts of latency, and an agent that searches several times answered in a median 38 seconds. [13][14] | Into training: tuning needs memory several times the model's size, which is why adapters exist; in return a tuned model can be 5 to 10 times cheaper to serve than a frontier one for one application. [15][16] |
| How it goes wrong | The wrong page: retrieval pulls the wrong source, or the right source and the wrong number, and the model answers from it. [17] | Regressions and forgetting: a tune fixes its target and breaks something else, and full fine-tuning on a domain can degrade general abilities. [18][19] |
| Can you trace an answer? | Yes, by design: answers can carry rulebook, section and page, and a filter can refuse any figure that matches no registered source. [20][21] | Not to a document: a tuned model can pass every eval and still carry a backdoor that 32 to 128 poisoned examples were enough to install. [22][23] |
| How to check it | Measure the retriever on its own first, so a retrieval problem is not mistaken for a generation problem. [24] | Score the tune on held-out cases, and on what it forgot as well as what it learned. [25][26] |
When to use RAG
- The facts change: prices, catalogs, filings, rules. A support assistant tuned on six months of tickets kept naming products that no longer existed, even after the new catalog was pasted into its prompt. [12][1]
- Answers have to be checkable: each can carry the source, section and page it came from, and figures that match no registered source can be refused before they reach the reader. [3][21][20]
- You can call a frontier model and would rather not own one: one team's tuned model became tech debt, and a rebuilt context-based system beat it, with fixes shipped in under an hour. [27][28]
When to use Fine-tuning
- The output's format or behavior is wrong, not its facts: curate examples and tune on them. [1][9]
- The job is narrow and high-volume: LangChain's open trace judge rose from 90.5% to 96.1% accuracy after LoRA tuning and ran far cheaper than frontier models of similar accuracy. [29][30]
- A small model has to run on a device: a 270M-parameter model went from 46% to over 90% function-calling success after tuning on synthetic data from a larger model. [31][32]
Using RAG and Fine-tuning together
They fill different gaps, so one system can use both: tune the reflexes (the input format, which tool to call) and retrieve the facts. The sources sort what goes where by how fast it changes: what has stopped changing can go into the weights, what still changes stays in the prompt or the index. [2][9][1]
Should a team tune its own model, or give a frontier model better context?
The sources disagree. One says tune only when you cannot call a frontier model, since frontier models improve for free while a tune has to be maintained. Others say that after product-market fit, post-training on your own data can cut serving cost five to ten times, and that a narrow, high-volume classifier is cheaper as a tuned open model. [27][33][34][30]