CyberFreezeDev Loading
  1. Home
  2. Comparisons
  3. RAG vs fine-tuning

RAG vs fine-tuning: give the model your facts or teach it your habits

RAG hands the model the right documents; fine-tuning changes how the model behaves.

3D render of matte panels of neural network nodes, with activations lighting up layer by layer

The short answer

Use RAG when the model must know your facts, and fine-tuning when it must behave a set way. Most business assistants start with RAG.

Read more about The short answer

If you want the model to know things, such as your policies, product manuals, price lists, past tickets or tax circulars, use RAG. The facts stay in documents you can update, the model quotes the passage it used, and you can control which user sees which document.

If you want the model to behave a certain way, such as always returning a fixed JSON format, labelling tickets with your own 40 categories, or writing in your house style without a page of instructions, consider fine-tuning.

In the RAG vs fine-tuning choice, RAG is the right starting point for most business assistants, and fine-tuning is a later step for specific, measurable problems. We build both: RAG chatbots and knowledge assistants and LLM fine-tuning.

Side by side

Compared onRAGFine-tuning
What changesThe prompt: relevant passages are retrieved and added at question timeThe model weights, through extra training on your examples
Best atAnswering from current, specific factsConsistent format, tone, labels and narrow skills
Updating knowledgeRe-index the changed document, usually in minutesPrepare new examples and train again
CitationsNatural: show the source passage and fileNot available; the model cannot point to where it learned something
Access controlPer document or per user at retrieval timeNone inside the model; anything trained in is available to every user
Hallucination riskLower when answers must come from retrieved text, but retrieval misses cause wrong answersCan confidently state trained-in facts that are outdated
Data you needYour documents, cleaned and split into passagesHundreds to thousands of good input and output examples
Upfront effortIngestion, chunking, embeddings, a vector index and evaluationDataset curation, training runs and evaluation
Running costLonger prompts per question, plus the search indexShorter prompts; hosting a custom model or paying the provider's fine-tuned model rate

Where each one wins

RAG wins when facts change

Add last week's circular as a PDF and it is searchable, with no retraining.

Read more about RAG wins when facts change

A CA firm's assistant that answers staff questions on GST notifications must reflect the circular issued last week. With RAG you add the PDF and it is searchable. A fine-tuned model would need retraining and would still mix old and new rules.

RAG wins when you must show the source

Each answer can carry the file, page and passage for a person to check.

Read more about RAG wins when you must show the source

Clinics, insurers and finance teams need to see which document an answer came from. RAG can return the file name, page and passage with every answer, so a person can check it in seconds.

RAG wins on permissions

Retrieval filters documents by role before anything reaches the model.

Read more about RAG wins on permissions

HR policies for managers, pricing for sales, SOPs for the shop floor: retrieval can filter by role before anything reaches the model. A fine-tuned model cannot forget something for one user.

Fine-tuning wins on format and labels

A small fine-tuned model follows an exact schema or your own categories with shorter prompts.

Read more about Fine-tuning wins on format and labels

If you need every output in an exact schema, or tickets sorted into your own categories with consistent judgement, a small fine-tuned model can do it more reliably and with far shorter prompts than a large general model.

Fine-tuning wins on small, fast, local models

A fine-tuned 7 or 8 billion parameter model can run on one GPU in your office.

Read more about Fine-tuning wins on small, fast, local models

A fine-tuned 7 or 8 billion parameter open-weight model can match a much larger general model on one narrow task, and it runs on a single GPU in your own office. That pairs well with an on-premise LLM.

How the costs are structured

Fig. 01 Face on: nodes lighting up in the first layer, later layers behind

RAG costs are mostly engineering and evaluation. Fine-tuning costs sit in the dataset and every retrain. Both need someone to own the data.

Read more about How the costs are structured

RAG costs are mostly engineering and a little infrastructure. You pay to convert and clean documents (scanned PDFs may need OCR first), to create embeddings (a one-off charge per document, small with most embedding models), and to run a vector index such as pgvector in Postgres or a dedicated vector database. Each question then costs a little more than a plain chat, because the retrieved passages add input tokens. The biggest cost is evaluation: building a set of real questions with known answers and checking the system against it after every change.

Fine-tuning costs are front-loaded. The expensive part is the dataset: collecting, cleaning and checking hundreds or thousands of examples, often by someone who knows the domain. Training itself is moderate. With open-weight models, parameter-efficient methods such as LoRA (see the Hugging Face PEFT documentation) train only a small set of extra weights and fit on a single GPU for smaller models. With cloud providers that offer fine-tuning, you pay for training tokens and usually a higher per-token rate to use the resulting model. Every time the behaviour you want changes, you pay to retrain and re-evaluate.

On both, the cost people forget is maintenance: someone has to own the document set or the training set.

When to use both

Combine them only when each half has a measurable job, such as a fine-tuned classifier that routes questions to RAG answers.

Read more about When to use both

Some systems need a model that behaves in a fixed way and knows current facts. A support assistant might use a fine-tuned small model to classify the question and pick the right department, then RAG to answer from that department's documents. A document pipeline might use a fine-tuned model for consistent field extraction, with retrieval over a vendor master list to correct names and GSTINs.

We only combine them when each half has a measurable job. Adding fine-tuning to a RAG system that answers badly usually hides a retrieval problem instead of fixing it.

What we recommend and why

We start with RAG and spend the first weeks on retrieval. Fine-tuning comes when the task is narrow, examples exist and prompting falls short.

Read more about What we recommend and why

We start almost every knowledge assistant with RAG and a strong general model, and we spend the first weeks on retrieval quality: how documents are split, how tables in PDFs are handled, and whether the right passage comes back for real questions from your staff. Most disappointing assistants we see fail at retrieval, not at the model.

We recommend fine-tuning when three things are true: the task is narrow and repeated, you can produce good examples (or we can label them with you), and prompting alone has been tried and measured and still falls short. Then fine-tuning usually means a smaller, cheaper, faster model that can run privately.

For the definitions behind this page, see retrieval-augmented generation and fine-tuning in our glossary.

Questions

Can fine-tuning teach a model our company documents?

Only poorly. Fine-tuning shifts behaviour; it is an unreliable way to store facts, and you cannot see or update what it learned. For questions about your documents, use RAG.

How many examples do we need to fine-tune?

It depends on the task. A narrow classification or formatting task can improve with a few hundred high-quality examples; broader behaviour changes need more. Quality matters more than count, and we always hold back a test set to measure the result.

Does RAG work with scanned documents and tables?

Yes, after the documents are converted properly. Scans need OCR, and tables need to be kept as tables rather than flattened into text, or numbers get separated from their headings. This preparation step decides most of the quality.

Can both run on our own servers?

Yes. Open-weight models, embedding models and vector indexes can all run on-premise. Fine-tuning a 7 to 8 billion parameter model with LoRA fits on a single workstation GPU.

Last updated