Skip to content
HHussain C

RAG vs fine-tuning vs long context: which one does your product need?

Three ways to make a language model know your stuff, in plain terms. When each one fits, what each costs, and the order I try them in on real projects.

If you want a language model to know about your products, your policies or your customers, there are three ways to get there. You can let it look things up (RAG), you can paste everything into the prompt (long context), or you can train it on your data (fine-tuning).

For most products the answer is RAG, sometimes long context, and fine-tuning only for a specific kind of problem. Here's how to tell which one you have.

What is each one, in plain terms?

RAG (retrieval-augmented generation) means the model looks things up before it answers. Your content is split into passages and indexed. When a question comes in, the system finds the most relevant passages and gives only those to the model, which writes the answer and cites them.

  1. 01Question"Can I return a sale item?"
  2. 02SearchFinds the 5 most relevant passages
  3. 03Check accessDrops what this user can't see
  4. 04AnswerWritten only from those passages
  5. 05SourcesLinks back to the policy page
What happens when someone asks a RAG chatbot a question.

Long context means skipping the search. Modern models can read hundreds of pages in one go, so you put all your content in the prompt and ask the question at the end.

Fine-tuning means training. You give the model hundreds or thousands of examples of input and the output you want, and it adjusts itself to produce that kind of output.

How do they compare?

QuestionRAGLong contextFine-tuning
Best forAnswering from lots of changing contentSmall, stable sets of documentsStyle, format, one narrow task
Content updatesRe-index, minutesChange the prompt, instantRetrain, days
Shows sourcesYes, naturallyPossible, less reliableNo
Per-user permissionsYes, filter at search timeHardNo
Cost per questionLowHigh with lots of textLow once trained
Upfront costMediumVery lowHigh
The short version of a long argument.

When is long context enough?

More often than people think. If your content is a few dozen pages, changes rarely, and everyone is allowed to see all of it, try putting it straight in the prompt first. It takes an afternoon and gives you a baseline to beat.

It stops working when the content grows, because every question pays to re-read everything. It also gets harder to tell which part of the text an answer came from, and you can't easily hide one document from one user.

When do you need RAG?

As soon as one of these is true:

  • The content is bigger than you'd want to pay to send on every question.
  • It changes weekly or daily, like prices, stock, tickets or policies.
  • Different people are allowed to see different things.
  • You need to show where an answer came from, for trust or for legal.

Most support bots, internal knowledge assistants and "chat with your documents" features land here. The model is the easy part. The work is in cleaning the documents, splitting them sensibly, and making search find the right passage for the questions people actually ask.

When is fine-tuning the right call?

Fine-tuning shines when the problem is how the model answers, not what it knows:

  • Writing in a very specific house style or format, every time.
  • Classifying or extracting from documents in a narrow domain, at high volume.
  • Making a small, cheap model do one job as well as a big expensive one.

It's a poor way to teach facts. The model may blend them, misremember them, or keep repeating last quarter's prices after you've changed them. And every time the facts change, you retrain and re-test.

Which should you try first?

  1. Is the problem the style or format of answers, not the facts?Yes →Look at fine-tuning, or try good examples in the prompt first.No ↓
  2. Is the content small, stable and visible to everyone?Yes →Put it in the prompt. Long context is enough.No ↓
  3. Does it change often, need permissions, or need sources?Yes →RAG.
  4. Still no →Start with long context to get a baseline, then move to RAG if cost or accuracy say so.
The order I go through on a new project. Stop at the first yes.

You can also combine them. A common setup is RAG for the facts, with a fine-tuned small model for one high-volume step like classification. But only once the simple version has shown where it falls short.

If you're not sure which of these fits your product, tell me what you're building and I'll give you a straight answer.

Quick answers

What's the difference between RAG and fine-tuning?

RAG looks up the right passages from your content at question time and gives them to the model. Fine-tuning changes the model itself by training it on examples. RAG is for facts that change; fine-tuning is for a style, a format or a narrow task.

Is RAG still needed now that models have huge context windows?

For small, stable sets of documents, you can often just put everything in the prompt. Once the content is large, changes often, or has permissions, retrieval is still cheaper, faster and easier to audit.

Which is cheaper, RAG or fine-tuning?

RAG, almost always, for answering from your own content. Fine-tuning needs good training data, retraining when things change, and evaluation of every new version.

Contact

Want this in your product?

I read every message myself and usually reply the same day. A rough idea is enough to start.

Or send a short brief

Hours

Your hours work for me.

  • San Francisco

    --:--

  • New York

    --:--

  • London

    --:--

  • Berlin

    --:--

  • Dubai

    --:--

  • Singapore

    --:--

  • Sydney

    --:--

  • Surat

    --:--

    Me

I keep flexible hours and move my day to overlap with yours, whether that's a morning standup in New York or a late release in Sydney.