AI

RAG vs fine-tuning: how to decide

Retrieval and fine-tuning are often presented as two routes to the same place. They are not. One changes what the model can see when it answers; the other changes how the model behaves. Most wrong decisions come from asking one to do the other’s job.

AIUpdated September 21, 2026By the BBR engineering team

Short answer: use retrieval (RAG) when the model needs information it does not have, such as your documents, records or anything that changes. Use fine-tuning when the model has the information but will not behave consistently: a fixed format, a house style, a narrow classification at high volume. If the knowledge is small and stable, skip both and put it in the prompt. Try them in order of cost: prompting, then long-context prompting, then retrieval, then fine-tuning, measuring each step against the same set of test examples.

Our guide to integrating an LLM into a product has a one-table overview of the three approaches. This article goes further into the decision itself.

What each approach actually changes

A language model produces its answer from two things: its weights, fixed during training, and the context, which is everything in the prompt for this request. Every technique changes one of the two.

ChangesMechanismWhat the model gains
PromptingContextInstructions and a few examples written into the promptA description of the task
Long-context promptingContextThe full reference material placed in the prompt on every requestAll of a small body of knowledge, every time
Retrieval (RAG)ContextA search step selects relevant passages from your data and inserts them into the promptThe relevant slice of a large body of knowledge, current as of the last index update
Fine-tuningWeightsFurther training on hundreds or thousands of example inputs with the desired outputsA changed default behaviour: format, tone, task skill

The distinction that settles most cases: knowledge belongs in the context, behaviour can be moved into the weights. Facts placed in the context can be updated, cited, filtered per user and removed. Facts pushed into weights can do none of those, and they are recalled unreliably, because training on a document teaches a model to write text that resembles the document more than it teaches the model to look up what the document says.

A useful analogy is a new employee. Fine-tuning is training: it shapes how they write and what they do by habit. Retrieval is giving them access to the filing system. Nobody tries to replace the filing system by having staff memorise it, and nobody expects the filing system to teach tone of voice.

Where fine-tuning happens in practice

Two routes exist. Several hosted model vendors offer fine-tuning of some of their models as a service: you upload examples, they run the training and host the result, usually at a different per-token price. Alternatively, an open-weight model is fine-tuned, often with a parameter-efficient method that trains a small set of additional weights, and then hosted by you or by an inference provider. Both routes produce a model that is tied to one base model version, which matters for maintenance, as discussed below.

Cost and maintenance profile

RAGFine-tuning
Up-front workDocument parsing, chunking, indexing, search quality, permission filtering, citations. Mostly software engineeringCollecting and cleaning examples, training runs, comparison against a prompted baseline. Mostly data work
Who does most of itEngineers, with a domain expert checking answersDomain experts producing and reviewing examples, plus someone who understands training and evaluation
Cost per requestHigher input cost: retrieved passages are sent on every call. A search step is addedCan be lower: shorter prompts, and possibly a smaller model. The tuned model may be priced above its base version or need dedicated hosting
When your data changesRe-index the changed documents; minutes to hours, automatedPrepare new examples and retrain; days, with a full re-evaluation
When the model vendor retires the base modelSwitch model, re-run the evaluation set, adjust promptsRepeat the fine-tuning on a new base model, then re-evaluate. The tuned weights do not transfer
Switching vendorsStraightforward: the index and the pipeline are yoursStart again: the tuned model lives with one vendor or one model family
Ongoing attentionIndex freshness, retrieval quality on new kinds of question, content hygieneDrift between training examples and real inputs; periodic retraining

The line founders most often miss is model retirement. Hosted models are withdrawn on published schedules. A prompt-and-retrieval system migrates with a few days of testing. A fine-tuned model has to be rebuilt, which means the example set, the training procedure and the evaluation all need to be kept in working order for as long as the feature exists. Fine-tuning is therefore a standing commitment. Budget figures for building either kind of feature are in our breakdown of AI integration costs.

Data requirements

