Delve · Field guide

RAG vs fine-tuning: pick the lever that matches your failure

Retrieval edits what the model reads; tuning edits what the model is. A decision procedure for builders, with the evidence and its limits.

Delve Editorial · AI Engineering · 9 min

#rag #fine-tuning #evaluation #reliability

The short answer

Use retrieval when the model lacks facts or holds stale ones; use fine-tuning when the model has the facts but produces the wrong format, tone, or policy. Most production systems do both, and the choice should follow from an error analysis of what your model actually gets wrong.

The two levers act on different surfaces: retrieval edits the tokens the model sees at inference time, tuning edits the weights. That split is why retrieval gives you citations, per-request freshness, and a delete button, while tuning gives you consistent schema, stable refusal policy, and cheaper inference from a smaller model. Fine-tuning can move facts, but the evidence says it does so unreliably and makes models more confidently wrong.

01 · The mechanism

Two levers, not two competitors

Retrieval changes the input; fine-tuning changes the model. Retrieval stuffs selected text into the prompt at inference time and leaves the weights untouched, so the model sees documents it was never trained on and sees different ones on the next request. Fine-tuning runs gradient updates on example input-output pairs and bakes the pattern into parameters; at query time the model receives no documents at all. Everything downstream follows from that split.

The practical consequence is that context is addressable and disposable. You can point at the sentence that produced an answer, delete a document to revoke a fact, and serve different corpora to different tenants from identical weights. Weights are compressed and undated: a fact is smeared across parameters with no source pointer, no timestamp, and no delete button. Removing it means retraining or intervening directly in activations.

That makes the usual framing wrong. The two levers fail on different things, so "which is better" has no stable answer. Ask instead which one addresses your error class. If the model is fluent but misinformed, retrieval adds evidence. If the model knows the material but writes the wrong shape, retrieval only adds tokens it will mishandle again, while tuning shifts the distribution it samples from.

They also compose asymmetrically: fine-tuning on documents teaches recall of phrasing far more reliably than recall of content .

Retrieval changes what the model reads. Fine-tuning changes what the model is.

02 · Knowledge gap

When the gap is knowledge: what retrieval actually buys

When the model lacks the fact, retrieval is the cheap repair. Private wikis, contracts, support tickets, inventory tables, and a single customer's own account history are material no pretraining corpus contains and no training run keeps current. A nightly reindex makes tomorrow's price change visible; a retrain makes it visible only after data collection, a training run, and an eval pass.

Provenance is the underrated half. Retrieved context can be cited back to a chunk and a URL, which turns a fluent guess into a checkable claim and gives reviewers something to audit. Weight-encoded facts arrive without a footnote, so a wrong one is indistinguishable from a right one until a human checks.

Boundary conditions matter more than the headline. Retrieval degrades when the query is ambiguous and the retriever returns plausible-but-wrong chunks; when the answer requires joining five documents and the model must plan the hops; when chunking splits a table from its header row; and when the correct chunk is retrieved but the reader model overrides it with its prior. Retrieval supplies evidence, not reasoning: a model that cannot do multi-step arithmetic on an invoice will still fail with the invoice in context.

Reviews of the comparison literature converge on a narrow claim — retrieval is the stronger option when knowledge updates frequently or lives in a dynamic database, and it is not a substitute for teaching the model how to behave .

Retrieval quality and answer quality are separate metrics. Teams that measure only end-to-end accuracy cannot tell a bad index from a bad reader.

03 · Behavior gap

When the gap is behavior: what fine-tuning actually buys

Fine-tuning is a behavior technology. It reliably shifts form: output schema, tone, brevity, refusal policy, classification boundaries, the syntax of a tool call, the house style of a report. It is also how you compress behavior — a small model tuned on a few thousand demonstrations from a larger one often matches it on a narrow task, which cuts latency and per-call cost .

The contested part is knowledge. Conventional practice holds that weight updates produce brittle recall that generalizes poorly. A large study across a frontier model family argues the task-versus-knowledge split is a distinction without a difference, and that outcomes depend on concrete factors instead: question-answer training formats generalize knowledge far better than document-style text, numeric facts are harder to retain than categorical ones, and models struggle to use tuned facts inside multi-step reasoning even when trained on similar examples .

