RAG vs fine-tuning: which one do you need?
ComparisonBy Lucas Matías García TorresUpdated and checked 4 min read
Reviewed by Lucas Matías García Torres on . How we work.

Short answer
RAG adds knowledge to the prompt at question time; fine-tuning trains the model on examples so its behavior changes. Use RAG for private or fast-changing facts and answers that must cite sources, and fine-tuning for a fixed format, tone or narrow task. OpenAI advises starting with evals and prompt engineering, and many systems combine both. The costs differ in kind, so price each with your provider.
Prices and limits change often: check the vendor's page before you pay. How we make money.
RAG vs fine-tuning is the question behind most company chatbots: do you give the model the right information when someone asks, or do you change the model so it behaves the way you want? RAG (retrieval-augmented generation) adds knowledge to the prompt at question time. Fine-tuning trains a model on examples so its behavior changes. This guide compares them using what OpenAI, AWS, Anthropic and the original research papers say, checked on October 6, 2026, and ends with a decision guide.
What is the difference between RAG and fine-tuning?
Table: RAG and fine-tuning side by side
| Item | RAG | Fine-tuning |
|---|---|---|
| What changes | The prompt: retrieved passages are added to it | The model: it is trained on your examples |
| Good for | Facts and documents that are private or change often | A consistent task, format or style you can show with examples |
| Updating it | Update the documents and their embeddings | Run a new training job |
| Citing sources | Possible: the passages are known | Not built in: knowledge is spread across the weights |
| Main cost | Extra tokens in every request, plus a search index | A training run, plus the work of preparing examples |
The first four rows follow from how each method works and from AWS's description of RAG, which lists avoiding retraining, access to current information and source attribution among its benefits. The last row is our summary, not a vendor figure: price both with your provider's pricing page.
What does OpenAI say about fine-tuning?
OpenAI describes fine-tuning in its model optimization guide this way: "Fine-tuning lets you take an OpenAI base model, provide the kinds of inputs and outputs you expect in your application, and get a model that excels in the tasks you'll use it for." It lists these methods: supervised fine-tuning, direct preference optimization, reinforcement fine-tuning and vision fine-tuning.
It recommends fine-tuning when you need to give the model more examples than fit in a single context window, reduce token costs at scale, train on proprietary data or make a smaller model good enough for a task. Just as important, it says to start elsewhere: write evals that measure your model's output to establish a baseline, and note that "the prompt engineering process may be all you need in order to get great results".
How does LoRA make fine-tuning cheaper?
Training every weight of a large model is expensive. LoRA (low-rank adaptation), from a 2021 paper by Edward Hu and colleagues, freezes the pre-trained weights and injects small trainable matrices into each layer. For GPT-3 175B trained with Adam, the authors report reducing the number of trainable parameters by 10,000 times and the GPU memory requirement by 3 times, with model quality on par with or better than full fine-tuning and no extra latency at inference. Whatever method you use, the adapted model still has to fit in memory when you run it, which is the question in how much VRAM an LLM needs.
What does RAG add?
RAG leaves the model alone and changes what it reads. According to AWS, the system converts your documents into embeddings in a vector database, matches the user's question against them, adds the best passages to the prompt and keeps the index updated. Our guide to what RAG is walks through the steps and Anthropic's measured retrieval failure rates (5.7% at baseline, 1.9% with its best combination of techniques on its own test set). Retrieved text also takes up room in the context window, so the cost of RAG grows with how much you retrieve.
How to choose: a short decision guide
Ask these questions in order:
- Can a better prompt solve it? OpenAI says to try prompting and evals first. If the answer is yes, you need neither.
- Is the model missing information? Private documents, prices, policies or anything that changes weekly: use RAG. Retraining a model for facts that will be out of date next month is hard to maintain, and AWS lists avoiding retraining as a benefit of RAG.
- Do answers need to cite where they came from? RAG, because the passages are known and can be shown.
- Is the model missing behavior? A fixed output format, a house tone or a narrow task done thousands of times from examples: fine-tuning, which OpenAI also recommends when you want to cut tokens at scale or use a smaller model.
- Do you need both? Many systems fine-tune for behavior and use RAG for knowledge. They are complementary, so the answer to "RAG or fine-tuning" is sometimes "both, in that order of effort: prompt, then RAG, then fine-tuning".
Common mistakes
- Fine-tuning to teach facts. Information that changes is easier to maintain in documents you can update than in weights you must retrain, and a fine-tuned model has no built-in way to cite a source.
- Building RAG without measuring retrieval. If the right passage is not retrieved, the best model cannot use it. Test retrieval on a list of real questions before judging the answers.
- Skipping the evals. Without a baseline you cannot tell whether either method helped.
- Sending too much text. More retrieved passages cost more tokens and can dilute the answer, as the vendors warn about long contexts.
What to check before you invest
Which of your problems is knowledge and which is behavior; how often the information changes; whether answers must cite sources; who can see the documents you index; and what both options cost with your provider. For estimating the prompt side, use our LLM API cost calculator.
What we checked
- OpenAI says fine-tuning lets you take a base model, provide the inputs and outputs you expect and get a model that excels at your tasks; methods include supervised fine-tuning, direct preference optimization, reinforcement fine-tuning and vision fine-tuning; it is recommended for more examples than fit in a context window, lower token costs at scale, proprietary data and smaller models; and OpenAI advises writing evals first because prompt engineering may be all you need. (OpenAI, )
- LoRA (Edward Hu and colleagues, 2021) freezes the pre-trained weights and injects trainable rank decomposition matrices into each layer, reducing trainable parameters by 10,000 times and GPU memory by 3 times for GPT-3 175B compared with fine-tuning with Adam, with model quality on par or better and no additional inference latency. (arXiv, )
- AWS describes RAG in four steps (create external data in a vector database, retrieve relevant information, augment the prompt, update external data) and lists avoiding retraining, access to current information, source attribution and developer control as benefits. (Amazon Web Services, )
- Anthropic reports retrieval failures falling from a 5.7% baseline to 1.9% with contextual embeddings, contextual BM25 and reranking on its own test set. (Anthropic, )
- The RAG paper (Patrick Lewis and colleagues, 2020) describes models that combine pre-trained parametric and non-parametric memory for language generation. (arXiv, )
What may change
- Fine-tuning options and vendor guidance change as models and context windows grow; this page is reviewed yearly.
- Costs differ by provider and volume: this page gives no prices, so check each provider's pricing page.
Frequently asked questions
What is the difference between RAG and fine-tuning?
RAG changes what the model reads: relevant passages from your documents are added to the prompt when a question arrives. Fine-tuning changes the model: it is trained on your examples so its behavior shifts. RAG suits facts that change or must be cited; fine-tuning suits a consistent format, tone or task.
When should I fine-tune instead of using RAG?
OpenAI lists the cases for fine-tuning: you need more examples than fit in a single context window, you want to reduce token costs at scale, you train on proprietary data, or you want a smaller model to do the job. It also advises writing evals and trying prompt engineering first, which may be all you need.
Can RAG and fine-tuning be used together?
Yes. They are complementary: a model can be fine-tuned for a task, format or tone while RAG supplies current facts from your documents. A sensible order of effort is prompt and evals first, then RAG for knowledge, then fine-tuning for behavior if the evals show a gap.
What is LoRA?
LoRA (low-rank adaptation) is a way to fine-tune a large model cheaply. It freezes the pre-trained weights and adds small trainable matrices to each layer. The 2021 paper reports 10,000 times fewer trainable parameters and 3 times less GPU memory than full fine-tuning of GPT-3 175B, with no additional inference latency.
Is RAG cheaper than fine-tuning?
They cost different things. RAG adds retrieved tokens to every request and needs a search index; fine-tuning needs prepared examples and a training run. AWS lists avoiding retraining as a RAG benefit, but the real answer depends on your volume, so price both with your provider's pricing page.
Should a company chatbot use RAG or fine-tuning?
A chatbot that answers from help articles, policies or prices usually needs RAG, because that information changes and answers can show their sources. Fine-tuning fits when you need a fixed style or format across thousands of cases. Start by measuring a prompt baseline with real questions.
Sources
- Model optimization: fine-tuning, evals and prompt engineering (OpenAI API guide), OpenAI. Accessed October 6, 2026.
- LoRA: Low-Rank Adaptation of Large Language Models (Hu et al., 2021), arXiv. Accessed October 6, 2026.
- What is RAG (Retrieval-Augmented Generation)?, Amazon Web Services. Accessed October 6, 2026.
- Introducing Contextual Retrieval, Anthropic. Accessed October 6, 2026.
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., 2020), arXiv. Accessed October 6, 2026.
Spotted an error or an outdated price? Tell us and we will fix it.
Change history
- : First published from OpenAI's model optimization guide, the LoRA paper and AWS and Anthropic documentation.
Next review: .
Part of our Language Models Explained guide.
Keep reading
- What is RAG (retrieval-augmented generation)?
What RAG (retrieval-augmented generation) is, how it works step by step, when to use it instead of pasting everything into a prompt and how to improve it.
- What is a context window in a language model?
What a context window is, how big it is for Claude, GPT and Gemini in 2026, what happens when it fills up, why bigger is not always better and what it costs.
- What is a token in a language model?
What a token is in a language model, how many words it equals, why Spanish and French need more tokens than English (we measured it) and how they are billed.
- How much VRAM do you need to run an LLM locally?
Work out how much GPU memory a local LLM needs from its size, quantization and context length. Our formula is checked against 13 real model files.
- LLM API pricing compared, with a cost calculator
API prices for OpenAI, Anthropic, Google and DeepSeek models per million tokens, plus a calculator with caching, batch discounts and tokenizer differences.
Other topics

Assistants & Chatbots
16 guides

LLM APIs & Costs
11 guides

Agents & Automation
8 guides

Local Models & Hardware
11 guides