RAG vs Fine-tuning vs Prompt Engineering: Decision Framework

RAG, fine-tuning, and prompt engineering are not competing approaches — they solve different problems. RAG grounds an LLM in fresh, external facts. Fine-tuning changes behavior or style. Prompt engineering shapes intent within an already-capable model.

Last reviewed:

What we're comparing

  • Prompt engineering

    Shape output by carefully constructing the input prompt (roles, examples, structure).

  • RAG

    Fetch relevant documents at query time and inject them into the prompt as grounding context.

  • Fine-tuning

    Update model weights (full or LoRA) on task-specific data to change behavior or style.

Side-by-side

AttributePrompt engineeringRAGFine-tuning
FreshnessStatic per promptLive (index refresh cadence)Frozen at training time
Factual groundingWeakStrong (source-attributable)Weak (knowledge diffuses)
Latency overheadNoneAdds a retrieval step per queryNone at inference
Setup costLowMedium (index + retriever)High (data curation + compute)
Ongoing costPer-token onlyPer-token + retrieval infraTraining runs + custom-model hosting or per-token rates (provider-dependent)
Best forTask shaping, few-shot behaviorGrounded QA, freshness, citationsStyle/format, restricted vocab, low-resource domains
Anti-patternTrying to encode all knowledge in promptFine-tuning what a retriever should surfaceFine-tuning to add facts (they will drift)

When to use which

  • Use Prompt engineering

    Start here. It handles many real use cases on its own and is the cheapest approach to iterate on.

  • Use RAG

    You need current, source-attributable answers from a corpus larger than the context window.

  • Use Fine-tuning

    You need consistent output structure/style, or domain-specific behavior that prompting cannot reliably produce.

FAQs

  • Can I combine them?

    Yes. Many production systems do — prompting for task shape, RAG for facts, and fine-tuning only where style or format cannot be reached by prompting.

  • Is fine-tuning obsolete now that context windows are huge?

    No, but its niche is narrower. A fine-tuned smaller model can be cheaper and faster than prompting a larger one at high volume. Hosted options are shifting: OpenAI is winding down its fine-tuning platform (closed to new users), while Amazon Bedrock and Google Cloud still offer hosted fine-tuning, and open-weights models can be tuned anywhere. Long context is a substitute for RAG in narrow cases, not a replacement.

Get updates when this comparison changes

We re-review comparisons as tools and pricing move. One practical GenAI note per month, plus alerts on material changes. Unsubscribe anytime.

Related comparisons

Framework dimensions

Next steps