RAG vs fine-tuning: when to use each
Two ways to make a language model useful for your own work. RAG gives the model your documents at the moment it answers; fine-tuning changes the model itself by training it on your examples. The table compares them using documentation from AWS, Google, IBM, Red Hat, Databricks and OpenAI.
- Options compared
- 2 options compared
- Sources cited
- 16 sources cited
- Checked
- checked
Gives the model knowledge
Changes how the model behaves
- What changes
- Nothing in the model
- The model's weights
- Updating knowledge
- Minutes
- Hours to days
- Citing sources
- Yes
- No
Short answer
RAG gives a model knowledge
It looks up your documents at answer time and can cite them.
Fine-tuning shapes behaviour
It trains the model on your examples for a format, a task or a tone.
Try better prompts first, use RAG for facts that change, and fine-tune only when a measured gap remains.
Side by side
How we have used itFrom our own pages, not neutral sources- RAG (retrieval-augmented generation)RAG over legal case documentsRAG with retrieval, re-ranking and an evaluation set. For DecoverAI's legal platform, RAG over case documents on Pinecone and AWS EKS.
- Fine-tuningA small model for one taskA fine-tuned small open model (Phi-3.5) for a narrow pharma email task, benchmarked against a larger model on a fixed 150-sample test set.
- What changes
- RAGNothing in the modelNothing in the model. Relevant passages from your documents are retrieved and added to the prompt when a question comes in.
- Fine-tuningThe model's weightsThe model's weights. It is trained further on your labelled examples.
- Data you need
- RAGYour existing documentsYour existing documents, structured or not: PDFs, wikis, office files, database tables.
- Fine-tuningLabelled examples, 100+Labelled examples of input and the output you want. Google's docs suggest 100 or more; supervised tuning typically uses hundreds to thousands.
- Cost to build
- RAGUsually lowerUsually lower. The work is the data pipeline, the search index and the access rules.
- Fine-tuningUsually higherUsually higher: labelling data plus GPU time for training runs. Parameter-efficient methods such as LoRA reduce it.
- Cost to run
- RAGLonger prompts, plus an indexEvery answer carries the retrieved text, so prompts are longer, and a search index runs alongside the model.
- Fine-tuningShorter promptsPrompts can be shorter, and a small tuned model can stand in for a larger one. Serving a fully fine-tuned model can cost more.
- Updating knowledge
- RAGMinutesMinutes: add or change a document and re-index it.
- Fine-tuningHours to daysHours to days per training run, and what the model knows is a snapshot of its training data.
- Citing sources
- RAGYesYes. Answers can point to the passages they used, so people can check them.
- Fine-tuningNoNo. A fine-tuned model does not say where an answer came from.
- Main risks
- RAGMissed or leaked passagesThe search misses the right passage; a stale or poisoned index; weak access rules that leak data between users.
- Fine-tuningHallucination, forgettingMore hallucination when used to answer questions; forgetting earlier skills; training data that can be exposed later.
- Best for
- RAGChanging documents, cited answersQuestions over your own documents that change, where answers must cite a source.
- Fine-tuningFormat, tone, narrow tasksFixed output formats, classification, extraction or tone, or a smaller, cheaper model for one narrow task.
Sources read on 27 November 2026.
Start with prompting
Both Google's and OpenAI's tuning guides say to start with prompt engineering and move to fine-tuning only if needed. If your reference material is small enough to fit in the prompt, you may not need RAG either. Each step adds build and running cost, so take it only when a test shows the simpler step falls short.
- PromptingStart here
- RAGAnswers need your changing documents
- Fine-tuningA measured gap remains
Build and running cost
When RAG fits
Use RAG when answers depend on documents that change, or when people need to see the source. AWS recommends starting from RAG for question answering over your own documents, because new documents can be added in minutes and answers can cite them.
Production RAG still takes data engineering: ingestion, chunking, an index that stays current, and access rules so each user only retrieves what they are allowed to see.
- A question comes in
- Search your documentsOnly what this user may see
- Add the passages to the prompt
- Answer with citationsPeople can check the source
New or changed document: re-index it in minutes.
When fine-tuning fits
Use fine-tuning when the model needs to behave differently, not know more: a strict output format, classification, entity extraction, a house style, or a narrow task where a small tuned model can replace a large general one and cut the cost per call.
It needs a few hundred or more good labelled examples, and someone who can run training and judge the results. Parameter-efficient fine-tuning (PEFT), such as LoRA, trains a small set of extra weights instead of the whole model, which lowers the compute and storage needed.
- Labelled examplesA few hundred or more
- Training runHours to days; LoRA cuts the compute
- Updated weightsA snapshot of the training data
- Narrow task outputFormat, extraction, classification or tone
Using both
The two are not exclusive. AWS describes keeping a RAG architecture unchanged while the model that writes the answer is also fine-tuned: retrieval supplies current facts, tuning supplies the format and domain language.
Retrieval (RAG) supplies
- Current facts
- Sources to cite
Fine-tuning supplies
- The output format
- Domain language
How to test the choice
This is how we decide on projects, so treat it as our method rather than a standard:
- Collect a fixed set of real examples with known right answers before building anything.
- Score a prompt-only baseline on that set first.
- Add RAG and score again; fine-tune only if a gap remains that retrieval does not close.
- Compare accuracy, cost per answer and response time, and rerun the set on every change to prompts, data or model.
- Fixed test setReal examples with known right answers
- Prompt-only baselineScore it first
- Add RAGScore again
- Fine-tuneOnly if a gap remains
Rerun the set on every change to prompts, data or model.
A note on OpenAI fine-tuning
OpenAI is winding down self-serve fine-tuning. From 15 December 2026 no organization can create new self-serve fine-tuning jobs; existing fine-tuned models keep running until OpenAI retires their base model. Google's Gemini tuning and fine-tuning of open-weight models with PEFT remain available.
- 15 December 2026No new self-serve fine-tuning jobs
- Existing fine-tuned modelsKeep running
- Base model retiredIts fine-tuned models go with it
Still available: Gemini tuning, and PEFT on open-weight models.
Frequently asked questions
For answering questions over your own documents it is usually cheaper to start, new documents can be added in minutes instead of a training run, answers can cite their sources, and AWS notes a lower risk of hallucination. Fine-tuning is still the better fit for formats, classification and tone.
Yes, for changing behaviour: formats, classification, extraction and making a small model good at one task. Vendor support is shifting, though. OpenAI stops new self-serve fine-tuning jobs on 15 December 2026, while Google still supports tuning and open-weight models can be fine-tuned with PEFT.
Full fine-tuning updates all of a model's parameters. Parameter-efficient fine-tuning (PEFT), such as LoRA, freezes the original weights and trains a small set of extra ones, which needs far less compute and storage and can work with a smaller dataset.
The API steps are short, but the hard parts are collecting good labelled data, running training and evaluating the result. Vendor guides say it needs experience with model training and evaluation, and often a data scientist.
Yes. Retrieval supplies current facts at answer time, and the model that writes the answer can also be fine-tuned for format and domain language. Test each step against the same set of examples to see what it adds.
Sources
Show the 16 public sources
- Comparing Retrieval Augmented Generation and fine-tuning (AWS Prescriptive Guidance) (opens in a new tab) (docs.aws.amazon.com)
- What is RAG? (AWS) (opens in a new tab) (aws.amazon.com)
- RAG vs. fine-tuning (Red Hat, May 2026) (opens in a new tab) (www.redhat.com)
- RAG vs. fine-tuning (IBM Think, August 2024) (opens in a new tab) (www.ibm.com)
- RAG on Databricks (Databricks docs) (opens in a new tab) (docs.databricks.com)
- Model tuning overview (Google Cloud, Gemini) (opens in a new tab) (docs.cloud.google.com)
- Model optimization (OpenAI docs) (opens in a new tab) (developers.openai.com)
- Fine-tuning best practices (OpenAI docs) (opens in a new tab) (developers.openai.com)
- Deprecations: update to self-serve fine-tuning (OpenAI docs) (opens in a new tab) (developers.openai.com)
- Introducing Contextual Retrieval (Anthropic) (opens in a new tab) (www.anthropic.com)
- PEFT (Hugging Face docs) (opens in a new tab) (huggingface.co)
- LoRA conceptual guide (Hugging Face docs) (opens in a new tab) (huggingface.co)
- LoRA: Low-Rank Adaptation of Large Language Models (Hu et al., 2021) (opens in a new tab) (arxiv.org)
- What is catastrophic forgetting? (IBM Think) (opens in a new tab) (www.ibm.com)
- LLM08:2025 Vector and Embedding Weaknesses (OWASP GenAI) (opens in a new tab) (genai.owasp.org)
- LLM02:2025 Sensitive Information Disclosure (OWASP GenAI) (opens in a new tab) (genai.owasp.org)
Find out what to build first
Start with the free AI readiness assessment and get a written report by email, or book a 30-minute strategy call with the founder.
Changelog
- 1 December 2026: Figures added.
- 27 November 2026: Page published.