LLM fine-tuning vs RAG: choose by the failure.
Use retrieval-augmented generation (RAG) when your AI needs information from your documents or systems. Test supervised fine-tuning when it has the right information but repeatedly gives the wrong kind of response. Consider reinforcement learning when you can reliably score a completed task and have a safe environment for training.
These methods can work together. Start with a tested prompt and model, identify the failure, and compare the smallest change that could fix it.
Match the method to the problem.
RAG supplies information at the time of a request without changing the model’s weights. Supervised fine-tuning (SFT) changes those weights using examples of the responses or actions you want. Reinforcement learning (RL) updates the model using rewards for generated outputs or actions.
| What fails | First comparison to run | What must be ready |
|---|---|---|
| The answer misses current product details, company policy or a customer record. | Retrieve the relevant approved information, or query the authoritative system, and supply it to the model. | Reliable sources, retrieval checks, version dates and access controls. |
| The model has the right evidence but repeatedly misclassifies a request, formats an answer incorrectly or misuses a tool. | Try clearer instructions and tool schemas. If the gap persists, compare SFT against that stronger baseline. | Representative input/output examples, consistent labels and a separate evaluation set. |
| The task requires several decisions, and you can verify whether the result is correct. | Compare workflow fixes and demonstrations first. Test RL if a measurable skill gap remains. | A capable starting model, trustworthy rewards, an isolated environment and training rights. |
| The model performs well, but an API times out, a permission is missing or an approval has no owner. | Fix the integration, access policy or operating process. | Failure logs, clear responsibility and recovery checks. Model training does not repair these dependencies. |
Changing company facts and repeated behavior errors often occur together. A fine-tuned model can still retrieve current information. AWS’s task-specific comparison tests both approaches and a combined configuration; its results depend on the model, data and evaluation used.
Use RAG for information the model must check.
For a support assistant, this could mean retrieving the current cancellation policy and the customer’s subscription before drafting a reply. Keep live account state in the system that owns it. The model should receive only the records that the current user and task are allowed to access.
Check retrieval separately from answer generation: did the system find the right source, provide the relevant passage and use the current version? Then check whether the answer follows that evidence. Ask for source references and verify them; retrieval alone does not guarantee a correct answer or a valid citation.
RAG is not limited to vector search. Search, structured database queries and document retrieval can supply different parts of the context. Our company brain guide explains how knowledge, memory and permissions fit together. Google Cloud’s grounding guidance also describes retrieving from search engines and databases.
Use fine-tuning for a repeated behavior gap.
Suppose the support assistant sees the right policy but keeps returning the wrong resolution category or an unusable handoff. First improve the prompt, examples, tool descriptions and output validation. Fine-tuning becomes worth testing when these changes leave a consistent gap and you have good demonstrations of the desired behavior.
For each training example, retain the actual input context and the approved response or action. Check ambiguous labels and remove private data the training setup is not authorized to process. Hold back examples from different customers, documents or time periods where appropriate, so the final evaluation tests more than near-duplicates of the training data.
Hugging Face’s SFT documentation describes training on prompt/completion and conversational examples. A training run must be compared with the unchanged baseline on held-out cases. Fine-tuning can improve domain performance, but it does not replace current records, permissions or source verification.
Consider RL when you can score the completed task.
For an agent that checks an account, selects an allowed resolution and prepares a support response, a useful reward must reflect the result you actually want. A shorter answer or a closed ticket alone is a poor substitute for a correct, authorized resolution.
- Define the task result. Check the account, apply the relevant policy, prepare the correct action and identify exceptions that require approval.
- Test the reward. Include cases where the answer sounds plausible but uses the wrong account, invents evidence or proposes an unauthorized action. The scoring must catch them.
- Separate training from acceptance. Keep held-out cases and independent acceptance checks outside the optimization loop. An improved training reward is not enough.
- Keep permissions in the application. The agent must not be able to change its evaluator or grant itself access. Consequential actions retain their agreed approval requirements.
Hugging Face’s GRPO documentation shows how generated completions receive rewards during RL training. Anthropic’s reward-tampering research explains why a model can satisfy a scoring rule without achieving its intended purpose. Our reinforcement learning service starts with task fit, the environment, reward checks and a bounded comparison.
Compare the changes on the same support task.
Consider a support assistant that gives outdated policy answers, selects the wrong resolution and occasionally attempts actions that need approval. Record each failure separately before choosing a method.
- Establish the baseline. Save the model and prompt versions, available tools, source documents and a fixed set of support cases. Record correct resolutions, evidence errors, approval violations, reviewer effort, latency and cost separately.
- Test retrieval. Supply the current policy and permitted account facts. Compare answers on the same cases. If the remaining error is a missing source, repair retrieval before training.
- Test behavior changes. Improve instructions and schema validation. If resolution selection still fails, compare an SFT candidate trained on separate, reviewed examples.
- Assess RL fit. If a capable model still fails a checkable sequence of decisions, test whether the environment and reward distinguish successful resolutions from shortcuts. Agree any training run and compute budget separately.
- Make the release decision. Use the held-out comparison and failure review. Retain the baseline if the candidate adds cost or risk without a useful improvement.
The purpose of this comparison is to find the change that improves your task. It does not require testing every training method. See our AI agent evaluation guide for release checks and monitoring.
Compare total cost and maintenance.
RAG requires document preparation, retrieval infrastructure and ongoing source updates. Fine-tuning adds example preparation, training and model-version evaluation. RL adds environment design, reward validation and repeated generation during training. Every approach also has inference, monitoring and human review costs.
Compare cost per accepted task at the quality, response time and access controls your product requires. A smaller tuned model may reduce serving cost in one workload; a well-designed retrieval system may be sufficient in another. Neither approach is universally cheaper. Recheck the decision when the task, source material or model changes.
Define the first comparison before commissioning training.
We assess the task, inspect representative failures and agree an evaluation. The first project can produce a documented baseline, a failure analysis and a scoped comparison of the most relevant approach. You get the test cases, acceptance criteria, cost assumptions and a recommendation for what to build next.
For a known product brief, explore AI product development. For a training-specific gap, see our RL assessment and engineering scope.