Separate LoRA experiments found that packing new facts into an adapter degrades performance on external question-answering benchmarks, causes regression toward a few overrepresented answers, and makes the model more confident and less likely to decline — the worst combination for a knowledge task .

Read together: tuning can move facts, but the failure mode is confident wrongness with no source, paid for with capability elsewhere. That is why tuning is the wrong default for a knowledge gap and the right default for a consistency gap.

Tuning fixes how the model answers. It rarely fixes what the model knows.

Schema-constrained decoding and better prompts often fix format failures in hours. Exhaust those before paying for a training pipeline.

04 · Operations

Cost, latency, and who maintains what

Treat the two as different operational objects. Retrieval is a live service: ingest, parse, chunk, embed, index, retrieve, rerank, assemble. It has an on-call surface — a parser change silently drops tables, an embedding-model upgrade invalidates the index, a document edit creates a chunk that outranks the correct one. It adds latency per query from the retrieval round-trip and reranking, and it pays token cost for every retrieved passage, so multi-document answers scale cost linearly with what you stuff into context.

Fine-tuning is a build artifact: a dataset, a training run, an eval suite, a version pin, a rollback. Upfront cost is real but bounded, and per-query cost often falls because a tuned small model needs a shorter prompt and less few-shot scaffolding. Its characteristic failure is drift — the weights are frozen while the world moves, and nothing in the system announces that the answers went stale.

The scarce input differs too. Retrieval needs a corpus plus a retrieval eval set that answers "did the right chunk come back, at what rank?" Tuning needs labeled demonstrations, which usually means human annotation. Teams routinely underestimate the first and overestimate how much clean labeled data they have for the second.

A retrieval pipeline's worst failure is silent: aggregate accuracy holds while one document set quietly stops being retrieved.

05 · The decision

The hybrid default and a decision procedure

Most production systems do both: tune the behavior, retrieve the knowledge. That is not a compromise, it is a division of labor — the adapter enforces the output contract and refusal policy, the index supplies facts and citations.

A concrete case. A support assistant must answer from a product-docs corpus that changes weekly, emit a fixed JSON envelope with a confidence field, and escalate billing disputes rather than answer them. Retrieve from the docs index refreshed nightly for facts and citations. Fine-tune on two thousand resolved tickets for envelope shape, escalation boundary, and tone. Neither alone gets there: retrieval cannot teach the escalation policy, and a tuned model with no index will confidently describe last quarter's pricing.

The decision procedure is an error analysis, not a bake-off. Collect 50-100 real failures and label each as missing fact, stale fact, wrong format, wrong policy, or reasoning failure. Facts point to retrieval; form and policy point to tuning, after prompt and schema-constrained decoding have been tried. Reasoning failures point to neither — change the model or decompose the task.

The strongest caveat: comparative evidence is thin and inconsistent. One review reports fine-tuned models sometimes underperforming their untuned baselines inside RAG pipelines, and dialogue-task comparisons found no single winning method . Your eval set, not the literature, decides.

Occasionally neither lever is right: a SQL query, a rules engine, or a bigger context window solves the problem with less machinery.

Retrieval vs fine-tuning, by decision surface

The levers differ less in raw capability than in what they change, what they cost to keep alive, and how they fail.

DimensionRetrieval (RAG)Fine-tuningFavors
What changesTokens the model seesWeights via gradient updatesFacts vs form
FreshnessIndex update, minutesRetrain, eval, redeployFast-changing facts: RAG
ProvenanceNative citations to a chunkNone; fluent recall onlyAuditability: RAG
Per-query costRound-trip plus context tokensCan fall via shorter prompts, smaller modelsHigh volume: tuning
Failure modeSilent retrieval regressionConfident wrong recallBoth need eval suites

