Guides

RAG vs fine-tuning: pick the cheaper durable answer

By Abdul Asim · ·

The short answer

Use RAG when the model needs to know your facts, and fine-tuning when it needs to behave a particular way. RAG hands the model your current documents at answer time, so you fix knowledge by re-indexing. Fine-tuning changes the model's weights, which pays off for a narrow, stable job like labeling or a fixed output format, and rarely pays off for keeping facts current.

For business document problems I start with RAG almost every time. It is cheaper to build, cheaper to keep correct, and easier to audit. Fine-tuning earns a place later, for one specific job that prompting and retrieval cannot do well enough.

RAG vs fine-tuning at a glance

CriterionRAGFine-tuning
What it changesThe context the model reads on each requestThe model's weights
Good atFacts, policies, product data, documents that changeTone, output format, labels, narrow classification
Updating knowledgeRe-index the changed documentsRebuild the dataset and retrain
CitationsCan point to the passage it usedNothing to point to
Upfront workIngestion, chunking, index, eval setLabeled dataset, training runs, eval set
Running costMore prompt tokens per callShorter prompts, often a smaller model
Typical failureWrong or missing passage retrievedConfident answers from stale or half-learned facts
Who keeps it correctWhoever owns the source documentsSomeone who can curate data and retrain

The row that settles most projects is the third one. If your prices, policies or specs change every month, a model trained on them starts going stale the day after training. With RAG, the person who edits the document is the person who updates the system.

What each approach actually changes

RAG leaves the model alone. A retriever finds the passages that match the question, and the model writes its answer from them. The original RAG paper, which I cover in when RAG was introduced, describes this as pairing the knowledge stored in a model's parameters with a separate, searchable index. In practice that index is your SharePoint folder, product catalog or ticket history, cleaned and chunked. If you want the mechanics, how a RAG pipeline works walks through each stage, and the difference between RAG and a plain LLM covers what the model knows on its own.

Fine-tuning keeps training the model on your own input and output examples, so the weights shift toward your task. It is good at teaching a pattern: this kind of input gets this label, this request gets this structure. It is much weaker at teaching facts. A study comparing the two for adding knowledge, Fine-Tuning or Retrieval?, found RAG consistently beat unsupervised fine-tuning, both for facts the model had partly seen and for new ones. That matches what I see on client work: a tuned model picks up how answers should sound well before it reliably learns what is true.

When is RAG the better choice?

Pick RAG when any of these are true: - The answer lives in documents you already maintain. - Those documents change faster than you would want to retrain. - Users or auditors need to see where an answer came from. - Different users should see different documents. - You cannot yet say what a correct answer looks like across hundreds of examples.

The proposal team at Applied Optoelectronics is a good example. They had been drafting RFP answers with a generic ChatGPT workflow, and the drafts did not reflect their own technical material. I did not train a model on their documents. I built a retrieval workflow over approved technical knowledge: extraction and OCR for scanned files, normalization and chunking, retrieval of passages for each individual requirement, then a review and export gate before anything left the team. When a spec sheet changes, the fix is a re-ingest, not a training run.

Customer-facing assistants follow the same logic. For McKissock Learning I built a sales assistant grounded in product knowledge that answers from website content, product information and internal documents, and opens a HubSpot ticket when it cannot resolve a request. Course details change all the time, so knowledge had to stay outside the model.

When is fine-tuning worth it?

Fine-tuning is worth it when the job is narrow, the labels are stable, and you can collect enough clean examples. The clearest case I have shipped is a security labeling model: I fine-tuned Gemma 7B with QLoRA to flag prompt-injection and SQL-injection attempts. It measured 96% accuracy, 96% precision and 98% recall, on a small hardware footprint. Retrieval would not have helped there. The model did not need to look anything up; it needed to recognize an attack pattern quickly on every request in front of protected endpoints. That work sits alongside the defenses described in the prompt injection guide.

The vendor guidance lines up with this. OpenAI's model optimization guide puts evals and prompt engineering before fine-tuning, and lists the gains as consistent formatting, more examples than fit in one prompt, shorter prompts that cut token cost and latency, and training a smaller model for a specific task. Notice what is missing from that list: keeping facts up to date.

If you have landed on fine-tuning, the separate guide on when and how to fine-tune an LLM covers LoRA versus full fine-tuning, dataset preparation and the cases where it is still the wrong call.

RAG vs fine-tuning cost

Compare cost in three buckets, not one: - Build: RAG spends on ingestion, parsing and an eval set. Fine-tuning spends on a labeled dataset, which is usually the expensive part, plus GPU time and the same eval set. - Run: RAG adds retrieved passages to every prompt, so each call costs more tokens. A fine-tuned small model can run on short prompts and cheaper hardware. - Maintain: RAG needs monitored ingestion and index freshness. Fine-tuning needs data curation, a retrain, and a regression run every time the task or the base model changes.

Training itself is cheaper than it used to be. LoRA freezes the base weights and trains small low-rank matrices, which the authors report cut trainable parameters by about 10,000 times and GPU memory by about 3 times compared with full fine-tuning of GPT-3 175B. So the GPU bill is rarely what decides it. The people cost of building and refreshing a trustworthy dataset is.

For a broader view of where the money goes in an AI build, see what AI development costs. My rule of thumb: high query volume on a narrow, stable task tilts toward fine-tuning a small model. A changing knowledge base at moderate volume tilts toward RAG, and it usually stays there.

Can you combine RAG and fine-tuning?

Yes, and mature systems often do, but each piece does a different job. The common pattern is RAG for knowledge with a small fine-tuned model for one step inside the pipeline: a classifier, a router or a guard. The injection classifier above is exactly that kind of component. It screens traffic; it does not answer questions.

The other pattern trains the generator to use retrieved context better. RAFT fine-tunes a model on questions paired with retrieved documents, including irrelevant distractors, so it learns to ignore the noise and quote the useful passage. That is a real option once you have a working RAG baseline and evidence that the model, not retrieval, is the weak link. Measure first: LLM evaluation is how you find out which stage is failing.

A decision checklist

  1. Write down what a correct answer looks like for 30 to 50 real questions.
  2. Try a good prompt with the right documents pasted in. If that works, you need retrieval, not training.
  3. Build RAG and measure retrieval and answers separately.
  4. Fine-tune only for a narrow behavior that still fails, with stable labels and enough clean examples.
  5. Budget for maintenance: who re-indexes, who relabels, who reruns the eval set.

If your problem is answering questions from your own documents, that is the 100 Document RAG MVP I build: ingestion, retrieval, citations and a test set, before anyone talks about training a model.

Let's talk

Let's ship yours.

AI product, automation bottleneck, RAG use case, or operational workflow. Tell me what's slowing your team down, or what revenue you're leaving on the table.

Abdul Asim, AI / LLM Engineer