Aadhib
ENع

SYSTEM NOTE

RAG vs fine-tuning in 2027: which one your project needs

Retrieval gives a model your facts at the moment it answers; fine-tuning changes how it behaves. With 1M-token context windows, cheap cache reads and OpenAI closing self-serve fine-tuning on 15 December 2026, most projects should start with retrieval or a long prompt and fine-tune only for behaviour they cannot prompt for.

"Should we fine-tune a model on our data, or use RAG?" is one of the first technical questions a team asks once a proof of concept works. It is usually asked as if the two were rival ways of doing the same job. They are not. One changes what the model can see when it answers. The other changes how the model behaves.

Most articles on the subject were written when context windows were small and fine-tuning was a button on every API dashboard. Both of those facts have changed. Current frontier models take a million tokens in one request, cache reads cost a few per cent of the input price, and the largest API vendor is closing self-serve fine-tuning altogether.

This article sets out what each technique actually changes, what each costs to build and to keep running, how long context altered the calculation, and the order in which I would try them. Every product detail and price below was read off the vendor's own documentation on the publish date shown above, and the sources are listed at the end.

The short answer

Long prompt with cachingRAG (retrieval)Fine-tuning
What it changesWhat the model seesWhat the model seesHow the model behaves
Good forA knowledge base that fits in the promptLarge or changing document sets, per-user permissionsFixed formats, tone, classification, narrow repeated tasks
Bad forVery large or fast-changing corporaTeaching a style or output formatFacts that change, citing sources
Updating knowledgeEdit the promptRe-index the changed documentsRetrain
Can cite its sourcesYesYesNo
Effort to buildLowestMediumHighest, needs labelled examples
AvailabilityEvery modelEvery modelA shrinking list of models
  • If the problem is "the model does not know our documents", that is a knowledge problem. Use a long prompt if the documents fit, and retrieval if they do not.
  • If the problem is "the model knows enough but answers in the wrong shape", that is a behaviour problem. Try better prompts and examples first, then fine-tuning.
  • If you need both, combine them: a tuned model for the behaviour, retrieval for the facts.
  • Check availability before you plan a fine-tune. OpenAI stops all new self-serve fine-tuning jobs on 15 December 2026.

What each one actually changes

A language model answers from two places: what it learned during training, held in its weights, and what is in the prompt in front of it. Every technique in this article works on one of those two.

RAG works on the prompt. Your documents are split into chunks, indexed, and when someone asks a question the most relevant chunks are found and pasted into the prompt. The model is unchanged. I described the parts of a retrieval pipeline, and the access-control problems it brings, in How to build a private ChatGPT for your company.

Fine-tuning works on the weights. You give the provider a set of example prompts with the answers you want, and it trains a copy of the model on them. OpenAI's model optimisation guide lists the use cases for supervised fine-tuning as classification, nuanced translation, generating content in a specific format, and correcting failures to follow complex instructions. Its preference method, DPO, takes both a correct and an incorrect response for each prompt and is aimed at things like summarisation focus and tone.

Notice what is missing from that list: teaching the model new facts. A tuned model can absorb some knowledge from its training examples, but it cannot tell you which example an answer came from, and the knowledge is frozen at the moment training ended. When your price list changes, a retrieval system needs one document re-indexed. A tuned model needs a new training run.

That is why, for anything where the answer must be traceable, I treat retrieval as the only option. In the legal research work behind source-grounded legal AI, the rule is "no source, no claim": retrieval gates generation, and an answer the system cannot point to a source for is not given. Fine-tuning cannot support that rule, because the weights do not carry citations.

How long context changed the decision

The old reason to reach for RAG was simple: the documents did not fit in the prompt. For many company knowledge bases, that is no longer true.