Common misconceptions

  • Fine-tuning is how you teach a model your company's data. Tuning teaches form and policy reliably; facts are the hard case. LoRA fact injection degraded external QA benchmarks and made the model more confident while refusing less [S5]. Retrieval is the auditable route to private facts.
  • RAG is the cheap option because you skip training. You trade a one-off training run for a permanent pipeline: parsing, chunking, embedding, indexing, reranking, and an eval set that catches retrieval regressions. Ongoing cost is variable and never finishes.
  • Fine-tuning always improves a model on your domain. In RAG pipelines, tuned variants have been reported to underperform their untuned baselines on domain queries [S2]. Tuning shifts behavior in both directions and needs its own held-out evaluation.
  • A long context window makes retrieval unnecessary. Long context removes the retriever, not the retrieval problem. You still must select, rank, and refresh the right documents, and you now pay token cost for everything you include.

Run the diagnosis before you pick a lever

The correct choice is an output of error analysis, not a framework preference.

Assemble a real failure set

Pull 50-100 actual production or user failures with their full inputs. Do not use benchmark questions; they do not reproduce your retrieval corpus, your users' phrasing, or your schema.

Label each failure by cause

Tag every case as missing fact, stale fact, wrong format, wrong policy, or reasoning failure. Count the tags. A single dominant tag is your lever; a mixed set usually means a hybrid.

Try the hours-long fix first

Before either lever, test improved prompts, schema-constrained decoding, a larger context window, or replacing the LLM with a database query. These routinely resolve format and lookup failures.

Instrument the pipeline you build

For retrieval, measure recall@k on a labeled query set separately from answer accuracy. For tuning, keep a held-out capability suite that detects regression on general tasks, not just gains on the target task.

Combine when errors split

If form and fact failures both appear, tune on demonstrations for behavior and retrieve for knowledge. Version the adapter and the index independently so you can attribute a regression.

What would change my mind: A controlled study showing a LoRA-style tune on QA-formatted data reliably matching retrieval on fresh, citation-requiring private corpora — with no drop on general benchmarks and no rise in confident wrong answers — would flip the default for knowledge-heavy tasks.

Recall check

A support bot retrieves the correct policy document every time but emits JSON that breaks your schema. What is the first lever?

  1. Expand the retrieval corpus with more policy documents
  2. Constrain or tune the output format, starting with schema-constrained decoding
  3. Increase the number of retrieved chunks
  4. Switch to a larger base model with a longer context window

The fact is already arriving; the failure is form. More or better retrieval adds tokens the model will still misshape. Format failures are addressed by constrained decoding first and fine-tuning on schema-conformant demonstrations second.

According to the LoRA knowledge-injection experiments, what happens when new facts are packed into an adapter?

  1. General capability is preserved and citations improve
  2. The model becomes less confident and declines more often
  3. Factual accuracy on the target entities improves without side effects
  4. External QA benchmark performance degrades while the model becomes more confident and declines less

The reported pattern is capability erosion plus miscalibration: worse on external question answering, regression toward overrepresented answers, and fewer refusals — so wrong answers arrive with more confidence and no source.

Your failure sample splits roughly evenly between stale pricing facts and inconsistent escalation behavior. What does the decision procedure recommend?

  1. Fine-tune on the pricing documents so the facts are baked in
  2. Choose whichever is cheaper to run and accept losses on the other
  3. Retrieve for the pricing facts and fine-tune for the escalation policy
  4. Increase context length until both problems disappear

Two distinct causes need two levers. Tuning to fix stale facts produces confident, uncitable recall that goes stale again; retrieval cannot teach a policy boundary. Splitting the labor matches each mechanism to the error class it actually addresses.

Open questions

  • How much factual knowledge can a fine-tune absorb before general capability measurably degrades, and does the answer depend on model scale? If the ceiling is high for large models but low for small ones, the cost argument for distilling knowledge into small tuned models collapses exactly where teams want it most.
  • Does retrieval plus a tuned adapter ever underperform retrieval with the base model outside the reported dialogue and domain-QA settings? If the underperformance generalizes, the hybrid default is wrong for some workloads and the extra pipeline is pure cost.
  • Which data-format properties make tuned knowledge survive multi-step reasoning? The format sensitivity is the most actionable finding in the literature, but no one can yet specify a training set that reliably generalizes past single-hop recall.

Sources

Browse all public guides