Think of it as an escalation ladder ordered by cost and iteration speed:
Prompting (system prompts, few-shot examples, structured output settings): always the first resort.
RAG: reach for it when the problem is knowledge. Fresh, proprietary, or per-user data; the need for citations; content that changes daily.
Fine-tuning: reach for it when the problem is behavior. Consistent style or format, domain vocabulary, or reliable tool calling. Also making a small cheap model do what a big model needs a huge prompt to do.
Continued pretraining or training from scratch: only for deep domain or language adaptation with billions of tokens (say, a genomics or low-resource-language model).
In short: RAG fixes what the model knows; fine-tuning fixes how it behaves.
A reliable approach is insisting on an evaluation set first and exhausting the cheaper rung against that eval. Only move down the ladder when the current rung demonstrably fails. This is because each step down adds cost, latency of iteration, and operational burden.
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.