Skip to Content

Three ways to control an LLM’s output. Pick by data stability, cost, and desired behaviour.

Data Flow

+-------------------+   +-------------------+   +-----------------------+
| 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

Decision matrix

NeedPattern
Quick behaviour tweakPrompt engineering
Up-to-date private dataRAG
Domain-specific vocabulary / format consistentlyFine-tune
Lower cost at high QPSFine-tune (after RAG stabilises)
Hallucination control on factsRAG + citation checks

Rule of thumb

Prompt -> RAG -> Fine-tune. Always start at the cheapest, escalate only when metrics don’t improve.

Pitfalls

Analogy

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.”

Advertisement