I've watched three teams this year burn weeks fine-tuning models that just needed access to their own docs. One spent $12K on GPU time training a customer support model to stop hallucinating product features — features that were already documented in their help center. The fix was a retrieval pipeline that took an afternoon to set up.
The problem isn't that these teams were stupid. It's that "RAG vs. fine-tuning" is the wrong question, and most content online frames it that way because the authors are selling one or the other.
Here's the actual question: what kind of wrong is your LLM being?
The misdiagnosis that costs you weeks
When an LLM gives bad output, developers reach for one of two fixes:
- RAG — stuff relevant documents into the context window before generation
- Fine-tuning — retrain the model on examples of correct output
Both work. Neither works for everything. And confusing when to use which leads to the most expensive mistake in AI development: solving the right problem with the wrong tool.
Fine-tuning a model to know facts is like teaching someone a foreign language by having them memorize a dictionary. They'll learn the words, but they'll still make things up when you ask about something that wasn't in the dictionary. Fine-tuning changes how a model responds — its tone, reasoning style, output format. It does not reliably teach it what is true. A fine-tuned model will confidently produce wrong facts in exactly the style you trained it on.
RAG without good retrieval is like handing someone a library card and expecting them to write a PhD thesis. Access to information isn't the same as accessing the right information. If your retrieval returns noisy, irrelevant, or stale documents, the model will dutifully weave that garbage into a polished-sounding response.
Both techniques are tools. The goal they serve is grounding — anchoring every claim the model makes to a verifiable source.
Diagnose first, then pick your tool
Match the symptom to the fix:
"It says wrong facts about our product." Your model was trained on internet data, not your docs. It doesn't know that you renamed the API in v3, deprecated the old auth flow, or added a new pricing tier last month. This is a retrieval problem. Give it access to your documentation at query time — don't try to bake every fact into model weights.
"It responds in the wrong format." You want JSON with specific fields. Or you want the model to follow your company's support tone. Or you need it to reason through multi-step problems in a specific way. This is a behavior problem. Fine-tune on examples of the format and style you want.
"It hallucinates even when I give it context." Your retrieval is returning the wrong documents, too many documents, or documents with conflicting information. This is a retrieval quality problem. Fix your chunking, your ranking, your filtering — don't add more infrastructure.
"It doesn't follow complex instructions well." The model's instruction-following capability is the bottleneck, not its knowledge. Fine-tune for reasoning patterns, AND ground it in real data so it has something accurate to reason over.
Here's the pattern: if the problem is what the model knows → grounding. If the problem is how the model behaves → fine-tuning. Most production issues are knowledge problems.
Why fine-tuning is almost never the right first step
Fine-tuning has a seductive pitch: "make the model work exactly how you want." But the costs are real and often underestimated:
- Training data curation. You need hundreds to thousands of high-quality input/output examples. Someone has to write or curate those. That's weeks of work before you even start training.
- Compute costs. A single fine-tuning run on a capable model runs $500–$5,000 depending on the provider, dataset size, and model. Multiple iterations are normal.
- Model lock-in. When Anthropic ships Claude 4.7 or OpenAI releases GPT-5, your fine-tuned weights don't transfer. You retrain from scratch. Every model upgrade resets you to zero.
- The accuracy ceiling. After all that investment, the model still can't answer questions about facts not in the training data. Your product docs changed last Tuesday? The fine-tuned model doesn't know.
Compare that to a grounding pipeline: set up retrieval, point it at your docs, done. When the docs change, the model's answers change immediately. No retraining, no dataset curation, no compute budget.
Research backs this up. RAG-based grounding reduces hallucinations by 42–68% with no model modification at all. That's the kind of improvement that makes fine-tuning an optimization for later, not a starting point.
The right sequence: ground first, measure what's still wrong, fine-tune only if the remaining problems are behavioral.
What good grounding actually looks like
Bad grounding is "dump all the docs into the prompt." Good grounding is an architecture:
1. Right data, right time. Not all data is the same. Static docs (API references, guides, policies) change per release — index them once and search locally. Live data (prices, inventory, status) changes per minute — query it at request time. Mixing these up is how you end up quoting yesterday's prices with today's confidence.
2. Selective context. Don't send 20 documents to the model. Send the 3 most relevant ones. More context means more noise for the model to latch onto. The model doesn't need your entire knowledge base — it needs the specific answer to the specific question.
3. Source traceability. Every fact the model cites should trace back to a source document with a URL, version, and timestamp. If it can't cite a source, it should say so instead of guessing.
In practice, this means two layers. For documentation and reference material, use something that indexes docs into a local, searchable store — we built @neuledge/context for this, which packages docs as SQLite databases with sub-10ms full-text search, served as an MCP server:
{
"mcpServers": {
"context": {
"command": "npx",
"args": ["-y", "@neuledge/context"]
}
}
}
With the community registry, you don't even need to build packages yourself — 116+ libraries are pre-built and ready to install.
For live operational data, use a semantic data layer like @neuledge/graph that queries structured sources at request time and returns clean JSON the model can reason over.
The combination covers both failure modes: stale knowledge (retrieval from indexed docs) and stale data (live queries to operational systems).
When you actually need fine-tuning
Fine-tuning isn't useless — it's just not the first thing to reach for. There are specific situations where it's the right tool:
- Consistent output format. You need every response to follow a strict JSON schema, or match a specific tone, or produce a particular reasoning structure. Prompt engineering can get you 80% there, but fine-tuning locks it in.
- Domain reasoning patterns. Your use case requires the model to reason through problems in a domain-specific way — medical differential diagnosis, legal contract analysis, financial risk assessment. The model needs to think differently, not just know different facts.
- Efficiency at scale. You're making millions of API calls and a fine-tuned smaller model could replace a larger one with enough quality for your use case. This is a cost optimization, not an accuracy play.
The common thread: fine-tuning changes behavior, not knowledge. If you fine-tune AND ground, you get a model that reasons the way you want about facts that are actually true. That's the combination that production systems eventually land on — but grounding comes first because it solves the bigger, more common problem.
The bottom line
Stop asking "RAG or fine-tuning?" and start asking "what's actually wrong?"
Wrong facts → ground it. Wrong behavior → fine-tune it. Wrong everything → ground first, then fine-tune, because a model that behaves perfectly while confidently lying is worse than one that's awkwardly correct.
Get started: Install @neuledge/context for documentation grounding and @neuledge/graph for live data. Both are free, open source, and work with any MCP-compatible AI agent. The getting started guide walks through the full setup.
Top comments (0)