Ankit KanojiyaIntermediate

Evergreen guide by Ankit Kanojiya · Intermediate · AI / ML

Prompting vs RAG vs Fine-Tuning: How to Choose

A decision guide for the three main ways to adapt an LLM to your needs, with the trade-offs in cost, freshness, and effort that decide between them.

When an off-the-shelf model does not do quite what you want, there are three levers to pull: better prompting, retrieval-augmented generation (RAG), and fine-tuning. They are often framed as competitors, but they solve different problems and are frequently combined. Choosing well saves weeks of effort and avoids paying for a heavy solution when a light one would do.

What each approach actually changes

  • Prompting changes the instructions you send. The model weights are untouched. You are steering behavior at request time.
  • RAG changes the information in the prompt by retrieving relevant documents at query time. It adds knowledge without changing the model.
  • Fine-tuning changes the model weights by training on example input-output pairs. It bakes in behavior, format, or style.

A useful mental model: prompting and RAG act at inference time and are easy to change; fine-tuning acts at training time and is slower to change but can shift the model's default behavior more deeply.

Match the approach to the problem

Different problems point to different tools.

  • Need the model to follow instructions or produce a format: start with prompting, including few-shot examples.
  • Need answers grounded in specific, private, or frequently changing facts: use RAG.
  • Need a consistent style, tone, or structure that is hard to get with prompting, or need to reduce latency and token cost by removing long instructions: consider fine-tuning.
  • Need a narrow, high-volume task where a smaller, cheaper model could work if specialized: fine-tuning a small model can beat prompting a large one on cost.

A blunt but effective heuristic: if the problem is the model does not know something, reach for RAG; if the problem is the model does not behave a certain way, reach for prompting first and fine-tuning if that is not enough.

Trade-offs at a glance

| Dimension | Prompting | RAG | Fine-tuning | | --- | --- | --- | --- | | Setup effort | Low | Medium | High | | Keeps facts current | Manual | Easy, update the index | Hard, requires retraining | | Per-request token cost | Higher if long | Higher, context added | Lower, shorter prompts | | Changes model knowledge | No | Adds at query time | Partially, risk of drift | | Best for | Behavior, format | Grounded answers | Style, specialization |

Cost and maintenance realities

Fine-tuning has costs beyond the training run. You need a curated dataset of high-quality examples, a process to evaluate the result, and a plan to retrain when requirements change. A fine-tuned model is also tied to a base version; when the provider releases a better base model, your tuned variant does not automatically benefit.

RAG shifts cost to infrastructure: a vector store, an indexing pipeline, and larger prompts because retrieved context consumes tokens on every call. Its big advantage is freshness, since updating knowledge means updating documents, not retraining.

Prompting is the cheapest to start and change but can become expensive per request if prompts grow long, and it cannot add knowledge the model never had.

A practical order of operations

Most teams get the best results by escalating only as needed:

  1. Start with a clear, well-structured prompt and a few examples.
  2. If the model lacks facts, add RAG to ground it.
  3. If behavior or format is still inconsistent, or prompts have grown long and costly, fine-tune on examples collected from the earlier stages.

This order is deliberate. The logs from prompting and RAG become the training data for fine-tuning, so earlier stages make later ones cheaper and more accurate.

They combine

The approaches are not mutually exclusive, and strong systems often use all three. A fine-tuned model can reliably produce a required JSON shape, RAG can feed it current facts, and a concise prompt can set the task. Fine-tuning for format plus RAG for knowledge is a particularly common pairing, because each handles the job the other is weak at.

The takeaway

Reach for the lightest tool that solves the actual problem. Ask whether the gap is knowledge or behavior, how often the underlying information changes, and how much per-request cost matters at your volume. Those three questions resolve most decisions, and when one tool is not enough, layering them is usually better than forcing a single approach to do everything.