Fine-Tuning vs. Retrieval
Decide whether to retrain a model or feed it documents at question time, with costs, risks and a test plan.
Key takeaways
- Retrieval adds knowledge at question time, so updating a document updates the answers.
- Fine-tuning changes the model's weights and is strongest for tone, structure and specialized behavior.
- Try clearer prompts and good examples before investing in either technique.
- Build a test set of real questions first, because without one you can't tell whether a change helped.
If you want an AI model to answer questions about your own material, retrieval is usually the place to start: find the relevant passages when a question arrives and put them in front of the model. Fine-tuning, which means training a model further on your examples, is better suited to teaching a consistent style, format or behavior than to loading it with facts.
The two solve different problems and can be combined. This article shows how each works, what it costs to maintain and how to test which one you need.
Start with the cheapest fix
Before building anything, improve the prompt. State the audience, the format and the rules. Paste the relevant document directly if it's short enough. Provide two or three examples of good answers. Many "we need custom training" problems vanish at this stage. How to write better prompts gives patterns to try.
If your material is too large to paste every time, or changes often, or the answers still miss the mark, move to retrieval or fine-tuning.
How retrieval works
Retrieval-augmented generation, often called RAG, keeps your documents outside the model. You split them into chunks, index them, and when a question arrives, search the index for the best chunks. Those chunks are inserted into the prompt with the question, and the model answers from them.
Search can be keyword-based, or semantic, which compares numerical representations of meaning called embeddings, or both. Semantic search and embeddings explains the second, and retrieval-augmented generation in search shows the same idea in public search products.
How fine-tuning works
Fine-tuning starts from an existing model and continues training it on a set of examples, usually pairs of input and desired output. The process nudges the weights so the model behaves more like those examples. Lighter methods adjust only a small set of added parameters, which reduces cost; one widely used approach is called LoRA, short for low-rank adaptation.
The examples are the product. A few hundred or a few thousand carefully written, consistent samples often matter more than any training setting. Contradictory or sloppy examples teach contradictory, sloppy behavior.
What each is good at
| Need | Retrieval | Fine-tuning |
|---|---|---|
| Answers from current policies or manuals | Strong | Weak |
| Showing sources | Natural fit | Not built in |
| Consistent output format or voice | Helps somewhat | Strong |
| Handling frequent changes | Update the index | Retrain |
| Shorter prompts at runtime | No | Often yes |
| Removing a specific fact | Delete the document | Difficult |
Fine-tuned models can memorize some facts from examples, but not dependably. They may blend them with older knowledge or state them wrongly, and you can't easily point to where an answer came from.
Where retrieval fails
Retrieval is only as good as the search. Common problems:
- Chunks cut a table or procedure in half, losing meaning.
- The right passage isn't ranked near the top.
- Old and new versions of a policy both get retrieved.
- The question uses different words from the document.
- The model answers from general knowledge when retrieval returns nothing useful.
Fixes include splitting along headings, keeping titles and dates with each chunk, removing obsolete files, combining keyword and semantic search, and instructing the model to say when the passages don't answer the question. Log which chunks were used so you can see why an answer went wrong.
Where fine-tuning fails
Fine-tuning can make a model worse at things outside your examples, sometimes called forgetting. It can overfit, repeating phrasing from the examples. If your data includes personal or confidential information, the model may reproduce it to users who shouldn't see it. When the underlying base model is replaced or retired, you may need to redo the work.
Evaluate the tuned model against the original on a broad test, including questions it wasn't trained on.
Security and access
Retrieval makes permissions your job. If every employee's question searches every file, the model can reveal documents the asker isn't allowed to read. Filter the search by the user's existing access rights before anything reaches the model.
Documents can also contain hostile instructions, for instance text on a web page telling an assistant to ignore its rules. Treat retrieved text as untrusted data, limit what the system can do automatically, and read prompt injection explained.
For fine-tuning, you can't apply per-user permissions to knowledge baked into weights, so don't train on material that only some users may see.
Cost and upkeep
Retrieval costs include indexing, storage, the search itself and longer prompts on every request, which add token charges. See tokens and context windows for why. Upkeep means keeping the index in step with your sources.
Fine-tuning costs include preparing examples, which is often the largest effort, training runs, hosting a custom model, and repeating the process when requirements change. Prices and options vary by provider and change often, so estimate from current documentation.
Test before you commit
- Collect 30 to 100 real questions with agreed good answers.
- Include cases where the right response is "that isn't covered".
- Score a plain prompt first as your baseline.
- Add retrieval and score again, checking both the passages found and the final answer.
- Try fine-tuning only if a specific gap remains.
- Rerun the whole set after every change.
Score separately whether the search found the right material and whether the model used it correctly. That split tells you which part to fix.
A worked scenario
Say a small company wants a help assistant for its product. Manuals change with each release, and customers need links to the right page. Retrieval fits: index the manuals, tag each chunk with its version, and show the source.
Later they notice replies are too long and inconsistently formatted. Better instructions and examples may fix that. If not, a modest fine-tune on well-edited sample replies could, while retrieval keeps supplying the facts.
Preparing documents for retrieval
Most disappointing retrieval systems have a document problem. Before tuning any search settings, look at what you're indexing. Remove drafts and superseded versions. Make sure scanned files have accurate text. Give every document a clear title, a date and an owner.
Then split sensibly. Keep a procedure's steps together, repeat the section heading in each chunk, and keep tables with their column labels. A chunk should make sense to a person reading it alone. If it begins with "This also applies to the above", the model will have no idea what "the above" is.
Plan for updates. Decide how changed files get reindexed and how deleted ones are removed, then test both. A stale chunk that lingers in the index will be quoted with the same confidence as a current one.
Preparing examples for fine-tuning
Good training examples look exactly like the work you want. Use realistic inputs, including messy ones, and write the output you'd accept from a careful employee. Cover edge cases, such as requests that should be declined or passed to a person.
Have two people review a sample and compare their judgments. If they disagree about what a good answer is, the model will receive mixed signals. Remove personal details and secrets before anything is uploaded, and keep a portion of examples aside for testing so you aren't grading the model on material it has already seen.
Record the base model, data version and settings for each run. Without that record, you can't reproduce a good result or explain a bad one.
Combining the two
Many mature systems use both, with a clear division of labor. Retrieval answers the question "what is true right now?" by supplying current passages. A tuned model, or simply a well-written set of instructions, answers "how should we say it?" by fixing tone, structure and when to hand off to a person.
If you combine them, include retrieved passages in the training examples, so the model learns to rely on supplied text and to admit when it's missing. A model tuned only on bare questions and answers may learn to respond from memory, which works against the retrieval step.
Add one change at a time. When quality moves, you want to know which part moved it, and whether the gain is worth the extra thing you now have to maintain.
Common questions
Does retrieval stop hallucinations?
It reduces them when the right passages are found and the model sticks to them. It doesn't remove them, so show sources and spot-check. Why AI models hallucinate explains the leftovers.
How much data do I need to fine-tune?
It depends on the model, method and task. Start small with high-quality examples, measure, and add more only where tests show weakness.
Is a long context window a replacement for retrieval?
For small, stable collections, loading everything can work well. For large or changing ones, retrieval is usually cheaper, quicker and easier to audit.