For retrieval

  • The source material itself, in a form that can be parsed. Clean, well-structured documents give good retrieval. Scanned PDFs, slide decks with little text and contradictory versions of the same policy give poor retrieval whatever the technology.
  • Metadata: title, section, date, owner, and who may see it. Permission rules must exist as data before they can be enforced in search.
  • An evaluation set: 50 to 200 real questions, each with the passage that contains the answer and the answer you would accept.
  • An owner for the content. If nobody is responsible for keeping the documents correct, the assistant will quote outdated ones with complete confidence.

For fine-tuning

  • Input-output pairs that show exactly the behaviour you want. As a planning figure, a few hundred for a narrow format or classification task, a few thousand for more varied behaviour.
  • Consistency. If two reviewers would write different “correct” outputs for the same input, settle the guideline first. The model learns whatever inconsistency is in the examples.
  • Coverage of the real distribution of inputs, including the awkward ones, and examples of when to refuse or defer.
  • A held-out test set that is never used in training.
  • Rights and privacy clearance. Personal data in training examples is much harder to remove from a model than from an index. Deleting a document from a retrieval index takes effect at once; removing its influence from trained weights means retraining.

If you have documents but no examples of ideal outputs, you are equipped for retrieval and not for fine-tuning. If you have thousands of past human decisions or edited drafts, fine-tuning becomes possible, and so does a very good evaluation set, which is worth having in either case.

Latency

ApproachEffect on response time
RAGAdds a search step before the model call: typically tens to a few hundred milliseconds for embedding the query, searching and reranking. Adds input tokens, which lengthens the time before the first word appears. Both are usually small next to generation time
Long-context promptingLarge prompts take noticeably longer to process unless the vendor’s prompt cache is warm, in which case the repeated prefix is processed much faster
Fine-tuningOften reduces latency: instructions and examples no longer need to be in every prompt, and a smaller model may be good enough. With self-hosting, latency depends on the hardware you pay for

Latency is a legitimate reason to consider fine-tuning for narrow, high-volume, real-time tasks such as classifying each incoming message or reformatting each record. It is rarely a reason to avoid retrieval.

How often the knowledge changes

Rate of changeExamplesFits
Minutes to daysTickets, orders, inventory, prices, account statusRetrieval, or a direct lookup through a tool call to your database or API. Never fine-tuning
Weeks to monthsHelp-centre articles, policies, product documentationRetrieval with automated re-indexing; long-context prompting if the material is small
RarelyBrand voice, output schema, labelling rules, the structure of a good summary in your domainPrompting first; fine-tuning if prompting cannot hold the behaviour steady

Note that live operational data often needs neither technique. “What is the status of order 4417?” is a database query, which the model can request through a tool call and then phrase for the user. Searching an index for it would be slower and less accurate.

Evaluating each approach

Neither approach should be adopted, or rejected, without numbers from your own examples. What you measure differs.

Retrieval: two separate scores

  1. Retrieval hit rate. For each test question, is the passage that contains the answer among the top results? If not, no model can answer correctly, and the fix is in parsing, chunking or search, not in the prompt.
  2. Answer quality given good retrieval. Is the answer correct, is every claim supported by the cited passages, and does the system decline when the sources do not contain the answer?

Separating the two tells you where to spend effort. Teams that look only at final answers tend to rewrite prompts for weeks when the real fault is that the right passage was never retrieved.

Fine-tuning: always against a baseline

  1. Build the strongest prompted baseline first, with clear instructions and a few examples on a capable model, and score it on the held-out test set.
  2. Score the fine-tuned model on the same set. If the gain is small, the maintenance commitment is not justified.
  3. Check for regressions outside the training distribution: unusual inputs, refusals, and any general ability the feature still relies on. Narrow training can degrade behaviour elsewhere.
  4. Record cost and latency per request for both, because those are usually the reasons for fine-tuning in the first place.

In both cases, keep the evaluation set and re-run it on every change. The process for building one is described in the integration guide linked above.

Long-context prompting: the third option

Current hosted models accept very large prompts, large enough for a full handbook, a contract set or a product manual. That makes a third approach practical: skip retrieval and send all of the reference material with every request, relying on the vendor’s prompt caching to keep the cost down.

