Fine-tuning or RAG: what to choose to make a model work with your data
Fine-tuning changes how a model behaves, while RAG and long context give it facts. We compare three approaches by cost, effort and freshness and give a rule for choosing.
6 min · · models · сравнение
Fine-tuning or RAG: the question sounds like a choice between two options, but in fact these are different tools for different jobs. Fine-tuning changes the behavior of the model itself: style, answer format, narrow specialization. RAG (retrieval-augmented generation) and long context do not change the model but put the needed facts into the request. Below we compare three approaches and give a simple rule for choosing.
A note on scope first. Zukko is a gateway for requests to ready-made models, and below we calculate the cost of requests. We do not describe or know how fine-tuning is run and priced at specific suppliers: their terms are their own and change, so check them on the supplier's site.
How the three approaches differ in essence
Fine-tuning takes an already trained model and trains it further on your "question → correct answer" examples. After that the model reacts to requests differently. Facts are remembered unreliably and with no source: fine-tuning suits manner better than knowledge.
RAG stores your documents separately, finds suitable fragments for each question and adds them to the request. The model does not change, the input text does.
Long context puts whole documents into the request. It is the simplest option, limited by window size (most models in the Zukko catalog have 1M tokens, Grok 256K, GLM 5.3 128K) and by the price of each request.
Fine-tuning or RAG: a comparison table
| Criterion | Fine-tuning | RAG | Long context |
|---|---|---|---|
| What it changes | behavior, style, format | the set of facts in the request | the set of facts in the request |
| Updating data | needs retraining | update the index | replace the text |
| Source reference | no | yes, the fragment is known | yes, the document is known |
| Initial work | collecting and cleaning examples, quality evaluation | splitting, index, retrieval | almost none |
| Ongoing costs | training and storing a model version | index, database, upkeep | none |
| Cost of one request | like a normal model, often a shorter prompt | input grows by the found fragments | input grows by the whole document |
| Main risk | the model "forgets" or confuses facts | bad retrieval | high price at large volumes |
When fine-tuning fits
Consider fine-tuning if all conditions hold:
- The task repeats thousands of times in one format (for example, labeling tickets into your categories).
- You have hundreds or thousands of verified "input → correct output" examples.
- You need a particular style, a strict format or a short prompt, not new knowledge.
- You are ready to evaluate quality on a held-out set and repeat training when the rules change.
Before fine-tuning try cheap substitutes: a clear instruction and a few examples right in the prompt. The techniques are described in few-shot examples in a prompt. Often this is enough and nothing needs retraining.
When RAG for an AI assistant fits
RAG for AI is needed when answers depend on facts that change often or do not fit in the window: a support knowledge base, internal regulations, a product catalog. It gives what fine-tuning does not: fresh data without retraining and a source reference. If a price or a rule changes in the base, updating the index is enough.
What to keep in mind: you will have to build retrieval and test it separately, and the answer will be no better than the found fragments. A minimal code example is in the article RAG by hand.
When long context is enough
If there are few documents and few questions, the cheapest path in effort is to put everything in the request. Especially when you need to work with a document as a whole: compare two contract versions, find contradictions, write a summary. Fragment search breaks such tasks, while long context does not.
What it costs in requests
Take an example: a handbook of 30 thousand tokens and 5000 requests per month. Output tokens are left out of the comparison: they are the same in both options. For RAG we take 3000 input tokens per request. Prices as of 18 October 2026, $ per 1M tokens (input), formula: tokens × price.
| Option | Input tokens | deepseek-v4.1-flash (0.013) | gpt-6.1-sol (0.27) | claude-sonnet-5-5 (0.4) |
|---|---|---|---|---|
| Whole context, no cache | 5000 × 30k = 150M | $1.95 | $40.50 | $60 |
| RAG | 5000 × 3k = 15M | $0.195 | $4.05 | $6 |
With cache the picture for long context changes a lot if the prefix is identical and requests are frequent enough. The ideal case (cache hits on every request except the first):
gpt-6.1-sol: 0.03 × 0.27 + 4999 × 0.03 × 0.013 = 0.0081 + 1.95 = about $1.96.claude-sonnet-5-5in the Anthropic format (write 0.5, read 0.05): 0.03 × 0.5 + 4999 × 0.03 × 0.05 = 0.015 + 7.50 = about $7.51.
So with a small base and frequent requests, cached long context can be comparable to RAG in price and needs no index. But the calculation is ideal: if there are long pauses between requests, the cache expires, and the next request is again billed at the input price, and for Claude with a cache write on top. How cache is accounted is described in the limits and cache documentation, and the general logic is in the article prompt caching.
Fine-tuning deliberately has no row in this table: the price depends on the supplier and the size of the training set, while the price of a request you already know from the catalog price table. Current prices are GET https://api.zukko.pro/v1/models or the Models page in the dashboard.
A five-minute rule for choosing
Ask yourself the questions in order:
- Is it about facts or manner? If the model does not know your data, you need context or RAG. If it knows but answers in the wrong format or style, try a prompt with examples, then fine-tuning.
- Does the data fit in the window, and how many questions are there? Little data and few questions: long context. A lot of data or many questions: RAG.
- Does the data change? If yes, fine-tuning for facts is out: you would have to retrain constantly.
- Do you need source references? Then RAG or context.
- What does a mistake cost? For legal and medical answers you need a source and human review regardless of the approach.
The approaches are combined: fine-tuning handles format, RAG handles facts. But start with the simplest, long context, and complicate things only when it stops working.
Test any approach on your own questions: a model's intelligence index and price do not replace a test.
FAQ
Will fine-tuning teach the model my documents?
Partly and unreliably. The model may remember some facts but get details wrong and not show a source. For knowledge, RAG or context is better.
What is cheaper?
It depends on volume. For a small base and rare requests, long context is cheapest because there are no index or training costs. For a large base and frequent requests, RAG is cheaper. Calculate with the formula above on your own numbers.
Can fine-tuning and RAG be combined?
Yes. Fine-tuning sets format and tone, RAG brings current facts. But it is the most labor-intensive option and is not the place to start.
How do I check that the chosen approach works?
Collect 20 to 50 real questions with known answers and run them after every change. You can try a cheap model with a key from the dashboard.
zukko
Pay 25×
less
for Claude Code & ChatGPT
One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.
Related articles
- GPT-6 Astra or Claude Fable 5.1: Two Top Models by Price and IndexTwo premium models with the same intelligence index and different Zukko prices. We price a single request and an agent session with cache, and explain how to choose on your own data.
- Qwen or DeepSeek via API: Price, Context and Intelligence IndexFour models, one task and an honest calculation: what a run costs on Qwen 3.8 Max and Flash versus DeepSeek V4 Pro and V4.1 Flash.
- Claude Fable 5.1 or Sonnet 5.5: when a big price gap is justifiedFable 5.1 costs far more than Sonnet 5.5. We price the same task in both API formats and give a way to choose the model from results on your own examples.
- DeepSeek V4 Flash or V4.1 Flash: which cheap model to pickA newer version is not always more expensive. We compare DeepSeek V4 Flash and V4.1 Flash on price, cache, context and intelligence index, cost a workload and show how to test.