I'm Gopi Gugan, a software engineer building AI features with FastAPI, Postgres/pgvector, and React/TypeScript. Lately every team I talk to asks the same question: should we fine-tune a model, or build RAG? I have shipped RAG in production, and I have fine-tuned small models for narrow tasks. Here is how I actually decide, without the hype. You can find more of my writing at https://www.gopigugan.ca/.
Start with the problem, not the technique
Fine-tuning and RAG solve different problems, and mixing them up is how projects burn budget.
- RAG is for knowledge that changes: your docs, your product data, your support tickets. The model looks it up at query time.
- Fine-tuning is for behaviour that stays put: a specific tone, a strict output format, a narrow classification task.
- Neither fixes a model that is too small for the job, or data that is wrong. Garbage in, garbage out, with a bigger invoice.
My rule of thumb: if the answer lives in a document, reach for RAG first. If the answer is "do it the way we always do it," fine-tuning might be the tool.
What fine-tuning actually costs you
Fine-tuning sounds simple — upload examples, get a smarter model. In practice it adds a pipeline you now own.
- Data prep is the real work. You need hundreds to thousands of clean, consistent examples. Curating them takes longer than the training run.
- Evaluation becomes mandatory. A fine-tuned model can quietly get worse at things it used to do well. You need a test set before you start, not after.
- You re-tune when things change. New product rules, new tone guidelines, new edge cases — each one means another training run and another evaluation cycle.
- It doesn't add knowledge. A fine-tuned model still hallucinates facts it never saw. If your data changes weekly, fine-tuning is the wrong lever.
I fine-tune when the task is narrow and stable — for example, classifying support tickets into our exact categories, or forcing a model to return a strict JSON shape every single time. For those jobs it is genuinely good.
What RAG actually costs you
RAG gets recommended for everything now, but it has its own bill to pay.
- Retrieval quality is the product. If your chunks are bad or your embeddings miss the right document, the model answers confidently from the wrong source. I spend more time on chunking and retrieval testing than on the prompt.
- It is a system, not a prompt. You own an embedding pipeline, a vector store (I use pgvector), re-ranking, and cache invalidation when docs change.
- Latency and cost scale with context. Every retrieved chunk costs tokens and milliseconds. Stuffing ten chunks into every prompt is an easy way to make a feature slow and expensive.
- It still needs guardrails. RAG reduces hallucinations; it does not remove them. The model can still misread a retrieved passage, so I keep a human in the loop for anything that touches money or customer commitments.
My decision checklist
Before I pick one, I run through this list:
- Does the knowledge change often? Yes → RAG.
- Is the job a fixed format or tone, with stable rules? Yes → fine-tune.
- Do I have at least a few hundred labelled examples? No → don't fine-tune yet.
- Can I write a test set with right and wrong answers? No → fix that first, whichever path I take.
- Do I need the model to cite a source? Yes → RAG, because fine-tuning can't cite what it memorised.
Often the honest answer is both: RAG for the knowledge, a lightly fine-tuned model for the format. But I start with one, measure it, and only add the second when the first one is measurably falling short.
A small experiment you can run this week
You don't need a training budget to learn the difference. Take one task — say, answering questions from your own docs — and try both paths on a tiny scale.
# RAG path: retrieve first, then answer from the retrieved context results = pgvector_search("how do I reset my API key?", top_k=3) context = "\n".join(r.text for r in results) answer = llm.complete(f"Answer using only this context:\n{context}\n\nQuestion: how do I reset my API key?") # Fine-tuning path: the same question, no context at all answer = fine_tuned_model.complete("how do I reset my API key?") Then update one document and ask again. The RAG answer changes the moment your index updates. The fine-tuned answer doesn't — and that single observation tells you more than any blog post can about which tool fits your problem.
The honest summary
Fine-tuning changes how a model behaves. RAG changes what a model knows. Most production features I build need the second one first, and only reach for the first when the behaviour itself is the problem. Start with RAG, measure retrieval quality honestly, and fine-tune only when you can name the exact behaviour you want to change — and prove it changed.