When it works well

  • The material is small, roughly up to a few hundred pages, and fits comfortably within the model’s limit with room for the conversation
  • It changes rarely, so the cached prefix stays valid
  • Every user may see all of it, so there are no per-user filtering rules
  • Questions need reasoning across the whole document, which is where chunk-based retrieval is weakest
  • Request volume is low to moderate, or steady enough to keep the cache warm

Where it stops working

  • The collection is larger than the context window, or grows without limit
  • Different users may see different documents
  • Requests are sparse, so the cache expires between them and every call pays the full price
  • Accuracy on specific details falls as prompts get very long. Test this on your own material
  • You need precise citations to a passage, which retrieval gives you as a by-product

An illustrative cost comparison

The prices below are placeholders chosen to make the arithmetic easy, not any vendor’s price list. Assume input costs $3.00 per million tokens, and cached input is billed at one tenth of that. The reference material is 150,000 tokens. A retrieval pipeline would instead send about 4,000 tokens of selected passages. Output cost is the same in all three cases and is left out.

Input tokens per requestInput cost per requestAt 10,000 requests per month
Long context, no cache hits150,000$0.45$4,500
Long context, cache always warm150,000 (cached rate)$0.045$450
Retrieval4,000$0.012$120

At 300 requests a month the long-context bill is between $13.50 and $135, and building a retrieval pipeline to save that would take years to pay back. At 10,000 requests a month the gap is large enough to fund the pipeline. Put your own token counts and your vendor’s current prices into the same sums before deciding.

Decision table by use case

Use caseStart withWhy
Customer-support assistant answering from help articlesRAGContent changes, answers need citations, and the collection outgrows a prompt
Internal knowledge search across departmentsRAG with permission filteringDifferent staff may see different documents; only retrieval can enforce that
Questions about one policy document or one contractLong-context promptingSmall, stable, and benefits from reading the whole text
Account, order or booking statusTool call to your API or databaseLive structured data; neither RAG nor fine-tuning
Classifying or routing messages at high volumePrompting; then fine-tune a small model if volume justifies itNarrow, stable task with abundant labelled history; cost and latency matter
Extracting fields from documents into a fixed schemaPrompting with structured output and validation in codeVendor structured-output features handle most format problems; fine-tune only for persistent errors on unusual layouts
Writing in a specific brand voicePrompting with a style guide and examplesUsually sufficient. Fine-tune if the voice must hold across very high volume with short prompts
Drafting replies that follow company policyRAG for the policy, prompting for the tonePolicy is knowledge; tone is behaviour, and prompts usually handle it
Specialist domain with its own vocabulary and conventionsRAG first; consider fine-tuning in additionRetrieval supplies the facts; tuning can help the model read and write the domain’s shorthand
Running on a device or fully inside your own networkSmall open-weight model, often fine-tuned, plus local retrievalA small model needs help to match a large hosted one on the specific task
Agent that uses your tools in a particular sequencePrompting with clear tool descriptionsFine-tune only after a measured, persistent failure to choose tools correctly

Decision rules in order

  1. Write the task down and collect test examples. No approach can be judged without them.
  2. Prompt a capable hosted model. Measure.
  3. If failures come from missing information: place the material in the prompt if it is small and stable, otherwise build retrieval. If the information is live structured data, give the model a tool.
  4. If failures are about format, use structured output and validate in code before anything else.
  5. If failures are about consistency or tone despite good prompts, or the unit cost or latency of a large model is the obstacle on a narrow task, and you have hundreds of clean examples, evaluate fine-tuning against the prompted baseline.
  6. If none of these reaches the accuracy the task needs, reconsider the task: narrow it, add human review, or accept that it is not ready to automate. Our guide to building an AI product covers when AI is the wrong tool.

Combining them

The approaches are layers, not rivals, and mature systems often use several:

  • Fine-tuned model plus retrieval. The tuning fixes format, tone or domain vocabulary; retrieval supplies current facts. The training examples should include retrieved passages in the input, so that the model learns to answer from them and to decline when they are insufficient.
  • Tuning the retrieval side. When search struggles with specialist vocabulary, adapting the embedding or reranking model to your domain can improve retrieval more than any change to the generating model.
  • Routing. A small, possibly fine-tuned model classifies each request, and only the ones that need it go to a large model with retrieval.
  • Retrieval plus tools. Documents come from the index, live values come from API calls, and the prompt tells the model which to trust for what.

