Skip to content

AI ENGINEERING

RAG or fine-tuning?How to choose.

Retrieval-augmented generation and fine-tuning both make a language model more useful for your business. Here is when each one fits, what they cost to run, and why many teams end up using both.

  • Codesgenii team
  • 7 min read
  • 23 November 2026
On this page
  1. The short answer
  2. What RAG actually does
  3. What fine-tuning actually does
  4. Cost and maintenance
  5. Why many teams use both
  6. Measure before you decide
  7. Key takeaways

The short answer

Use retrieval-augmented generation (RAG) when the model needs facts that change, or facts that live inside your own systems. Use fine-tuning when you need the model to behave in a consistent way, such as a fixed tone, a strict output format or one narrow task repeated thousands of times. If you are not sure, start with RAG. It is cheaper to build, easier to change and easier to audit.

Decision flow: if knowledge changes often use RAG, otherwise consider fine-tuningYour use caseKnowledge changes often?Use RAGConsider fine-tuningyesno
A simple decision flow for your first choice.

What RAG actually does

RAG keeps your knowledge outside the model. When someone asks a question, the system searches your documents, help-centre articles or database for the most relevant passages, hands those passages to the model, and asks it to answer using only what it was given, with sources. The model itself never changes. When a policy is updated, you update the document and the next answer reflects it straight away.

RAG is usually the right call for:

  • Customer support assistants that answer from your help centre and policies
  • Internal search across contracts, SOPs, tickets and wikis
  • Anything where the answer must cite a source a person can check
  • Information that changes daily or weekly, like prices, stock or schedules

What fine-tuning actually does

Fine-tuning trains the model on hundreds or thousands of examples of the exact input and output you want. The model learns a behaviour: writing in your brand voice, filling a specific JSON structure, classifying tickets into your categories. It does not reliably learn facts, and it cannot update itself when those facts change, which is why fine-tuning alone is a poor fit for knowledge questions.

  • High-volume, repetitive tasks like classification or extraction
  • Strict formats that prompting alone keeps breaking
  • Cutting cost and latency by moving a task to a smaller tuned model

Cost and maintenance

A RAG system costs you a search index, some engineering to split and clean documents well, and slightly longer prompts on every request. Fine-tuning costs you a training dataset, training runs, and a new round of training every time the behaviour you want changes. For most companies, the hidden cost is not compute. It is the time spent preparing good data, and that time is usually shorter for RAG.

Why many teams use both

Production systems often combine the two: a tuned model handles tone and format, and RAG supplies the facts. A claims assistant might use a small fine-tuned model to always produce the same structured summary, while retrieval pulls the policy wording it needs for each case.

Measure before you decide

Whichever path you choose, build an evaluation set first: 50 to 200 real questions with agreed good answers. Run it before and after every change. It is the only honest way to know whether RAG, fine-tuning or a better prompt actually moved the needle.

Key takeaways

  • RAG for knowledge, fine-tuning for behaviour
  • Start with RAG unless you have a clear reason not to
  • Build an evaluation set before you build anything else
  • Keep a person in the loop for high-stakes answers

LET'S TALK

Have a problem worthsolving with software?

Tell us where you are and where you want to be. We reply within one business day. (placeholder)

Next step: discovery callYouDiscovery call