Frontier Foundry

RAG vs Fine-tuning

34 sourced facts · updated

RAG 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

RAGFine-tuning
Where the knowledge livesIn 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 forFacts 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 changeRe-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 goesInto 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 wrongThe 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 itMeasure 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]

Each one on its own

from their concept pages

What is RAG?

Retrieval-augmented generation looks up relevant documents when a question arrives and places them in the prompt. The model then answers from that text and not from memory alone. It gives a model current and private facts without retraining, and the answer is only as good as what was fetched.

Retrieval-augmented generation fetches relevant pieces of a document set at question time and puts them in front of the model. The sources describe a pipeline: documents are cut into chunks and filed by meaning and by exact words; a question fetches a short list, merged and reranked; the model answers from it and a check can refuse figures it cannot trace. Its limits are a short desk, a chunk size no one gets right for every query, and answers that can come from the wrong page.

about 2,000 characters
Size a chunk is packed to before it is cut, in one rulebook assistant (reported by the builders) Nina Žižakić
top 50 + top 50 to 30 to 10
Candidates per list, kept after fusion, and given to the agent (reported by the builders) Eleonora Drykina
2 to 4 calls
Search calls most questions need; the prompt asks the agent to reconsider before the sixth (reported by the builders) Eleonora Drykina

RAG, explained in full: how it works as a machine, every part and its sources.

What is Fine-tuning?

Fine-tuning continues the training of an existing model on a smaller set of examples for one task or style. The model keeps most of what it knows and shifts toward the new data. It buys behaviour that prompting cannot reach, at the cost of data, compute and one more model to maintain.

Fine-tuning continues the training of a base model on a team's own labeled examples so it takes on a task, a format or a style. Most teams train a small adapter on top of frozen weights, score it on cases it never saw, and serve it. The sources agree that the training run is the short part: the examples before it and the regressions after it take the time.

3K or 9K trajectories
Fixed number of SFT training trajectories in an experiment that varied only which verifier filtered them; the better verifier gave the better model at both sizes (Browserbase and Microsoft Research) Corby Rosset
22.6 GB
Peak GPU memory when tuning a 3B-parameter model on a math set with a LoRA variant that reached 53.2% test accuracy, as measured by Hugging Face Hugging Face
about a week
Time for one full cycle of gathering data, labeling, tuning, iterating and deploying a fix in one production workflow, reported by the team's data scientist Dan Bjornn

Fine-tuning, explained in full: how it works as a machine, every part and its sources.

In AI coverage over the last four weeks, RAG took 0.81% and Fine-tuning 2.7%. RAG, week by week

The facts behind this page

