Prompting vs RAG vs Fine-Tuning

The three ways to adapt an LLM to your enterprise — what each changes, what each costs, when to use which, and how LoRA, PEFT and distillation fit in. With a decision tree.

On this page

Simple definition#

There are three main ways to make a general-purpose LLM useful for your business:

  • Prompting — change the instructions the model receives.
  • RAG (retrieval-augmented generation) — change the knowledge the model receives, by retrieving relevant documents into the prompt.
  • Fine-tuning — change the model’s weights by training it further on your examples.

A useful slogan: RAG for knowledge, fine-tuning for behaviour, prompting for everything first.

What each one changes#

Where each technique acts
flowchart LR
    subgraph Request["Each request"]
        P["Prompt<br/>instructions + examples"]
        R["Retrieved context<br/>RAG"]
    end
    subgraph Model["The model"]
        W["Weights<br/>fine-tuning"]
    end
    P --> W
    R --> W
    W --> O["Output"]
Prompting RAG Fine-tuning
Changes Instructions per request Knowledge per request Model weights, permanently
Best for Format, tone, task definition Facts, private and changing data, citations Consistent style, domain jargon, narrow tasks, smaller/cheaper model
Data needed None to a few examples Your documents Hundreds to thousands of high-quality examples
Freshness Instant Instant once re-indexed Requires retraining
Citations / traceability No Yes — show sources No
Access control per user No Yes — filter at retrieval No — everything trained in is visible to all users
Upfront cost Very low Medium (pipeline + vector DB) Medium to high (data prep, training, evaluation)
Per-request cost Grows with prompt size Adds retrieval + context tokens Can be lower: shorter prompts, smaller model
Risk Low Retrieval quality Catastrophic forgetting, data leakage, model lock-in

Decision tree#

Which technique should I use?
flowchart TD
    A["Start: define the task and success metrics<br/>build an evaluation set"] --> B["Try a strong model with a good prompt"]
    B --> C{"Good enough?"}
    C -->|"Yes"| Z["Ship it, keep evaluating"]
    C -->|"No"| D{"What is missing?"}
    D -->|"Knowledge: private, recent<br/>or needs citations"| E["Add RAG"]
    D -->|"Actions or live data"| F["Add tools / agents"]
    D -->|"Behaviour: format, style, domain<br/>language, consistency"| G["Better prompt + few-shot examples"]
    G --> H{"Still not enough, or too<br/>costly / slow at scale?"}
    H -->|"Yes"| I["Fine-tune<br/>often a smaller model"]
    H -->|"No"| Z
    E --> Z
    F --> Z
    I --> Z

They combine well. A common mature architecture is a fine-tuned smaller model + RAG: fine-tuning teaches the format and domain language, RAG supplies current facts.

Fine-tuning options explained#

For memory math, numerical formats, LoRA and QLoRA internals, multi-adapter serving and model merging, see fine-tuning in depth; for preparing the training data, see dataset engineering.

Type What happens Typical use
Full fine-tuning All weights updated Rare in enterprises; needs big GPUs and lots of data
PEFT — LoRA Freeze the model; train small “adapter” matrices added to some layers (often <1% of parameters) The default way to fine-tune open-weight models
QLoRA LoRA on a 4-bit quantized base model Fine-tune large models on a single GPU
Hosted fine-tuning Provider trains on your uploaded examples Simplest path for closed models that support it
Preference tuning (DPO) Train on “better vs worse” answer pairs Align tone and judgment
Continued pretraining More next-token training on a large domain corpus Very specialised language (legal, biomedical); expensive
Distillation Train a small model on a large model’s outputs Cut cost and latency for a high-volume, narrow task
LoRA in one picture
flowchart LR
    X["Input"] --> W["Frozen base weights W<br/>billions of parameters"]
    X --> A["Small matrix A"] --> B["Small matrix B"]
    W --> S(("+"))
    B --> S
    S --> Y["Output = W·x + B·A·x"]

Because adapters are small, you can keep one base model and swap adapters per task or tenant.

A fine-tuning project, step by step#

  1. Define the task and a held-out evaluation set before training.
  2. Collect and clean examples (inputs and ideal outputs); remove PII you are not allowed to train on.
  3. Establish a baseline: best prompt on the base model.
  4. Train (LoRA or hosted), tracking training and validation loss.
  5. Evaluate against the baseline on the held-out set, plus regression checks on general ability and safety.
  6. Deploy behind a flag; monitor; plan for retraining when the base model or data changes.

Common mistakes#

Review questions#

When would you choose RAG over fine-tuning? When the model needs knowledge that is private, changes often, must be cited, or must respect per-user permissions. RAG updates instantly by re-indexing and keeps sources traceable.

When is fine-tuning the right answer? When you need consistent behaviour that prompting cannot achieve reliably — a strict output style, domain terminology, a narrow classification task — or when you want a smaller, cheaper, faster model to match a larger model on one high-volume task.

What is LoRA? A parameter-efficient fine-tuning method: the base weights are frozen and small low-rank adapter matrices are trained and added to selected layers. It cuts training memory and cost dramatically, and adapters can be swapped per task.

Can you combine RAG and fine-tuning? Yes, and it is common: fine-tune for format and domain language, use RAG for current facts and citations. Some teams also fine-tune the embedding model or reranker to improve retrieval.

What is distillation and why would an enterprise use it? Training a small model to reproduce a large model’s outputs on a specific task. It reduces cost and latency for high-volume workloads while keeping most of the quality on that task.

Summary#

  • Prompting changes instructions, RAG changes knowledge, fine-tuning changes weights.
  • RAG for facts, freshness, citations and access control; fine-tuning for behaviour, consistency and cost at scale.
  • Always start with prompting and an evaluation set; fine-tune only with evidence.
  • LoRA/QLoRA make fine-tuning practical; distillation makes small models competitive on narrow tasks.

References#