Summary: Start with prompting. Add RAG when answers depend on your own or fresh data. Fine-tune only for consistent style, format or a narrow task at scale, never as the main way to add knowledge.
The short answer
Start with prompting. Add RAG (retrieval-augmented generation) when the model needs facts it was never trained on, such as your company's documents, today's prices or a customer's order history. Consider fine-tuning only when you need a consistent style, format or behaviour that good prompts cannot give you, or when you want a smaller, cheaper model to do one narrow job very well.
Most real GenAI apps use prompting plus RAG. Fine-tuning is the last step, not the first.
What each one actually changes
| Prompting | RAG | Fine-tuning | |
|---|---|---|---|
| What changes | The instructions you send | The context you send (retrieved at question time) | The model's weights |
| Best for | Tasks the model already knows how to do | Answering from your own or fresh data, with sources | Fixed style/format, narrow repeated tasks |
| Adds new knowledge? | Only what fits in the prompt | Yes, from your document store | Poorly; it teaches behaviour more than facts |
| Updating data | Edit the prompt | Re-index the changed documents | Train again |
| Effort to start | Minutes | Days | Weeks, plus a labelled dataset |
Step 1: get as far as you can with prompting
A clear role, the exact output format, a few examples and a rule for what to do when unsure solve a surprising number of problems. Ask for structured output so your code can rely on the shape of the answer:
from pydantic import BaseModel
from langchain_openai import ChatOpenAI
class Ticket(BaseModel):
category: str # "billing" | "technical" | "other"
urgent: bool
summary: str
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
classifier = llm.with_structured_output(Ticket)
ticket = classifier.invoke(
"Classify this support message. Message: 'I was charged twice this month, please fix it today.'"
)
print(ticket.category, ticket.urgent) # billing TrueIf the model has the knowledge and only needs direction, stop here.
Step 2: add RAG when the facts live outside the model
A language model does not know your fee structure, your HR policy or last week's release notes. RAG fixes this by searching your documents for the most relevant chunks and putting them in the prompt, with an instruction to answer only from that context. You get answers that can cite their source, and updating the knowledge is as simple as re-indexing a file. Our RAG walkthrough builds this end to end.
Step 3: fine-tune for behaviour, not facts
Fine-tuning is worth the effort when:
- you need the same tone, structure or labels on thousands of outputs and prompting is still inconsistent;
- you want a small open model (for example one you run with Ollama) to match a larger model on one narrow task;
- your prompts have become very long and you want to bake those instructions in to cut cost and latency.
It is a poor way to add knowledge that changes, because every update means training again, and the model may still mix up or invent details. If you fine-tune, keep RAG for the facts.
A quick decision checklist
- Can a well-written prompt with 2–3 examples do it? Use prompting.
- Does the answer depend on private, large or frequently changing data? Add RAG.
- Is the remaining problem style, format or cost at high volume? Consider fine-tuning.
- Whatever you choose, build a small evaluation set first so you can measure whether a change helped.
Common mistakes
- Fine-tuning to "teach" a model your documents, then wondering why it invents details.
- Building RAG without checking retrieval quality: if the right chunk is not retrieved, the answer cannot be right.
- Skipping evaluation, so every change is judged by gut feeling.
FAQ
Is RAG better than fine-tuning?
They solve different problems. RAG gives a model access to your data at question time; fine-tuning changes how the model behaves. For knowledge that changes, RAG is usually the better choice.
Can I combine RAG and fine-tuning?
Yes. A common pattern is a fine-tuned model for tone and format, with RAG supplying the facts.
Do I need a GPU to fine-tune?
For hosted fine-tuning APIs, no. To fine-tune an open model yourself, you usually need a GPU, although small models and techniques such as LoRA reduce the requirement.