---
title: "RAG vs fine-tuning: how to choose | Royan AB"
url: https://royan.se/guides/rag-vs-fine-tuning/
lang: en
description: "RAG, fine-tuning or a better prompt? A decision matrix, three worked examples, when you need neither and how to measure, with links to vendor docs and papers."
---
# RAG, fine-tuning or a better prompt: choose by the task.

Choose RAG when the model must answer from your own documents, stay current and show its source. Choose fine-tuning when it must do one narrow task the same way every time, such as a format, a set of labels or a tone, or when a smaller model must do the job of a larger one. Start with a better prompt and a test set: many tasks need neither, and some need both.

[Tell us about the task](mailto:contact@royan.se?subject=RAG%20or%20fine-tuning&body=Company%3A%0AWhat%20the%20AI%20should%20do%3A%0AData%20and%20systems%20it%20will%20use%3A%0APersonal%20data%20%28yes%2Fno%29%3A%0ADecision%20first%2C%20or%20build%20now%3A%0A) [Our RAG review](https://royan.se/consulting/#rag-review)

Reviewed 27 November 2026

## At a glance

Prompting changes the instructions, RAG changes what the model can read, and fine-tuning changes the model itself. RAG gives answers with a source and facts that stay current; fine-tuning gives the same behaviour every time and can let a smaller model do the job. Research and vendor documentation agree that fine-tuning is a weak way to add new facts. Start with a prompt and a test set, and measure.

## Three different levers

**Prompting** changes the instructions and examples you send with each request. **RAG** (retrieval-augmented generation) searches your documents first and puts the passages it finds into the prompt, so the model answers from them; the method was described by [Lewis et al. in 2020](https://arxiv.org/abs/2005.11401). **Fine-tuning** trains an existing model further on your examples, so the behaviour is in the model's weights.

OpenAI's guide to [optimizing LLM accuracy](https://developers.openai.com/api/docs/guides/optimizing-llm-accuracy) puts it as two problems. If the model lacks the right facts, that is a context problem: give it the facts in the prompt, or with RAG at scale. If it has the facts but does not act the right way every time, that is a behaviour problem: fine-tuning can help. The guide also says that these are not steps in a fixed order but levers for different problems, and that prompt engineering is often the only method needed for tasks such as summarising, translating and writing code.

## Decision matrix

| Question | Better prompt | RAG | Fine-tuning | RAG and fine-tuning |
|---|---|---|---|---|
| Best for | The first step for any task. Often enough for summaries, translation and code (OpenAI). | Answers from your documents, facts that change, access per user. | One narrow task that repeats: a format, classification, extraction, a tone (OpenAI, Google). | Both problems at once: current facts and a fixed way of answering (OpenAI). |
| Data needed | A few examples and a test set. | Your documents in a readable state, their access rights, and test questions with known answers. | Labelled examples of the task. OpenAI: at least 10, start with 50. Google: think 100 or more; hundreds to thousands for supervised tuning. | Both. Train on examples that include the retrieved text (OpenAI). |
| Citations | Only if you paste the source into the prompt. | Yes. The answer can point to the passage it used. Anthropic's API returns the exact supporting passages. | No. What the model learned has no link to a source. | Yes, from the RAG part. |
| Freshness | As current as what you paste in. | Update the index; no new training. | Fixed at training time. New facts need a new training run. | Facts stay current through RAG; retrain only when the task changes. |
| Cost drivers | Long prompts cost tokens on every call. | Ingestion, search, tuning the retrieval, longer prompts with retrieved text. | Collecting and cleaning examples, training runs, evaluation and hosting; shorter prompts per call later (OpenAI, Google). | Both, and slower changes: you tune the retrieval and retrain the model (OpenAI). |
| Hosting and EU | Wherever the model runs. | Documents and index can stay in your own environment or an EU region. Check each managed service. | An open model with a LoRA adapter can run on your own servers or with an EU host. Hosted fine-tuning depends on the vendor. | As for each part. |

Sources for the matrix: OpenAI [Optimizing LLM accuracy](https://developers.openai.com/api/docs/guides/optimizing-llm-accuracy), [Model optimization](https://developers.openai.com/api/docs/guides/model-optimization) and [Supervised fine-tuning](https://developers.openai.com/api/docs/guides/supervised-fine-tuning); Google Cloud [Introduction to tuning](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/tuning); Anthropic [Citations](https://platform.claude.com/docs/en/build-with-claude/citations); Hugging Face [LoRA](https://huggingface.co/docs/peft/main/en/conceptual_guides/lora). All fetched 27 November 2026.

## Why fine-tuning is a weak way to add facts

A study by [Ovadia et al. (2023)](https://arxiv.org/abs/2312.05934) compared unsupervised fine-tuning with RAG on knowledge-heavy tasks. RAG did better, both for knowledge the model had seen in training and for new knowledge, and the models struggled to learn new facts through fine-tuning. OpenAI's own example points the other way for behaviour: on a task about correcting Icelandic sentences, a model fine-tuned on 1,000 examples scored higher than few-shot prompting, and adding RAG lowered the score by four points, because the task needed a skill, not more context ([OpenAI](https://developers.openai.com/api/docs/guides/optimizing-llm-accuracy)).

So: facts in a search index, skills and formats in the weights.

## Three worked examples

These are made-up examples to show the reasoning. They are not client cases.

### Example 1: an assistant for the staff handbook

A company has a few thousand policy documents for HR and IT. They change every month, staff must see where an answer comes from, and some documents are only for managers. **Choice: RAG** with access rights in the search step and a source with every answer. No fine-tuning: the problem is facts that change, and fine-tuning would freeze them. If the material were small, the whole of it could go into the prompt instead (see below). Our page on an [internal knowledge base](https://royan.se/solutions/internal-knowledge-base/) covers this case.

### Example 2: sorting support emails

A support team gets many emails a day and wants each one sorted into one of twelve categories, as JSON in a fixed format. It has thousands of emails that people have already sorted. **Choice: a prompt first, then fine-tuning if needed.** Build a test set from the sorted emails and measure a prompt with examples. If it misses the target, or costs too much per email at that volume, fine-tune a smaller model on the sorted emails. No RAG: the task is a skill, and every answer is one of twelve labels.

### Example 3: reply drafts in the company's tone

A company wants draft replies to customers in Swedish, in its own tone, that quote the current terms and prices correctly. A person approves each draft before it goes out. **Choice: RAG for the facts, and fine-tuning only if prompting cannot hold the tone.** Terms and prices come from the search index, so they stay current. If the tone still drifts on the test set, a model fine-tuned on approved replies, with the retrieved text in each training example, handles the style.

## When you need neither

- **A good prompt meets the target.** Clear instructions and a few examples reach the accuracy you set on your test set. Stop there.
- **The material fits in the prompt.** Anthropic writes that if a knowledge base is smaller than 200,000 tokens (about 500 pages), you can put all of it in the prompt with no need for RAG, and use prompt caching to cut cost and delay ([Anthropic](https://www.anthropic.com/research/contextual-retrieval), 19 September 2024). Our founder compares the two in [1M-token context: do you still need RAG?](https://amirteymoori.com/1m-token-context-window-vs-rag-llm-2026/).
- **A ready product does the job.** An assistant that is already in your office suite can be enough for general questions on your own files. Our [internal knowledge base page](https://royan.se/solutions/internal-knowledge-base/) says when.
- **The problem is not the model.** Documents that are out of date, a process nobody owns or a goal you cannot measure are not fixed by RAG or fine-tuning.

## How to measure

1. **Set the target first.** Decide what accuracy is good enough for the task and what an error costs. OpenAI's advice: let the accuracy target be the goal, not the most advanced method ([OpenAI](https://developers.openai.com/api/docs/guides/optimizing-llm-accuracy)).
2. **Build a test set before you choose.** Real questions or inputs with the expected answer. Keep a part of it that you never train on ([OpenAI](https://developers.openai.com/api/docs/guides/supervised-fine-tuning)).
3. **For RAG, measure two things.** Did the search find the right passage, and did the answer use it correctly? A wrong answer can come from either step. How you split documents matters for the first: see [RAG text chunking strategies](https://amirteymoori.com/rag-text-chunking-strategies/). Anthropic reports that adding context to each chunk cut failed retrievals by 49 %, and by 67 % with re-ranking, in its own tests ([Anthropic](https://www.anthropic.com/research/contextual-retrieval)).
4. **For fine-tuning, compare with the base model.** Same test set, same prompt. The fine-tuned model goes live only if it wins.
5. **Track cost and speed too.** Cost per call and response time can decide between two options that are equally accurate.
6. **Use a model as a judge with care.** Automatic grading scales, but check it against people: [LLM-as-judge evals for support AI agents](https://amirteymoori.com/llm-as-judge-eval-pipelines-customer-support-ai/).

## Vendor facts that change

Checked on 27 November 2026 on each vendor's own page:

- **OpenAI** is winding down self-serve fine-tuning. Since 7 May 2026, organisations that have never run a fine-tuning job cannot create one, and from 15 December 2026 no organisation can create new self-serve fine-tuning jobs. Existing fine-tuned models can still be used until OpenAI retires their base model ([OpenAI deprecations](https://developers.openai.com/api/docs/deprecations)). OpenAI offers data residency in Europe for eligible API customers ([OpenAI](https://openai.com/index/introducing-data-residency-in-europe/)).
- **Google Cloud** supports supervised fine-tuning, preference tuning and reinforcement learning fine-tuning of Gemini models, and says to start with prompting and tune only if needed ([Introduction to tuning](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/tuning), updated 24 November 2026). Its RAG Engine lists European regions, but the same page says data residency is not supported for it ([RAG Engine overview](https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/rag-engine/rag-overview), updated 20 November 2026).
- **Anthropic**'s Claude API has a citations feature that returns the exact passages that support each claim ([Citations](https://platform.claude.com/docs/en/build-with-claude/citations)).
- **Open models.** Hugging Face's [PEFT library](https://huggingface.co/docs/peft/index) fine-tunes a small number of extra parameters instead of the whole model. A [LoRA](https://huggingface.co/docs/peft/main/en/conceptual_guides/lora) adapter can be merged into the base model, so it adds no delay when the model runs. The [LoRA paper](https://arxiv.org/abs/2106.09685) reports that, compared with full fine-tuning of GPT-3 175B, LoRA can cut the number of trainable parameters 10,000 times and the GPU memory need three times.

## How Royan AB can help

We build [RAG systems](https://royan.se/services/rag/) with citations and access rights, and [fine-tune small open models](https://royan.se/services/fine-tuning/) with LoRA that run on your servers or in the EU. When you are not sure which one you need, the [RAG review](https://royan.se/consulting/#rag-review) on our [AI consulting](https://royan.se/consulting/) page starts with your documents and your test questions. Our founder has written about [fine-tuning with LoRA](https://amirteymoori.com/fine-tuning-llms-with-lora-a-practical-guide-for-2025/) and [fine-tuning Gemma 4 for English-to-Swedish translation](https://amirteymoori.com/fine-tune-gemma-4-e4b-english-swedish-translation/).

## Sources

All sources were fetched and read on 27 November 2026. A date after a source is the date the page itself shows.

- [OpenAI: Optimizing LLM accuracy](https://developers.openai.com/api/docs/guides/optimizing-llm-accuracy).
- [OpenAI: Model optimization](https://developers.openai.com/api/docs/guides/model-optimization).
- [OpenAI: Supervised fine-tuning](https://developers.openai.com/api/docs/guides/supervised-fine-tuning).
- [OpenAI: Deprecations, update to OpenAI's self-serve fine-tuning](https://developers.openai.com/api/docs/deprecations).
- [OpenAI: Introducing data residency in Europe](https://openai.com/index/introducing-data-residency-in-europe/).
- [Anthropic: Citations (Claude Platform Docs)](https://platform.claude.com/docs/en/build-with-claude/citations).
- [Anthropic: Introducing Contextual Retrieval](https://www.anthropic.com/research/contextual-retrieval). Published 19 September 2024.
- [Google Cloud: Introduction to tuning](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/tuning). Updated 24 November 2026.
- [Google Cloud: RAG Engine overview](https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/rag-engine/rag-overview). Updated 20 November 2026.
- [Hugging Face: PEFT](https://huggingface.co/docs/peft/index) and [LoRA conceptual guide](https://huggingface.co/docs/peft/main/en/conceptual_guides/lora).
- [Lewis et al.: Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks](https://arxiv.org/abs/2005.11401). arXiv, submitted 22 May 2020.
- [Hu et al.: LoRA: Low-Rank Adaptation of Large Language Models](https://arxiv.org/abs/2106.09685). arXiv, submitted 17 June 2021.
- [Ovadia et al.: Fine-Tuning or Retrieval? Comparing Knowledge Injection in LLMs](https://arxiv.org/abs/2312.05934). arXiv, submitted 10 December 2023.

FAQ

## Questions about RAG and fine-tuning.

### What is the difference between RAG and fine-tuning?

RAG searches your documents and gives the passages to the model with each question, so answers can cite a source and stay current. Fine-tuning trains the model further on your examples, so it does one task in the same way every time. RAG changes what the model reads; fine-tuning changes the model.

### Can fine-tuning teach a model our company's facts?

Poorly. A 2023 study by Ovadia et al. found that RAG did better than unsupervised fine-tuning for both known and new knowledge, and that models struggle to learn new facts through fine-tuning. Facts also go out of date in the weights. Put facts in a search index and use fine-tuning for format, tone and narrow skills.

### How much data does fine-tuning need?

OpenAI's documentation gives a minimum of 10 examples and recommends starting with 50 good ones. Google's says to think of 100 examples or more, and hundreds to thousands for supervised tuning. Quality matters more than the number, and the examples must look like real use.

### Can we use RAG and fine-tuning together?

Yes. OpenAI describes the combination for tasks that need both current facts and fixed behaviour, and advises training on examples that include the retrieved text. The cost is slower change, because you tune the retrieval and retrain the model.

### Do we need RAG if the model has a long context window?

Not always. Anthropic writes that a knowledge base under about 200,000 tokens, roughly 500 pages, can go straight into the prompt, with prompt caching to cut cost. Larger or fast-changing material, or documents with access rights per user, still need retrieval.

### Can we still fine-tune OpenAI models?

Only for a short time, and only for some organisations. OpenAI's deprecations page says that from 15 December 2026 no organisation can create new self-serve fine-tuning jobs. Existing fine-tuned models stay usable until their base model is retired. Open models can still be fine-tuned with LoRA and run where you choose.

Royan AB · Stockholm

## Not sure which one you need? Send us a few example questions.

[contact@royan.se](mailto:contact@royan.se?subject=RAG%20or%20fine-tuning&body=Company%3A%0AWhat%20the%20AI%20should%20do%3A%0AData%20and%20systems%20it%20will%20use%3A%0APersonal%20data%20%28yes%2Fno%29%3A%0ADecision%20first%2C%20or%20build%20now%3A%0A) · [+46 73 598 79 90](tel:+46735987990) · Reply within one working day

[Tell us about the task](mailto:contact@royan.se?subject=RAG%20or%20fine-tuning&body=Company%3A%0AWhat%20the%20AI%20should%20do%3A%0AData%20and%20systems%20it%20will%20use%3A%0APersonal%20data%20%28yes%2Fno%29%3A%0ADecision%20first%2C%20or%20build%20now%3A%0A)
