Originally published on DevToolHub.
RAG vs fine-tuning comes down to one question: what is wrong with the model's answers? If it lacks facts, such as your docs or last week's changes, use RAG. If it knows enough but answers in the wrong format or tone, fine-tune. I tested the first case locally: a 3B model got 0 of 10 questions right about an invented runbook, then 10 of 10 once the right passages were in the prompt.
One 2026 detail changes the usual advice. OpenAI's own docs say its fine-tuning platform is winding down. It is closed to new users, and existing users can create training jobs only until January 6, 2027. On hosted models, retrieval is now the default path.
In this guide:
- Decide between RAG and fine-tuning from the symptom, not the hype
- See what a small local test showed, including a retrieval miss
- Check what is still available for fine-tuning in 2026
- Pick an approach with four plain rules
What does RAG fix, and what does fine-tuning fix?
RAG changes what the model sees at question time. A retriever finds relevant passages and the pipeline adds them to the prompt. Fine-tuning changes the model's weights with training examples, so it behaves differently on every request. RAG fixes missing or stale knowledge. Fine-tuning fixes consistent behavior: format, tone, labels.
| Symptom | Pick | Why |
|---|---|---|
| Model invents answers about your private docs | RAG | The facts must be in the prompt |
| Facts change weekly | RAG | Update the index, not the model |
| Output must follow one strict format | Fine-tuning | Examples teach the shape |
| Classification with fixed labels | Fine-tuning | Many examples beat a long prompt |
| Both missing facts and strict format | Both | RAG for facts, tuning for shape |
If you need the basics first, read what RAG is and what an LLM is.
RAG vs fine-tuning: what did I test locally?
I tested the RAG half. The model was llama3.2 (3B) on Ollama 0.40.16, run with temperature 0 and a fixed seed. The knowledge was 12 short invented documents about a fictional deploy platform: a rollback window, a staging cluster name, a secrets rotation job, and so on. I asked 10 questions and counted an answer as correct if it contained the expected string.
| Mode | Correct |
|---|---|
| No context | 0 of 10 |
| Top 3 retrieved passages in the prompt | 10 of 10 |
| All 12 documents in the prompt | 10 of 10 |
Without context the model did not just say "I don't know". Instead, it made things up. It named Alembic as the tool that runs schema migrations, answered "HOLIDAY" for the freeze code word, and called the build dashboard the "Build Health Index (BHI)". For secrets rotation it said secrets "don't actually rotate".
The retriever was plain keyword scoring, not embeddings. So the whole test stays small enough to read:
def score(q,d):
dt=tok(d); c=collections.Counter(dt); s=0
for t in set(tok(q)):
if t in c: s+=(1+math.log(c[t]))*math.log(1+len(DOCS)/df[t])
return s
def retrieve(q,k=3):
return [d for _,d in sorted(DOCS,key=lambda x:-score(q,x[1]))[:k]]
The prompt was Answer in one short sentence using only this context., then the passages, then the question. That is the whole pipeline.
Tip: With 12 short documents, pasting everything worked as well as retrieval. If your knowledge fits in the context window, skip the retriever and paste it.
Where does RAG fail: retrieval or generation?
In RAG, the failure moves from the model to the retriever. For example, I reworded four questions so they shared fewer words with the documents. Three still pulled the right passage and got correct answers. One did not.
Then I asked, "When can nobody push to prod over the winter break?" The retriever returned the wrong passages, and the model answered that nobody can push "when the secrets rotation job vault-spin is running". That sentence was fluent, confident and wrong. The correct passage, the December 18 to January 4 freeze, was never in the prompt. That is why it failed.
An embedding model would likely catch that paraphrase, but embeddings miss too, and I did not test them. Either way, the takeaway holds: log which passages were retrieved for every question, and grade retrieval separately from the final answer.
Warning: A RAG answer that cites the wrong passage looks the same as a correct one. Without retrieval logs you cannot tell them apart.
When is fine-tuning the better pick in RAG vs fine-tuning?
Fine-tuning wins when the problem is behavior, because examples teach a pattern. OpenAI's supervised fine-tuning guide lists four best-fit tasks: classification, nuanced translation, generating content in a specific format, and correcting instruction-following failures. It also says to start with 50 well-crafted examples, with a minimum of 10.
Its model optimization guide adds a cost angle. Fine-tuning lets you use more examples than fit in a prompt and use shorter prompts, which lowers token cost and latency. Before you train, try a few correct examples inside the prompt, as the same guide suggests.
However, fine-tuning is the weaker tool for new facts. The paper Fine-Tuning or Retrieval? compared both for knowledge injection. Its authors report that RAG outperformed unsupervised fine-tuning for existing knowledge and for entirely new knowledge. But that study covers one training style, so treat it as a strong hint, not a law. I did not reproduce it.
On open-weight models, fine-tuning is cheaper than it used to be, because only a few weights train. Hugging Face's PEFT library trains only a small number of extra parameters, which its docs say brings large models within reach of consumer hardware. The train-your-own-local-model walkthrough covers the practical side.
Note: As of November 20, 2026, OpenAI's fine-tuning docs say the platform is closed to new users and that existing users can create training jobs until January 6, 2027. Fine-tuned models stay available for inference until their base models are deprecated. The supported models listed on the page are the
gpt-4.1family. Check the page again before you plan around it.
How should you choose between RAG vs fine-tuning?
Follow these four rules in order. Then stop at the first one that matches.
- The knowledge is small. If it fits in the context window, paste it into the prompt. No retriever, no training.
- The knowledge is private or changes often. Use RAG. Updating an index takes minutes, but retraining takes a pipeline.
- The answers are right but the shape is wrong. Add few-shot examples to the prompt first. Fine-tune only if the examples stop fitting or the prompt gets too long and costly.
- You need both. Use RAG for facts and a fine-tuned model for format. Build RAG first, since you can measure it in an afternoon.
Also, agents that call tools sit on top of either choice. See AI agents explained for where retrieval fits in an agent loop.
What I did not test
I did not run a fine-tune, so the fine-tuning claims above come from OpenAI's docs, the Hugging Face docs and one paper, not from my own training run. I also did not use embeddings or a vector database, I tested one small model with 12 short documents, and I graded by substring match. A larger corpus, a bigger model or a hosted API could change the numbers. Because the runbook is invented, no model could have seen it in training. That is why the no-context score was zero.
Frequently Asked Questions
Q: Is RAG better than fine-tuning?
A: For adding facts, usually yes. RAG keeps knowledge outside the model, so you can update it without training. One paper found RAG beat unsupervised fine-tuning for both existing and new knowledge. For output format and tone, fine-tuning is the better tool.
Q: Can you use RAG and fine-tuning together?
A: Yes. Use RAG to supply current facts and a fine-tuned model to answer in a fixed format. Build the RAG part first, since it is quicker to test and change.
Q: Does fine-tuning teach a model new facts?
A: Not reliably. OpenAI's guide lists formats, classification and instruction-following fixes as best uses, and the comparison paper found retrieval stronger for new knowledge. Use fine-tuning for behavior and RAG for facts.
Q: Can I still fine-tune an OpenAI model?
A: Only on an existing account, and only for a limited time. As of November 20, 2026, OpenAI's docs say the platform is closed to new users and that eligible existing customers can create training jobs until January 6, 2027.
Quick Summary:
- Missing facts call for RAG; wrong format or tone calls for fine-tuning
- A local 3B model scored 0 of 10 without context and 10 of 10 with retrieved passages
- With no context, the model invented tool names and code words instead of admitting it did not know
- RAG fails at retrieval: one reworded question pulled the wrong passage and got a confident wrong answer
- If your knowledge fits in the context window, paste it and skip both
- OpenAI's fine-tuning platform is closed to new users, with training jobs allowed for existing users until January 6, 2027
For the RAG vs fine-tuning choice, start with RAG, log your retrieved passages, and fine-tune only when the output shape is the problem.
Top comments (0)