# RAG, fine-tuning or long context: how a model learns your business

> A language model can learn about your business by retrieving documents when a question arrives, by reading all of them in the prompt, or by being trained on examples. Each solves a different problem, and picking one because it is in fashion tends to be expensive.

Generative AI · Technology comparison · November 17, 2026 · 7 minute read · By Nabil Ahmed
Canonical: https://farside.works/insights/rag-fine-tuning-or-long-context/

![The lunar surface near 59°N, 174°W, lit by a low Sun with night falling across one side.](https://farside.works/content/images/2026/11/rag-fine-tuning-or-long-context.webp)

A general-purpose language model has absorbed a great deal of public knowledge but knows nothing about your company. It has never read your contracts or your claims manual, and it cannot know that one of your divisions uses "PO" to mean "purchase order" while another uses it for "production order". Any enterprise use of these models has to close that gap in some way.

There are three ways of doing so. You can retrieve the relevant material when a question is asked and pass it to the model with the question, or put the entire body of material in the prompt and let the model locate what it needs, or train the model further on your own examples so that its behavior changes. These are usually presented as competing options, and teams often adopt whichever one happened to be popular when their project began.

We find it more useful to treat them as answers to different questions. Retrieval and long context supply a model with knowledge, whereas fine-tuning shapes its habits. Much of the confusion and wasted budget in this area comes from using a habit-forming technique to supply knowledge, or the reverse.

## In brief

- Retrieval-augmented generation is the sensible default when the knowledge is large, changes often, needs citations or must respect the permissions of each user.
- Long context is the simplest option, and often the best one, when the material is small and stable enough to fit comfortably in the prompt on every request.
- Fine-tuning changes how a model behaves (format, tone, classification, a narrow task) and is a poor way to teach it facts that change or that must be traced to a source.
- The techniques combine well, and many production systems use a fine-tuned or carefully prompted model that reads retrieved documents inside a prompt whose stable prefix is cached.
- The choice should be settled by running the candidates against a test set of real questions, because intuition about which option will be more accurate is often wrong.

## Three mechanisms, defined

**Retrieval-augmented generation (RAG)** is a design in which the system searches a document store for passages relevant to the question and places them in the prompt, so that the model answers from that text rather than from memory. The model itself stays unchanged, and the knowledge sits in an index that you maintain.

**Long context** means putting the whole body of reference material into the prompt on every request, relying on the model's context window, which is the largest amount of text it can read in one call. Current models accept windows large enough to hold hundreds of pages, and because there is no search step, the model does the finding itself.

**Fine-tuning** is further training of an existing model on your own examples, which adjusts its weights so that it responds differently afterwards. With a hosted model the provider runs the training and serves you a private variant, while with an open-weight model you can train lightweight adapters (LoRA is the usual technique) and host the result yourself.

Underneath all three sits ordinary prompting with clear instructions and a handful of worked examples, which is the baseline the others should be judged against.

## How they compare

|  | RAG | Long context | Fine-tuning |
| --- | --- | --- | --- |
| What it supplies | Knowledge, selected per question | Knowledge, all of it every time | Behavior: style, format, task skill |
| Size of material it suits | Large to very large | Small enough to fit the window with room to spare | Not applicable; it learns patterns and does not hold a library |
| Updating the knowledge | Re-index the changed document | Edit the prompt content | Retrain |
| Citations to sources | Natural, because the passages are known | Possible, by asking the model to quote | Not available, since the model cannot say where it learned something |
| Per-user permissions | Enforced by filtering search results | Only if you assemble a different prompt per user | Not enforceable; whatever was trained in is available to every caller |
| Cost per request | Moderate, since only selected passages are sent | High input cost every call, reduced by prompt caching | Low per request with a small model; training and hosting cost up front |
| Main engineering effort | Search quality: chunking, ranking, metadata | Very little | Building and maintaining a training set |
| Typical failure | The right passage is not retrieved | A detail is missed in a very long prompt; cost and latency | Confident recall of outdated or invented facts |

## Where each one fits

### RAG: large, changing, permissioned knowledge

RAG is worth its added complexity when at least one of four conditions holds: the material is too large to fit in a prompt, it changes often enough that answers must reflect this morning's version, users need to see the source, or different users are allowed to see different documents.

The last condition settles the question by itself. A retrieval system applies permissions at the search step, running the query under the user's identity so that documents the user cannot open never reach the model, and neither of the other techniques has a comparable control.

The price is that a RAG system can only be as good as its search. When one gives a wrong answer, the usual reason is that the passage holding the right answer was never retrieved, which we discuss in [most RAG problems are search problems](https://farside.works/insights/most-rag-problems-are-search-problems/). Building [enterprise knowledge search](https://farside.works/services/artificial-intelligence/knowledge-search/) properly takes real effort on chunking, hybrid keyword and vector search, reranking and metadata.

### Long context: small, stable material

When the reference material is a single handbook, contract or product specification, the easiest approach is to include all of it in the prompt. You have no index to build or retrieval to tune, and the search cannot skip the relevant section because there is no search, so for many internal assistants this is the right first design.

Long context has three limits. Input tokens are charged on every request, so cost grows with the size of the material multiplied by the number of calls, although several providers offer prompt caching, which stores a repeated prefix so that later requests reusing it are cheaper and faster, and that changes the economics a good deal for stable material. Latency also rises with prompt length. Accuracy on a detail buried in a very long prompt can be lower than on the same detail in a short one, which means a window that can hold a thousand pages will not necessarily read all thousand with equal care.

### Fine-tuning: behavior and narrow tasks

Fine-tuning suits tasks where you can show the model many examples of input and desired output and want it to produce that output without long instructions. Typical cases are classifying messages into your internal categories, writing in a house style, emitting a specific structured format or performing a narrow extraction. It can also let a smaller, cheaper model match a larger one on that single task, which matters at high volume and is covered in [small language models](https://farside.works/insights/small-language-models/).

As a way to teach facts it works badly. A model fine-tuned on last year's price list will quote last year's prices fluently, with no sign that they are stale and no way to trace the claim, and when prices change you have to retrain. A fine-tuned model also needs maintenance, because the training set has to be curated and the tuned model re-evaluated, and the exercise has to be repeated when the provider retires the base model.

Our working rule is to start with a good prompt and a few examples and to stop there if that meets the bar. We fine-tune when test results show a gap that prompting does not close, or when cost at volume justifies moving to a smaller model.

## Three needs in one logistics company

Take a mid-size logistics company that wants AI support for its operations staff. Three requests come in, and the first instinct is to build one RAG system for all of them.

The first is an assistant for the company's customs procedures handbook, which runs to about sixty pages, is revised a few times a year and is the same for every employee. That makes it a long-context case. The handbook goes into the prompt as a cached prefix, the assistant is asked to quote the section it relied on, and updating the "index" means replacing a file. Retrieval over sixty pages would add a way for the system to fail while solving nothing that needed solving.

The second is question answering over customer contracts and standard operating procedures, which come to tens of thousands of documents, are amended weekly and are restricted so that each account team sees only its own customers. Size, change and permissions all point to RAG here. Most of the effort goes into the search, since contracts need to be chunked by clause, tagged with customer and effective date, and filtered by the user's account access before ranking.

The third is routing inbound emails into about forty internal exception codes, such as "consignee unavailable" or "documents incomplete". No documents need to be consulted, because what the model has to learn is where the company draws the boundaries between its own categories. The team begins with a prompt holding definitions and examples, and on the test set the model confuses several neighboring codes. Since several thousand historically labeled emails are available, the team then fine-tunes a small model, which separates those codes better at a lower cost per email. The team arrived at fine-tuning through evidence, after the prompt had been tried first.

A single architecture for all three requests would have been the wrong choice for two of them.

## Combining them, and what it costs

The techniques can be layered. A common production design keeps stable instructions and reference material in a cached prompt prefix, adds retrieved passages for the question at hand, and uses a model that has been prompted or tuned to answer in the required format.

Costs divide along the same lines. RAG moves cost into building and operating the search stack, long context moves it into token charges on each request, and fine-tuning moves it into data preparation and repeated training. Which is cheapest depends on volume and on how often the material changes, so it should be estimated per use case as part of [running AI in production](https://farside.works/services/artificial-intelligence/ai-operations/). The wider picture of running costs is in [what an AI feature actually costs to run](https://farside.works/insights/what-an-ai-feature-costs-to-run/).

This comparison describes the technology as it stands today. Context windows have grown and prices have fallen, and both trends have moved the line between material that fits in the prompt and material that needs retrieval, whereas the reasoning about permissions, citations and freshness will hold for longer than any particular size threshold.

## What to do next

Before choosing a technique for a [generative AI application](https://farside.works/services/artificial-intelligence/generative-ai/), work through these questions in order.

1. Is the gap one of knowledge or of behavior? When the model lacks facts, look at retrieval or long context; when it has the facts but responds in the wrong way, start with prompting and move to fine-tuning if needed.
2. How large is the material, and does it fit in the prompt with room for the question and the answer?
3. How often does it change, and how quickly must an answer reflect the change?
4. Do different users have different access rights to it? If they do, plan for retrieval with permission filtering.
5. Does the user need to see sources? If so, rule out fine-tuning as the way of supplying knowledge.
6. What is the request volume, and what does each option cost at that volume?
7. Do you have a test set of real questions with agreed correct answers? If not, build one first, because a structured [evaluation](https://farside.works/services/artificial-intelligence/ai-evaluation/) of the simplest candidate against that set will tell you more than any architecture debate.

Begin with the simplest design your answers allow, measure it against that test set, and add machinery only where the measurements show a gap.
