Prompting, RAG and fine-tuning
Three ways to make a general model useful for your organisation: instructions, retrieval over your documents, and training on your examples. When to use each.
A model off the shelf knows a general way of writing and a general slice of the world. Your organisation needs it to follow a procedure, use your documents, and produce a shape you can parse. There are three levers. Use them in this order, because each one is harder to operate than the one before it.
| Lever | Changes | Good at | Weak at |
|---|---|---|---|
| Prompting | The words you send with each request | Format, role, what to refuse, a few examples | Facts the model was never given |
| RAG | Which of your passages are pasted in | Private or changing facts, citations, access control | A style that has to hold with no passage in front of it |
| Fine-tuning | A copy of the weights | A stable format, vocabulary, or task the prompt cannot hold | Facts that change; anything you must cite |
They stack. A common production shape is a fine-tuned small model, or just a well-prompted one, answering from retrieved passages. The retrieval design is the RAG lab. This page is when to reach for which lever.
Prompting
The prompt is the system instruction, plus any examples, plus the user message. It is the cheapest experiment you can run, and it is versioned software. Store it in Git next to the application.
What belongs in the instruction:
- The job, in a sentence ("extract the fields below as JSON; do not add fields").
- The rule for missing information ("if the answer is not in the text, say you do not know").
- The shape of the output, with one example of that shape.
- What the model must not do ("do not give a credit decision").
What does not belong:
- A pasted policy manual. That is RAG, and it will blow the context window the day the manual grows.
- A plea to "be accurate". The instruction that works is the one that says where the facts come from and what to do when they are absent.
Few-shot examples in the prompt teach a format. Five to ten is plenty. They cost tokens on every call. If you need fifty examples, you are starting to describe a fine-tune.
Temperature stays low for extraction and higher only when you want variety and a person will edit the result. The mechanism is in What is an AI model.
Change the prompt, re-run the test set from Benchmarks, and keep the prompt that passed. A prompt that only works on the demo question is a bug.
RAG
Retrieval-augmented generation fetches passages from your own store and puts them in the prompt, then tells the model to answer from those passages and cite them. Use it when:
- The fact changes, or it is private: a circular, a product tariff, a maintenance manual, a customer's own file.
- A person must be able to open the source.
- Different users may see different documents. The filter belongs on the retrieval, before the model sees the text.
Do not fine-tune facts into the weights instead. Updating a fact would mean training again, and the model still could not point at the page.
RAG fails in ways a better model does not fix. If the right passage was not retrieved, the model is right to say it does not know, and the fix is parsing, chunking, hybrid search or the reranker. The RAG lab has the failure table. Build that path before you spend money on a larger model.
Fine-tuning
Fine-tuning continues training on your examples so the weights change. LoRA trains a small set of extra weights beside the frozen model. QLoRA does that while the base model is quantised, so it fits on fewer GPUs. Both produce an adapter you can attach at serving time. Full fine-tuning rewrites the whole file. You rarely need it.
Use fine-tuning when a prompt is not enough:
- A stable output format the model keeps breaking (a particular JSON, a telex, a form).
- Vocabulary and tone you can show by example and do not want to repeat in every prompt.
- A classification task with hundreds of labelled examples, where a prompt with ten examples has stalled.
Do not use it to memorize the policy wiki, to teach a language the base model has never seen (you will not have enough text, and you will not have an evaluation), or as the first response to a bad RAG answer.
What you need before you start:
- A few hundred to a few thousand labelled examples, in the real format, with the same judgement a careful person would make. Noisy labels become noisy weights.
- A held-out slice of the same test set, so you can show the adapter beats the base prompt.
- A base model whose licence allows training. Open-weight vs closed.
- A training stack. In this series that is OpenShift AI (training labs) or NeMo Customizer.
Keep the base model and the adapter as separate revisions. Rolling back the adapter must be possible without retraining. Re-run the set after every training run, including the items the adapter was not meant to change. Fine-tuning often improves the target task and worsens a neighbouring one.
A prompt you can diff
Put the instruction in a file. This is the shape that belongs in Git, not a paragraph buried in a notebook:
You answer questions about the handbook for staff.
Use only the passages in the context. Cite the passage id.
If the passages do not contain the answer, say you do not know.
Do not give a credit decision, a clinical instruction, or a legal opinion.
Reply in the language of the question.
A one-line change ("cite the passage id") is a commit you can revert when the test set gets worse. A prompt that lives in a console you cannot diff will drift, and the next failure will have no parent to compare to. The evaluation row records the prompt's git revision next to the model revision. Both moved, or you do not know which one did.
A decision you can defend
- Write the prompt. Evaluate.
- If the failures are missing facts from documents you have, build RAG. Evaluate retrieval and answers separately.
- If the failures are format or style, and examples exist, try a LoRA. Evaluate against the same set, including items that used to pass.
- If the failures are the task itself ("we need a number from a table of transactions"), leave this page and use classic ML.
Skipping to step 3 because training sounds more serious is how teams spend a month to reproduce a paragraph of instructions.
What's next
Use cases shows where these levers land in banking, government, defence, telecom and healthcare. Running models is how the chosen file is served. Guardrails on top of the prompt are the NeMo Guardrails lab.