Sooner or later, every AI project hits the same question: the model doesn't do quite what we need. Do we fix the prompt, add retrieval, or fine-tune it?
It's also a favourite interview question for AI engineering roles, because the answer shows whether you understand what each technique can and can't change. Picking wrong is expensive: teams regularly spend weeks fine-tuning a model to "know" their documents, when retrieval would have solved it in an afternoon, and the reverse happens too.
Here's a practical way to decide.
The one-sentence version of each
- Prompt engineering changes the instructions the model receives.
- RAG (retrieval-augmented generation) changes the information the model can see at answer time.
- Fine-tuning changes the model's weights, and with them its default behaviour.
Keep that distinction in mind (instructions vs information vs behaviour) and most decisions become obvious.
Prompt engineering: always start here
Prompting means writing clearer instructions: a role, the task, constraints, a few worked examples ("few-shot"), and a required output format such as JSON.
It's the right tool when the model already can do the task but isn't doing it the way you want: wrong tone, missing steps, inconsistent format.
Strengths
- Fastest and cheapest to try: minutes, not days.
- Easy to version, review and roll back.
- Works with any model, including the newest ones.
Limits
- It can't add knowledge the model doesn't have, such as your company's policies, last week's news or your private data.
- Very long prompts add cost and latency to every request.
Rule of thumb: if you haven't tried a well-structured prompt with three or four good examples and a defined output format, you're not ready to consider anything else.
RAG: when the problem is knowledge
RAG retrieves relevant passages from your documents and puts them into the prompt, telling the model to answer from them and cite them. We build one from scratch in Build Your First RAG App in Python.
It's the right tool when answers depend on information that is private, specific to you, large, or changing: internal documentation, product catalogues, course materials, legal or policy documents, support tickets.
Strengths
- Knowledge can be updated instantly: change the documents, not the model.
- Answers can cite sources, so they're checkable. That matters in education, healthcare, law and finance.
- Reduces hallucination by grounding answers in real text.
- Access control is possible: retrieve only what this user is allowed to see.
Limits
- Quality depends on retrieval. If the right passage isn't found, the answer will be wrong or empty. You need to evaluate retrieval.
- More moving parts: chunking, embeddings, an index, reranking.
- Retrieved context adds tokens, and therefore cost and latency.
Fine-tuning: when the problem is behaviour
Fine-tuning continues training a pretrained model on your own examples (input → ideal output), so the desired behaviour becomes the model's default. Parameter-efficient methods like LoRA make this affordable by training a small set of extra weights instead of the whole model.
It's the right tool when you need consistent behaviour that's hard to describe in a prompt:
- A strict output style or format across thousands of requests.
- A specialised task with a clear input/output pattern, such as classification, extraction or a domain-specific writing style.
- Making a smaller, cheaper model perform like a larger one on one narrow task (often called distillation).
- Shorter prompts at scale, because the instructions are now "baked in".
Limits
- It's a poor way to add facts. The model may blend or misremember them, and you can't cite where an answer came from.
- Updating knowledge means retraining.
- You need hundreds to thousands of high-quality examples, plus an evaluation set to prove it helped.
- More operational work: training runs, model versions, hosting.
Side-by-side comparison
| Prompt engineering | RAG | Fine-tuning | |
|---|---|---|---|
| Changes | Instructions | Information at answer time | Model weights / default behaviour |
| Best for | Format, tone, reasoning steps | Private, large or changing knowledge | Consistent style, narrow tasks, smaller models |
| Adds new facts? | Only what fits in the prompt | Yes, with citations | Unreliably |
| Time to first result | Minutes | Hours to days | Days to weeks |
| Updating | Edit the prompt | Update documents | Retrain |
| Main risk | Brittle prompts | Bad retrieval | Overfitting, stale knowledge |
A decision guide you can actually use
Work through these questions in order:
- Can a better prompt fix it? Try clear instructions, examples and a structured output format. If yes, stop here.
- Is the model missing information? If answers depend on documents or data it hasn't seen, add RAG.
- Is the model behaving wrongly even with the right information and a good prompt? If the style, format or task performance is still inconsistent across many examples, consider fine-tuning.
- Is cost or latency the problem? Fine-tuning a smaller model on a narrow task can match a larger model at a fraction of the cost.
And they combine well. A common production pattern is a fine-tuned model (for consistent behaviour) answering from RAG context (for current, citable knowledge), all controlled by a carefully versioned prompt.
Three quick scenarios
A university course assistant that answers questions about the syllabus and lecture notes.
→ RAG. The knowledge is specific and changes every term, and students need citations they can check.
A tool that turns messy lab notes into a strict JSON format, 50,000 times a day.
→ Prompting first (structured output plus examples). If it's still inconsistent, or too slow and expensive at that volume, fine-tune a small model.
A support bot that must answer in your company's tone using the latest product docs.
→ RAG for the docs, plus prompting for tone. Add fine-tuning only if tone stays inconsistent after that.
How to answer this in an interview
A strong answer has three parts:
- Diagnose: "Is this a knowledge problem, a behaviour problem, or an instruction problem?"
- Escalate in cost order: "I'd start with prompting, add retrieval for missing knowledge, and fine-tune only for persistent behaviour issues or cost reasons."
- Measure: "I'd build an evaluation set first, so every change is compared against a baseline rather than judged by eye."
That third point is what separates engineers from demo-builders.
Frequently asked questions
Is RAG better than fine-tuning?
Neither is better in general; they solve different problems. RAG is better for giving a model access to specific, private or frequently changing knowledge with citations. Fine-tuning is better for changing a model's default behaviour, style or performance on a narrow task.
Can fine-tuning teach a model new facts?
Only unreliably. Fine-tuning can expose a model to new information, but the model may mix it up or hallucinate details and cannot cite sources. For factual knowledge that must be accurate and up to date, use retrieval.
What is LoRA fine-tuning?
LoRA (low-rank adaptation) is a parameter-efficient fine-tuning method that freezes the original model weights and trains small additional matrices. It greatly reduces the memory and compute needed, so fine-tuning becomes practical on a single GPU.
Should students learn prompt engineering, RAG or fine-tuning first?
Learn them in that order. Prompting teaches how models respond to instructions, RAG teaches retrieval and evaluation, and fine-tuning builds on both. RAG projects are also among the most practical to show in a portfolio.
Can I combine RAG and fine-tuning?
Yes, and many production systems do. A fine-tuned model provides consistent behaviour and format, while RAG supplies current, citable knowledge at answer time.