Your LLM feature gives generic answers, so someone on the team says "we should fine-tune it on our data." Someone else says "we need RAG." Both are right about the symptom and often wrong about the cause, because the two techniques change different things.
This guide explains RAG vs fine-tuning from a developer's point of view: what each technique actually changes, how they compare on cost and maintenance, how to decide, and when to combine them. It also covers an easily missed fact: access to fine-tuning varies by provider, and OpenAI has announced it is winding down its self-serve fine-tuning platform.
Direct answer: RAG or fine-tuning?
- Choose RAG when the problem is knowledge: private, large, changing or citable information. RAG adds facts at query time.
- Choose fine-tuning when the problem is behaviour: a consistent format, tone, classification boundary or task skill that prompting does not achieve reliably. Fine-tuning changes the model.
- Start with prompting and evaluation. Many problems are solved before either is needed.
- Combine them when you need both current knowledge and specialised behaviour. RAG supplies the facts; a tuned model shapes how they are used.
Table of contents
- What each approach changes
- RAG vs fine-tuning: comparison table
- How to decide: a practical flowchart
- Where fine-tuning stands today
- Evidence first: build an evaluation harness
- Combining RAG and fine-tuning
- Real-world engineering view
- Common mistakes
- Best practices
- Frequently asked questions
- Conclusion
- References
What each approach changes
RAG (retrieval-augmented generation) leaves the model alone and changes its input. Your application retrieves relevant passages and includes them in the prompt, so the model answers from fresh, specific context. For the full pipeline, see What Is RAG in AI?.
Fine-tuning changes the model's weights by training on example inputs and outputs. OpenAI's model optimization guide describes it as taking a base model, providing the kinds of inputs and outputs you expect in your application, and getting a model that excels at those tasks. It lists uses such as having a model consistently format responses a certain way or handle novel inputs, and benefits such as training on more examples than fit in a prompt and using shorter prompts, which can save tokens and lower latency.
The practical rule that follows: fine-tuning teaches patterns; RAG supplies facts. Trying to inject a changing knowledge base through fine-tuning is expensive and goes stale, and trying to teach a strict output style through retrieved documents is unreliable.
RAG vs fine-tuning: comparison table
| Criterion | RAG | Fine-tuning |
|---|---|---|
| What it changes | The prompt (context at query time) | The model's weights |
| Best for | Private, large or frequently updated knowledge | Consistent format, tone, classification, task skill |
| Updating knowledge | Edit or re-index documents; effective on the next query | Requires a new training run and evaluation |
| Source citations | Natural: you know which chunks were used | Not built in; the model cannot point to a source |
| Access control | Filter retrieval per user or tenant | Hard: trained knowledge is available to every user of that model |
| Upfront effort | Ingestion, chunking, retrieval and evaluation pipeline | Dataset creation and cleaning, training, evaluation |
| Ongoing cost | Extra tokens for retrieved context, embedding and search infrastructure | Training runs, plus hosting or inference pricing for the tuned model |
| Latency | Adds a retrieval step and longer prompts | Can allow shorter prompts; no retrieval step |
| Typical failure | Wrong chunk retrieved, so a wrong answer | Overfitting, forgotten behaviours, stale baked-in facts |
| Reversibility | Easy: change retrieval or prompt | Harder: retrain or revert to the base model |
These are tendencies. Actual costs depend on volumes, model choice and provider pricing, so measure with your own numbers instead of trusting generic claims.
How to decide: a practical flowchart
flowchart TD
A[Model output is not good enough] --> B{Have you written evals and tried better prompts and examples?}
B -->|No| C[Do that first]
B -->|Yes| D{Is the failure missing or outdated knowledge?}
D -->|Yes| E[Use RAG]
D -->|No| F{Is the failure format, tone or task consistency?}
F -->|Yes| G{Do you have hundreds to thousands of quality examples?}
G -->|Yes| H[Consider fine-tuning]
G -->|No| I[Improve prompts or collect examples]
F -->|No| J[Re-examine data, tools or model choice]
E --> K{Also need specialised behaviour?}
K -->|Yes| L[Combine RAG and a tuned model]
K -->|No| M[Ship RAG and keep evaluating]A few signals that point each way:
- RAG signals: "the model doesn't know about X", "answers must cite documents", "content changes weekly", "different customers may see different data".
- Fine-tuning signals: "it must always return exactly this structure", "our support tone is specific", "a small model should do this narrow task cheaply", "we have many labelled examples".
- Neither yet: you have not measured the problem. Without evals you cannot tell whether a change helped.
Where fine-tuning stands today
Availability matters in a decision, and it differs by provider. At the time of writing (November 2026), OpenAI's documentation states that it is winding down its fine-tuning platform: it is no longer accessible to new users, existing users can keep creating training jobs for a limited period, and fine-tuned models remain available for inference until their base models are deprecated. OpenAI's deprecations page lists self-serve fine-tuning job creation with a January 6, 2027 shutdown date and restricted access.
Two consequences for developers:
- If you are new to OpenAI fine-tuning, you probably cannot start there. Check the deprecations page and the model optimization guide for current status before planning.
- If you already depend on a fine-tuned model, plan for the base model's deprecation schedule, since fine-tuned versions follow it.
Fine-tuning itself is not going away as a technique. Other providers and open-weight models still support it, including parameter-efficient methods such as LoRA described in the LoRA paper. If your plan depends on fine-tuning, confirm what your chosen provider supports today, and design your system so the model behind it can be swapped.
This is also an argument for starting with RAG and prompting: they work across providers and models, and they do not tie your investment to one vendor's training platform.
Evidence first: build an evaluation harness
OpenAI's model optimization guide recommends starting with evals that measure output and establish a baseline, then prompting, and only then considering fine-tuning. A minimal harness is small enough to build in an hour and will tell you which approach your problem needs.
// eval.mjs: compare variants on the same labelled questions (example, not production-ready)
import OpenAI from "openai";
const openai = new OpenAI();
const cases = [
{ q: "What is the refund window for monthly plans?", mustInclude: ["14 days"] },
{ q: "Do you support SAML SSO on the Pro plan?", mustInclude: ["Business"] },
{ q: "Reply with exactly one word: positive or negative. Review: 'Great product'", mustInclude: ["positive"] },
];
async function score(label, answerFn) {
let pass = 0;
for (const c of cases) {
const answer = (await answerFn(c.q)).toLowerCase();
if (c.mustInclude.every((s) => answer.includes(s.toLowerCase()))) pass++;
}
console.log(`${label}: ${pass}/${cases.length}`);
}
const plain = async (q) => (await openai.responses.create({ model: process.env.OPENAI_MODEL, input: q })).output_text;
// const withRag = async (q) => { ...retrieve chunks, then call the model with them... };
await score("prompt only", plain);
// await score("with RAG", withRag);
Read the failures, not just the score. If failed cases are "does not know our policy", that is a retrieval problem. If they are "knows the policy but formats it wrong or drifts in tone", that is a behaviour problem, and examples in the prompt, structured outputs or a tuned model are the candidates. Substring checks are crude; for open-ended answers add rubric-based or human review.
For comparison, a fine-tuning dataset for a chat model is usually a JSONL file where each line is a short conversation showing the ideal answer. The exact schema depends on the provider, so check its documentation; the common chat shape looks like this:
{"messages": [{"role": "system", "content": "Classify the ticket as billing, bug or other."}, {"role": "user", "content": "I was charged twice this month."}, {"role": "assistant", "content": "billing"}]}
Collecting a few hundred clean, consistent lines like this is usually the hard part of fine-tuning, not the training run. If you cannot produce that data, you are not ready to fine-tune.
Combining RAG and fine-tuning
The two are not exclusive. A common split:
- RAG provides current, permissioned knowledge and citations.
- Fine-tuning (or strong prompting with examples) gives consistent tone, output structure or a narrow classification skill, possibly on a smaller, cheaper model.
For instance, a tuned model might be trained to always answer in a fixed JSON structure and to refuse politely when the supplied context lacks the answer, while retrieval provides the facts at runtime. Only add the second layer after the first is measured. Each layer adds evaluation and maintenance work, and a tuned model trained on today's prompt format is tied to it.
Real-world engineering view
This is a general view, not a description of a specific product.
Choosing for a SaaS support assistant. The knowledge (help articles, plans, policies) changes monthly and varies by customer, so RAG is the obvious fit. If answers also need to match a strict ticket-routing schema, structured outputs usually cover that without training (OpenAI integration guide).
Maintainability. RAG's maintenance is ordinary data engineering: re-index on change, monitor retrieval quality. Fine-tuning's maintenance is ML lifecycle work: dataset versioning, retraining when the base model changes, regression evals before each swap.
Security and privacy. Fine-tuning bakes training data into weights, which is awkward for per-tenant data and for deletion requests. RAG keeps data in a store you control, with deletion and access control you can enforce in SQL. See authorization and row-level security.
Cost. RAG pays per query (extra input tokens, embedding and search). Fine-tuning pays up front (data and training) and possibly in higher per-token pricing for tuned models, in exchange for shorter prompts or a smaller model. Which is cheaper depends on query volume and prompt size; do the arithmetic with current provider pricing.
Retrieval architecture. If you go with RAG, the retrieval layer matters more than the model. See Vector Databases Explained and How to Build an AI-Powered Search System.
Common mistakes
- Fine-tuning to add knowledge. Facts baked into weights go stale and cannot be cited or access-controlled.
- Using RAG to fix style. Retrieved documents do not reliably enforce tone or format.
- Skipping evals. Without a baseline you cannot tell whether either approach helped.
- Skipping prompting. Clear instructions, examples and structured outputs solve many problems for free.
- Fine-tuning on a small, messy dataset. Inconsistent examples teach inconsistent behaviour.
- Planning around a platform that may not be available. Check provider status and deprecation notices before committing.
- Ignoring maintenance. A tuned model must be re-evaluated or retrained when the base model changes.
- Treating them as rivals. Many production systems use retrieval for facts and tuning or prompting for behaviour.
Best practices
- Write evals first and keep them as a regression suite.
- Exhaust prompting, examples and structured outputs before training.
- Use RAG for knowledge that changes, needs citations or needs per-user access control.
- Consider fine-tuning only with a clear behavioural target and enough clean examples.
- Keep your application provider-agnostic: model name and endpoint in config, one service layer for model calls.
- Re-run evals on every model, prompt or index change.
Conclusion
RAG vs fine-tuning is a diagnosis question, not a popularity contest. Missing or changing knowledge points to retrieval; inconsistent behaviour on a well-defined task points to training; and unmeasured problems point to evals and better prompts. Because fine-tuning availability varies by provider, and OpenAI has announced it is winding down its platform, RAG and prompting are also the lower-risk place to start.
Your next step is concrete: write twenty real test cases with expected answers, run them against your current prompt, and sort the failures into "knowledge" and "behaviour". Then pick the approach that matches the larger bucket. For implementation, continue with What Is RAG in AI?, or see my AI integration services if you want an outside review.
References
- OpenAI: Model optimization guide
- OpenAI: Fine-tuning guide
- OpenAI: Deprecations
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., 2020)
- LoRA: Low-Rank Adaptation of Large Language Models (Hu et al., 2021)
Written by Shivam Thakur, a Software Engineer focused on web applications, SaaS platforms and modern software products. More at shivamthakur.me.