Add one layer at a time and measure after each. A system with retrieval, a tuned model and a router has three places for quality to go wrong and needs an evaluation for each.

Common misconceptions

BeliefWhat is closer to the truth
“Fine-tuning on our documents will teach the model our business”It teaches the model to sound like your documents. Recall of specific facts is unreliable, there are no citations, and updates need retraining
“RAG stops hallucination”It reduces it when retrieval finds the right passage. When retrieval returns the wrong passage, the model answers confidently from it. Measure retrieval, require citations, allow “I do not know”
“Fine-tuning is more private because the data stays in the model”The reverse is nearer the mark. Training data can sometimes be drawn out of a model, it cannot be filtered per user, and it cannot be deleted without retraining. An index can be permissioned and purged
“RAG needs a dedicated vector database”It needs search. A PostgreSQL extension covers vector search for most collections, and keyword search alongside it matters as much
“Long context made retrieval obsolete”For small, stable, unrestricted material, often yes. For large, changing or permissioned collections at volume, no
“Fine-tuning is a one-off cost”It recurs with every base-model retirement and every meaningful change in your inputs
“Serious AI products train their own models”Most useful products are built on hosted models with good retrieval, tools and evaluation. Training is justified by a measured gap, not by ambition
“Bigger chunks and more passages mean better answers”Past a point, extra context dilutes the relevant passage and raises cost. Fewer, better-ranked passages usually win

How BBR approaches the choice

BBR integrates hosted models and builds the systems around them: retrieval pipelines, agents, guardrails and evaluation. We do not train foundation models. When we scope an AI feature, the first deliverable is an evaluation set and a prompted baseline, because those two things decide whether retrieval is needed and whether anything beyond it is worth considering. In most business cases the answer is prompting plus retrieval plus ordinary engineering. If the numbers say a task needs custom model training, that is work for a machine-learning specialist, and we will tell you so.

If the feature you have in mind is a support or knowledge assistant, our AI chatbot cost guide prices the retrieval route block by block. The scope and process we follow are on the AI development service page.

Questions

Frequently asked
questions.

Can I fine-tune a model on our documents so that it knows our business?

You can run the training, but it is an unreliable way to teach facts. A fine-tuned model absorbs patterns of style and task far more readily than specific details, cannot cite where an answer came from, cannot respect per-user access rules, and is out of date as soon as a document changes. For company knowledge, retrieval is the right tool: it puts the current text in front of the model at the moment of the question.

Is RAG cheaper than fine-tuning?

They cost money in different places. RAG has a larger engineering cost up front (ingestion, search, permissions) and adds input tokens to every request. Fine-tuning has a data-preparation and training cost, must be repeated when the base model is retired, and may carry a higher per-token price or hosting cost. Fine-tuning can lower running cost when it lets a small model replace a large one at high volume. Compare on your own volumes, not in general.

Have long context windows made RAG unnecessary?

For small, stable bodies of text, often yes: placing the whole handbook in the prompt with caching is simpler than building retrieval. For large or fast-changing collections, per-user permissions, or high request volumes, retrieval still wins on cost, latency and control. Accuracy on details buried in very long prompts also tends to be lower than on a short, relevant context, so test before relying on it.

How much data do I need for fine-tuning?

As a planning figure, a few hundred carefully checked examples is a sensible minimum for a narrow format or classification task, and a few thousand for more varied behaviour. Quality matters more than quantity: inconsistent examples teach inconsistency. You also need a separate held-out test set that the model never sees during training, or you cannot tell whether it has learned the task or memorised the examples.

Does BBR fine-tune or train models?

BBR’s work is on the integration side: prompting, retrieval pipelines, agents, guardrails and evaluation built around hosted models. We do not train foundation models. If your evaluation results show that a task truly needs custom model training, we will say so and you should involve a team whose core work is machine learning.

Your next move

Not sure which approach your feature needs?
Send us the task.

Describe what the model should do, the data it depends on and how often that data changes. We reply with questions and a prototype scope that tests the cheapest option first.

Discuss your AI feature