RAG vs Fine-Tuning: How to Choose
Retrieval-augmented generation gives a model your facts at answer time; fine-tuning changes how the model behaves. Most business problems need RAG first, some need fine-tuning, and a few need both. Here is how to tell which.

In short
Use retrieval-augmented generation (RAG) when answers must come from your own, changing documents, with citations and per-user permissions. Use fine-tuning when you need a consistent format, tone or narrow skill that prompting can’t deliver reliably. Start with RAG and fine-tune only for the failures that remain. Solidity Labs builds both and decides with an evaluation set.
Key takeaways
- RAG adds knowledge at answer time; fine-tuning adjusts behavior. They solve different problems.
- If facts change often, need citations or depend on user permissions, start with RAG.
- Most RAG failures are search failures. Check whether the right passage was retrieved before you change the prompt or the model.
- Fine-tuning helps with strict output formats, domain style and narrow classification tasks, and can let a smaller model do the job. It is an unreliable way to add facts.
- Decide with an evaluation set of real questions and expected answers, kept separate from any training data.
On this page (7)
If you want a language model to answer from your own documents, start with retrieval, not fine-tuning. Retrieval gives the model your facts at the moment it answers. Fine-tuning changes how the model behaves, such as its format, tone or a narrow skill. Fine-tuning a model to make it “know” your documents tends to produce confident answers that are still wrong, and published research on knowledge injection points the same way.
Two techniques, two problems
Put simply: RAG changes what the model knows at the moment of answering. Fine-tuning changes how the model behaves.
Side by side
| RAG | Fine-tuning | |
|---|---|---|
| Best for | Answers from your documents | Consistent format, style or narrow skills |
| Facts that change often | ✓ Update the index | ✕ Retrain to update |
| Citations to sources | ✓ | ✕ |
| Respects per-user permissions | ✓ Filter at retrieval | ✕ Knowledge is baked in for everyone |
| Data you need | Parseable documents with access, date and version metadata | Consistent input and output examples in the production format |
| Upfront work | Ingestion, chunking, search, evaluation | Curated training examples, training runs, evaluation |
| Per-query cost | Grows with context length | Can fall if a smaller model is enough |
| Typical failure | Retrieves the wrong or an outdated passage | Confident but wrong or outdated output |
| Security risks to plan for | Permission leaks, poisoned or instruction-laden documents | Poisoned or sensitive training data |
When RAG is the right start
Choose retrieval when any of these apply:
- Answers must be grounded in specific documents, such as policies, contracts, product data or technical manuals.
- Content changes, so retraining would be constant.
- People need to see sources to trust or verify the answer.
- Different users may see different content, which retrieval can enforce by filtering passages on each user’s permissions before the model sees them.
Our permission-aware knowledge assistant example shows that last point with synthetic documents and three roles.
What makes RAG work well
Most RAG quality problems are search problems, not model problems:
- Chunking (splitting documents into passages) that keeps meaningful units together, such as a clause, a table or a procedure step.
- Hybrid search that combines keyword and semantic (embedding) search, so exact terms such as clause numbers and paraphrases both match.
- Re-ranking, where a second model scores the top results for relevance before they reach the language model.
- Metadata filters for permissions, dates, versions and document types.
- An instruction to answer only from the passages and to say so when they don’t cover the question.
Measure retrieval on its own. For each test question, check whether the passage that holds the answer appears in the top results. If it doesn’t, no prompt or model change will fix that answer.
How RAG fails, and how to spot it
- The right passage is never retrieved. The answer says the topic isn’t covered, or stays vague, although the document has it. A retrieval check in your evaluation set finds this.
- The passage is retrieved but misread. The answer cites a passage that doesn’t say what the answer claims. Check that each cited passage supports the sentence it is attached to.
- Old versions outrank current ones. A superseded policy sits in the index next to its replacement. Store version and date metadata, and include test questions whose answer has changed.
- Chunking breaks structure. A table, a list of conditions or an exception is split across passages, so answers miss the exception. Questions about edge cases expose it.
- Permissions leak. The filter is applied after generation, or a cache serves one user’s answer to another. Test every role with questions it must not be able to answer.
- Documents carry instructions. Retrieved text, including hidden text, can try to steer the model. This is indirect prompt injection, the first risk in the OWASP Top 10 for LLM Applications. Its 2025 edition also lists vector and embedding weaknesses, such as weak access control and poisoned documents, as a separate risk.
When fine-tuning helps
Fine-tuning earns its place when prompting and retrieval have been tried and a specific behavior is still unreliable:
- Strict output formats, such as structured extractions that must always match a schema.
- Domain style and terminology, such as clinical notes or legal drafting conventions, applied consistently.
- Narrow, high-volume tasks, such as classifying tickets into your categories, where a fine-tuned small model can match a large general one at lower cost and latency.
- Distillation, where a smaller model is trained on a larger model’s outputs for your task.
LoRA (low-rank adaptation) makes fine-tuning cheaper. It freezes the base model and trains small added weights, so one base model can serve several tasks by swapping adapters.
How fine-tuning fails
- Inconsistent examples. If two reviewers would label the same ticket differently, the tuned model will be inconsistent too. Check agreement between reviewers before training.
- Answers the input doesn’t support. Training examples whose answers rely on facts missing from the input teach the model to make facts up.
- A test set that leaked into training. Scores look excellent and production results don’t match. Keep the evaluation set out of the training data from the start.
- Regressions elsewhere. The model gets better at the target task and worse at something it did well before. Run a general check set alongside the task set.
- Sensitive data in the examples. Data in training examples can surface later in outputs, to any user. Remove what the model’s users may not see.
- A retired base model. A tuned model depends on its base model and on the provider’s fine-tuning offering, and both change. Keep the training data and evaluation set so you can tune again.
What drives the cost
For RAG, cost follows:
- Preparing the sources. Scans, complex tables and duplicate documents add work before anything can be searched.
- Tokens per query. Every passage sent to the model adds to each answer’s cost.
- Search calls. Embedding and re-ranking run on every query.
- Upkeep. The index has to stay in sync with the documents, and the evaluation set has to stay current.
For fine-tuning, cost follows:
- Training examples. Building and reviewing them is the main effort, because every example must be correct and consistent.
- Training runs. Each experiment is another run.
- Serving the tuned model, and tuning again when the base model or the task changes.
Against that, a tuned model can need shorter prompts or a smaller model for each query.
When to combine them
The two work well together: a fine-tuned model that reliably follows your answer format, citation style and tone, answering from passages supplied by retrieval. Build this only when evaluation shows that a well-prompted model with retrieval still misses the format or style often enough to matter.
Decide with evaluation, not opinion
-
Collect real examples
Gather questions or tasks from actual users, with the answer a good employee would give and the sources they would use. Include difficult and unanswerable cases.
-
Measure a baseline
Run a strong prompt with retrieval. Score retrieval and answers separately: was the right passage found, was the answer correct and supported by its citations, did it decline unanswerable questions, and what were the latency and cost?
-
Fix the biggest failure first
If the right passage wasn’t found, improve search. If it was found but the answer was wrong or badly formatted, improve the prompt, then consider fine-tuning.
-
Re-run on every change
Keep the evaluation set and run it whenever the model, prompt, index or data changes.
Before we recommend fine-tuning, we check that:
- the baseline, a strong prompt with retrieval, has been measured on the evaluation set;
- the remaining failures are about behavior, such as format, style or classification, not missing facts;
- there are enough consistent examples to train on, plus a test set that is never used for training;
- the training data is cleared for this use and holds nothing the model’s users may not see;
- we know where the tuned model will run and how it will be tuned again when its base model is retired.
Our RAG system development and LLM fine-tuning pages describe how we build and evaluate each.
For an internal assistant built on these choices, see enterprise knowledge assistant. The glossary defines RAG, fine-tuning and vector databases.
Frequently asked questions
What is the difference between RAG and fine-tuning?
Retrieval-augmented generation (RAG) finds relevant passages from your documents at question time and gives them to the model to answer from, usually with citations. Fine-tuning further trains a model on examples so that it behaves differently, for example following a format or style, without looking anything up.
Does fine-tuning teach a model new facts?
Only unreliably. One study comparing the two found retrieval consistently more accurate than fine-tuning for adding knowledge. Another found that models learn new facts slowly through fine-tuning and hallucinate more once they do. Facts learned this way can’t be cited and go stale when they change. For facts that must be accurate and current, retrieval is safer, because the source is shown and can be updated without retraining.
Is RAG cheaper than fine-tuning?
Often to start, because it needs no training run and updates when documents change. Its running costs depend on how much context is sent with each query. Fine-tuning adds data preparation and training, but it can reduce per-query costs if it lets a smaller model or a shorter prompt do the job well.
Can I use RAG and fine-tuning together?
Yes. For example, a fine-tuned model can reliably follow your output format and tone while it answers from passages a retrieval system supplies. Add the second technique only when evaluation shows the first one isn’t enough.
What is LoRA?
LoRA (low-rank adaptation) fine-tunes a model by freezing its original weights and training a small set of added parameters. It makes fine-tuning cheaper and lets one base model serve several tasks by swapping small task-specific adapters.
What data does each approach need?
RAG needs source documents you can parse, with metadata for access rights, dates and versions. Fine-tuning needs consistent input and output examples in the exact format used in production. Both need an evaluation set of real questions with expected answers, and for fine-tuning that set must never be used for training.
How do you decide which approach is better for a use case?
Build an evaluation set: real questions or tasks with expected answers and sources. Test a strong prompt with retrieval first, measure retrieval, accuracy, citation quality and failures, then try fine-tuning only for the failures that remain.
Sources
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, Lewis et al., arXiv, 2020
- LoRA: Low-Rank Adaptation of Large Language Models, Hu et al., arXiv, 2021
- Fine-Tuning or Retrieval? Comparing Knowledge Injection in LLMs, Ovadia et al., arXiv, 2023
- Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations?, Gekhman et al., EMNLP 2024, 2024
- OWASP Top 10 for Large Language Model Applications, OWASP Gen AI Security Project, 2025
- LLM08:2025 Vector and Embedding Weaknesses, OWASP Gen AI Security Project, 2025


