Three ways to control an LLM’s output. Pick by data stability, cost, and desired behaviour.
+-------------------+ +-------------------+ +-----------------------+
| Prompt Engineering| | RAG | | Fine-Tuning |
| (zero cost) | | (compute at query)| | (compute once, |
| | | | | serve many) |
+-------------------+ +-------------------+ +-----------------------+
| | |
change input text add external docs update weights
fast, no infra fresh knowledge style / format / tone
| Need | Pattern |
|---|---|
| Quick behaviour tweak | Prompt engineering |
| Up-to-date private data | RAG |
| Domain-specific vocabulary / format consistently | Fine-tune |
| Lower cost at high QPS | Fine-tune (after RAG stabilises) |
| Hallucination control on facts | RAG + citation checks |
Prompt -> RAG -> Fine-tune. Always start at the cheapest, escalate only when metrics don’t improve.
Prompting is instructions to a contractor; RAG is handing them the manual; fine-tuning is teaching them a new trade.
Interview tip: “I’d start with prompt + RAG, measure, and escalate to fine-tuning only if the eval set still fails by >10 points.”