Anthropic's context window documentation lists a 1M-token context window for Claude Fable 5.2, Opus 5.5, Sonnet 5.5 and Haiku 5.5, among others, with 1M as the default and no beta header needed. Its pricing page says these models, apart from Haiku 5.5, bill the full window at standard rates: "A 900k-token request is billed at the same per-token rate as a 9k-token request." Haiku 5.5 is the exception, with higher prices for prompts over 100,000 tokens.

Anthropic made the same point about retrieval directly in its contextual retrieval article of 19 September 2024: if your knowledge base is smaller than 200,000 tokens, you can include the whole thing in the prompt and skip RAG.

Caching is what makes this affordable. Take a 150,000-token handbook placed at the start of every prompt on Claude Sonnet 5.5, using the list prices on Anthropic's pricing page:

Price per million tokensCost of the handbook per request
Uncached input$2$0.30
Cache read$0.10$0.015
One-hour cache write$4$0.60, paid when the cache is written

At 10,000 questions a month, the handbook costs $3,000 uncached and about $150 in cache reads, plus the writes each time the cache expires. Those figures are for the handbook part of the prompt only; the question, the answer and any reasoning are billed on top. I walk through caching rules for all the main vendors in LLM API pricing compared for 2027.

Two cautions keep this from being the answer to everything.

More context is not automatically better. The same Anthropic page says that as token count grows, "accuracy and recall degrade, a phenomenon known as context rot", and that curating what goes into context matters as much as how much space there is. A focused prompt usually beats a stuffed one.

The window is not a permission system. If different staff may see different documents, a single shared prompt containing everything is the wrong design. Retrieval with filtering by user is the natural place to enforce who sees what.

So long context replaces RAG for small, shared, slowly changing knowledge. It does not replace it for large corpora, frequent updates or per-user access.

Fine-tuning availability is shrinking

This is the part of the comparison that changed most recently, and the one older articles miss entirely.

OpenAI is winding down self-serve fine-tuning. Its model optimisation guide now says "OpenAI is winding down the fine-tuning platform." The deprecations page sets out the timeline:

  • From 7 May 2026, organisations that had never run a fine-tuning job could no longer create one.
  • From 2 July 2026, organisations that had not run inference on a fine-tuned model in the previous 60 days could no longer create training jobs.
  • From 15 December 2026, no organisation can create new self-serve fine-tuning jobs. That date was brought forward from 6 January 2027.

Existing fine-tuned models keep working until OpenAI retires the base model they were built on. The models the guide lists for supervised fine-tuning and DPO are the GPT-4.1 family, and the pricing page still shows tuned GPT-4.1 mini at $5 per million training tokens and $0.80 input and $3.20 output per million tokens for inference. If your plan depended on tuning a current GPT-6 model through the public API, it is not an option.

On Amazon Bedrock, AWS documents three customisation methods: supervised fine-tuning with labelled examples, reinforcement fine-tuning against reward functions you write, and distillation, where a larger teacher model generates answers used to tune a smaller student. Training is billed by the tokens processed (training tokens times epochs), plus monthly storage per custom model. The list of models you can fine-tune is mostly Amazon Nova and Meta Llama 3.x; the only Anthropic model listed is Claude 3 Haiku.

On Google Cloud, Vertex AI offers supervised fine-tuning for Gemini 3.8 Flash, 3.5 Flash, 3.5 Flash-Lite, 3.1 Flash-Lite and the 2.5 models, preference tuning on 2.5 Flash and 2.5 Flash-Lite, and reinforcement learning fine-tuning on 3.5 Flash and 3.1 Flash-Lite. Google's own advice on that page is to start with prompting and to fine-tune "if required" to boost performance or fix recurring errors.

The pattern is clear. The vendors' own documentation puts prompting first, fine-tuning is offered mainly on smaller and older models, and the flagship models you would most want to tune are mostly not on the list. Fine-tuning on a cloud API is now mainly a way to make a small, cheap model good at one narrow job.

Open models are the other route. If you host your own model, you can tune it however you like, usually with lightweight adapter methods that train a small set of extra weights instead of the whole model. That keeps training data inside your network, which matters for some Gulf projects, but it moves the whole training and evaluation pipeline onto your team. I cover which open models are worth running on which hardware in The best local LLMs for 2027.