34 facts from the two knowledge packs
  1. If the model's output behavior or structure is off, curate data and do supervised fine-tuning; if it lacks dynamic facts, use retrieval instead. Sequoia · 2026-08-12 · Fine-tuning
  2. What belongs in the weights is what has stopped changing; the speaker's only axis for choosing between prompt, memory and weights is rate of change. Anant Srivastava, AI Engineer · 2026-10-04 · Fine-tuning
  3. Every answer must cite the exact rulebook, section and page, and the assistant must not answer from the model general knowledge of other payment schemes. Nina Žižakić, AI Engineer · 2026-10-12 · RAG
  4. Decagon says new agent use cases start on frontier APIs, and only once a use case is stable and being rolled out does an enterprise have a strong incentive to move it to a fine-tuned open model; so open-source share of enterprise inference can fall while new use cases spin up. a16z · 2026-07-31 · Fine-tuning
  5. In a managed RAG pipeline the query is optionally rewritten and embedded, vector and keyword search run in parallel, the lists are fused and optionally reranked, and the top chunks are either returned or passed to a generation model. cloudflare · 2026-10-01 · RAG
  6. LoRA adds a handful of parameters on top of the base model, freezes the base weights, and trains only those few parameters. Hugging Face · 2026-06-18 · Fine-tuning
  7. LoRA trains small adapter matrices while the original weights stay frozen, which cuts the trainable parameters and the memory their gradients and optimizer state need. Hugging Face · 2026-11-12 · Fine-tuning
  8. Numbers are stored with value, unit, scale and period, in a registry, and the model must cite those facts rather than write numbers. Vinoo Ganesh, AI Engineer · 2026-10-25 · RAG
  9. What to tune a model on is reflexes, such as the format of the input and which of several formats is right, and not facts, which change and would need large training data. Anant Srivastava, AI Engineer · 2026-10-04 · Fine-tuning
  10. An embedding is cached compute: parsing and embedding a codebase is a one-time cost, and at run time the agent queries it and saves tokens, time and money. AI Engineer · 2026-04-10 · RAG
  11. about a week: Time for one full cycle of gathering data, labeling, tuning, iterating and deploying a fix in one production workflow, reported by the team's data scientist Dan Bjornn, AI Engineer · 2026-06-30 · Fine-tuning
  12. The catalog that leaked into the weights. A support assistant was tuned on six months of tickets. When a new product catalog was later pasted into the prompt, the assistant still gave product names that did not exist, because the old catalog had been baked into the weights. Anant Srivastava, AI Engineer · 2026-10-04 · Fine-tuning
  13. In NVIDIA's RAG Blueprint the LLM is the largest contributor to latency, followed by the reranker; the team scales the LLM service on time to first token (p90 above 2 seconds) and the reranker when its GPU use passes 75%. nvidia · 2025-12-12 · RAG
  14. 38 seconds: Median time to answer, the cost of letting the agent search more than once (reported by the builders) Eleonora Drykina, AI Engineer · 2026-10-12 · RAG
  15. Fine-tuning is memory-hungry: you generally need enough memory to fit the whole model several times over, which is why parameter-efficient techniques emerged. Hugging Face · 2026-06-18 · Fine-tuning
  16. 5 to 10 times: Cost reduction claimed for a post-trained model against a frontier model for one application, reported by the host of a tuning platform Sequoia · 2026-08-12 · Fine-tuning
  17. The wrong source, the wrong number. Attaching sources after the fact does not help when retrieval pulled the wrong source (a blog with a wild price), or the right source and the wrong number: a 17 in a filing may be millions, billions or yen, or an earlier year. Vinoo Ganesh, AI Engineer · 2026-10-25 · RAG
  18. Fix one thing, break another. A tuned message classifier fixed the problem it was retrained for but caused regressions elsewhere. In production it answered a confirmation with a phone call to the customer. Each fix became a week-long game of whack-a-mole. Dan Bjornn, AI Engineer · 2026-06-30 · Fine-tuning
  19. Tuning on domain tasks can cause catastrophic forgetting and degrade general performance, and the paper reports that full SFT suffers severe forgetting on general tasks. Hugging Face · 2026-08-04 · Fine-tuning
  20. Under each answer the assistant lists the sources it used, naming rulebook and section, so that the user can open the rulebook. Nina Žižakić, AI Engineer · 2026-10-12 · RAG
  21. A post-processing filter refuses citations that cannot be verified, so a number that is not cited cannot appear in the output. Vinoo Ganesh, AI Engineer · 2026-10-25 · RAG
  22. Green evals, a sleeper in the weights. A fine-tuned model can pass every eval and behavioural monitor and still carry a backdoor: on one ordinary cue, such as a date in the prompt, it starts writing exploitable code. Sachin Kumar of LexisNexis shows the usual defences are blind because they only watch behaviour. Sachin Kumar, AI Engineer · 2026-06-29 · Fine-tuning
  23. 32 to 128 poisoned examples: Poisoned fine-tuning examples needed to install a backdoor in an internal constitutional classifier, per Anthropic; a small, near-constant number regardless of training-set size Anthropic · 2026-04-24 · Fine-tuning
  24. To tell a retrieval problem from a generation problem, measure the retriever on its own: most teams tweak prompts, chunking and models without knowing whether the retriever surfaced the right context in the first place. mistral · 2026-05-28 · RAG
  25. After each tuning run the team evaluated the model on held-out sets and checked its metrics before deploying. Dan Bjornn, AI Engineer · 2026-06-30 · Fine-tuning
  26. The frontier is regression-aware improvement: when fixing a new failure, verify that the old ones are not forgotten. Soheil Feizi, AI Engineer · 2026-06-29 · Fine-tuning
  27. Should a team tune its own model, or buy a frontier model and give it better context? Fine-tune only when you cannot call a frontier model; the tuned model became tech debt and a rebuilt context-based system beat it. Dan Bjornn, AI Engineer · 2026-06-30 · Fine-tuning
  28. After rebuilding around prompts and skills, a fix went from discovery to deployment in under an hour, at a somewhat higher cost per message. Dan Bjornn, AI Engineer · 2026-06-30 · Fine-tuning
  29. 90.5% to 96.1% (chat-langchain); 83.2% to 91.3% (Fleet): Accuracy of a Qwen-3.5-35B 'perceived error' trace judge before and after LoRA SFT, against Claude Opus 91.6% and 90.2% and GPT-5.5 98.9% and 89.1%, measured by LangChain and Fireworks langchain · 2026-06-15 · Fine-tuning
  30. Should a team tune its own model, or buy a frontier model and give it better context? For a high-volume, narrow classification job a tuned open model beats buying a frontier model: LangChain's tuned 35B open trace judge matched frontier accuracy and ran 10-100x cheaper. langchain · 2026-06-15 · Fine-tuning
  31. 46% to over 90%: Function-calling success of a 270M-parameter model on an app task before and after tuning on synthetic data, eight of ten functions over 90%, reported by Google Cormac Brick, AI Engineer · 2026-04-08 · Fine-tuning
  32. For a tiny on-device model, the usual workflow is to create the dataset synthetically with a larger model and upload it to a tuning tool, instead of listing the functions in a system prompt. Cormac Brick, AI Engineer · 2026-04-08 · Fine-tuning
  33. Should a team tune its own model, or buy a frontier model and give it better context? Do not rush to tune: the free improvements of frontier models can beat the gains from retraining, so the fair comparison is against whatever ships while you maintain your fine-tune, and the data and upkeep cost far more than the $500 training run. h_mirin, Hacker News · 2026-07-28 · Fine-tuning
  34. Should a team tune its own model, or buy a frontier model and give it better context? After product-market fit, post-training on your own data can cut serving cost five to ten times and bakes your product's taste into a model nobody can copy. Sequoia · 2026-08-12 · Fine-tuning

Cite this page

the version of 2026-12-02
APA
Han, R. (2026, December 2). RAG vs Fine-tuning: what is the difference?. Frontier Foundry. https://www.ryanhan.ai/compare/rag-vs-fine-tuning
BibTeX
@misc{han2026-compare-rag-vs-fine-tuning,
  author       = {Han, Ryan},
  title        = {{RAG vs Fine-tuning: what is the difference?}},
  howpublished = {Frontier Foundry},
  year         = {2026},
  month        = dec,
  url          = {https://www.ryanhan.ai/compare/rag-vs-fine-tuning}
}

More comparisons

all of them