When fine-tuning is still the right answer

None of this makes fine-tuning obsolete. It makes it a specialist tool. These are the cases where I would still consider it:

  1. A narrow task at high volume. Classifying tickets, extracting fields from a fixed document type, routing requests. OpenAI's guide names training a smaller model for a specific task as one of the main benefits, along with shorter prompts and lower latency. Distillation on Bedrock is built for exactly this.
  2. A format or style prompting cannot hold. If the model keeps drifting from a strict output structure or house style after real effort on the prompt and examples, tuning on a set of good examples can fix it.
  3. More examples than fit in a prompt. OpenAI's guide notes that tuning lets you provide more example inputs and outputs than fit in a single request.
  4. A self-hosted model that must run offline. When the model cannot call out to a frontier API, tuning an open model for the task may be the only way to close the quality gap.

And the cases where I would argue against it:

  • The data changes weekly or faster.
  • Users need to see where an answer came from.
  • Different users may see different information.
  • There is no evaluation set yet, so nobody could tell whether the tuned model is better.

Combining them

The strongest systems often use both, each for its own job. A retrieval pipeline finds the current facts and passes them in; a tuned model, often a small one, turns them into an answer in the required format. Fine-tuning on examples that already include retrieved context teaches the model to use that context well, rather than to memorise it.

Retrieval quality is usually the weak point, so improve it before reaching for weights. Anthropic's contextual retrieval article reported that adding a short generated context to each chunk before embedding cut the top-20 retrieval failure rate by 35%, that combining it with keyword search (BM25) cut it by 49%, and that adding a re-ranking step cut it by 67%. Those are Anthropic's results on its own test sets, not a guarantee for yours, but they show how much there is to gain before the model is touched at all.

For Arabic content, retrieval needs particular care: tokenisation, normalisation of letter forms and diacritics, and mixed Arabic and English documents all affect what the search finds. I discuss which models handle Arabic well in The best Arabic LLMs for 2027.

How I would choose

My default order, for almost every project, is this:

  1. Build an evaluation set first. Real questions from the people who will use the system, with the answers you expect. Without it, none of the later steps can be judged.
  2. Prompt properly. Clear instructions, a few worked examples, the right model. Both Google and OpenAI tell you to start here, and they are right.
  3. Put the knowledge in the prompt if it fits. For a shared knowledge base of modest size, a cached long prompt is the simplest system that works, and it has no index to go stale.
  4. Move to retrieval when it does not fit, when it changes often, or when access differs by user. Spend the effort on document preparation and search quality, not on the vector database brand.
  5. Fine-tune last, and only for a behaviour problem the evaluation set proves prompting cannot fix, or to move a high-volume task to a smaller model. Check first that the model you want can still be tuned on the platform you use.

The mistake to avoid is the reverse order: a plan to fine-tune a model "on our documents" so that it knows them. That gives you a system that cannot cite, cannot be updated without retraining, and cannot respect permissions. Retrieval or a long prompt gives you all three.

For the wider picture of which AI tools are worth paying for in the first place, see The best AI tools for 2027.

If you are deciding how to ground an assistant or agent in your company's own data, and want the retrieval, permissions and evaluation built properly, that is the work my AI agent development service covers.

Sources

  1. 01Model optimizationOpenAI
  2. 02DeprecationsOpenAI
  3. 03API pricingOpenAI
  4. 04Context windowsAnthropic
  5. 05PricingAnthropic
  6. 06Introducing Contextual RetrievalAnthropic · SEPT 2024
  7. 07Tune Gemini modelsGoogle Cloud
  8. 08Customize your model to improve its performance for your use caseAmazon Web Services
  9. 09Supported models and Regions for fine-tuningAmazon Web Services

If this was useful, follow what I’m building.

All notes →

Projects and case studies

All notes