Handbooks  /  The Fine-Tuning Handbook
Handbook~15 min readIntermediate
Deep Dive

Fine-tuning,
and the low-rank shortcut.

Fine-tuning has a reputation for being expensive and mysterious — and often the wrong tool. Here's when it beats RAG and prompting, how LoRA made it cheap enough for a single GPU, and the part everyone underestimates: the data.

01

Three ways to adapt a model

Before reaching for fine-tuning, know your options. There are three ways to make an LLM do what you want, in increasing order of cost and commitment.

Prompt

Instructions + examples

Change behavior via the prompt and few-shot examples. Instant, free, reversible. Try this first, always.

RAG

Give it knowledge

Retrieve relevant docs at query time. Best for facts, private or changing data. The model stays fixed.

Fine-tune

Change the weights

Train on examples so the model itself changes. Best for behavior, style, format, and domain patterns.

→ The rule of thumb

RAG for what the model should know; fine-tuning for how it should behave. Reach for prompting first, RAG for knowledge, and fine-tuning only when you need consistent behavior prompting can't buy.

02

What fine-tuning actually changes

Fine-tuning continues training a pretrained model on your own examples, updating its weights so the behavior is baked in — no prompt or retrieval needed at inference. It's how you get a model to reliably adopt a style or persona, always produce a specific format (strict JSON, a house tone), follow a task pattern consistently, or specialize in a narrow domain's language.

The common mistake is fine-tuning to add knowledge. That works poorly: facts crammed into weights are lossy, hard to update, and easy to hallucinate around — exactly what RAG does better and more cheaply. Fine-tuning teaches how to respond, not what is true. If your problem is "the model doesn't know X," use RAG; if it's "the model doesn't respond the way I need," consider fine-tuning.

03

Full fine-tuning vs PEFT

Full fine-tuning updates all the model's weights. It's powerful but brutally expensive: you need enough GPU memory to hold the model, its gradients, and optimizer state — for a large model, many high-end GPUs — and you end up with a full copy of the model per task. For most teams that's a non-starter.

Parameter-efficient fine-tuning (PEFT) solves this by freezing the base model and training only a tiny number of new parameters. You get most of the quality for a fraction of the memory, compute, and storage — and you can keep the base model shared and swap small task-specific pieces. LoRA is the dominant PEFT method.

Full fine-tuningPEFT (LoRA)
Weights updatedAll of themSmall adapters (<1%)
GPU memoryVery high (model + grads + optimizer)Low — base frozen
Output per taskA full model copyA few MB of adapter weights
Catastrophic forgettingHigher riskLower (base untouched)
Best whenDeep domain shift, resources plentifulAlmost always — the default
04

How LoRA works

The idea that made fine-tuning cheap: don't change the weights — add a small, low-rank correction beside them.

LoRA (Low-Rank Adaptation) freezes the original weight matrices and, next to each, injects two small matrices whose product is a low-rank update. During training, only these little adapter matrices learn; the huge base weights never move. At inference, the adapter's contribution is added to the frozen weight, so the effective weight is W + BA — the original plus a small learned correction.

The insight is that the change a task requires has low intrinsic rank — it can be captured by matrices far smaller than the full weight. So instead of training millions of parameters, you train thousands, using a fraction of the memory. QLoRA pushes this further: load the frozen base model in 4-bit quantized precision to slash its memory footprint, then train LoRA adapters on top — letting you fine-tune a very large model on a single GPU that couldn't otherwise hold it, with little quality loss.

LoRA

  • Freeze base weights
  • Train tiny low-rank adapters
  • Effective weight = W + BA
  • Adapters are a few MB, swappable

QLoRA

  • Base loaded in 4-bit (quantized)
  • + LoRA adapters on top
  • Fine-tune huge models on one GPU
  • Minimal quality loss
05

The data is the job

Here's the part teams underestimate: fine-tuning is 90% data work. The method (LoRA and friends) is nearly commoditized; the differentiator is a clean, well-formatted, high-quality dataset of the exact behavior you want. Garbage in, garbage baked into the weights.

Format your data as the model expects (prompt–response pairs, chat turns, an instruction template). Prize quality over quantity — a few hundred to a few thousand excellent, consistent examples usually beat tens of thousands of noisy ones, because fine-tuning imitates whatever you show it, mistakes included. Ensure examples are consistent (contradictory examples teach nothing) and representative of real inputs. Hold out a clean test set from the start.

→ The uncomfortable truth

Most failed fine-tunes fail on data, not method. If the model learned the wrong thing, look at your examples — it faithfully imitated them. Curation, consistency, and quality beat any clever hyperparameter.

06

Catastrophic forgetting & overfitting

Fine-tuning has a dark side. Catastrophic forgetting: training hard on a narrow task can overwrite the model's general abilities — your specialized model gets great at the new thing and worse at everything else. And overfitting: with a small dataset, the model can memorize your examples rather than learn the pattern, producing brittle, parroting behavior.

Mitigations: PEFT methods like LoRA reduce forgetting by leaving the base weights frozen; keep learning rates modest and don't over-train (few epochs); optionally mix in general-purpose data so the model retains breadth; and — crucially — evaluate for regressions, not just improvements. A fine-tune that nails your task but tanks the model's reasoning or safety is a net loss you'll only catch if you measure the general abilities too.

07

Evaluate & decide

Judge a fine-tune on a held-out set the model never trained on — otherwise you're measuring memorization. Compare against the honest baselines: the base model with good prompting, and a RAG setup. Fine-tuning only wins if it clearly beats those on your real metric, and doesn't regress general ability. Measure both the target behavior and a broad capability check.

Then weigh the ongoing costs: fine-tuning adds a training and data pipeline, model/adapter versioning, and re-tuning as needs change. It's worth it when you need consistent behavior/format/style at scale, want to shrink prompts (bake the instructions in) for latency and cost, or must specialize a smaller cheaper model to match a bigger one on your task. It's the wrong tool for knowledge (use RAG), for one-offs (use prompting), or when you can't produce quality data.

Fine-tunefor behavior — consistent style, format, tone, task pattern, domain voice.
Fine-tunefor efficiency — bake in instructions to shrink prompts; specialize a small cheap model.
Don'tfor knowledge — facts belong in RAG, which is cheaper and updatable.
Don'twithout data — no quality dataset, no good fine-tune. Full stop.
Frequently asked

Quick answers

Fine-tune vs RAG vs prompting?

Prompt first (free, instant). RAG to give the model knowledge — facts, private or changing data. Fine-tune to change behavior, style, format, or domain patterns. RAG for what it should know; fine-tuning for how it should behave.

What is LoRA?

A parameter-efficient method that freezes the base model and trains small low-rank adapter matrices injected into its layers. Only a tiny fraction of parameters update, so it's far cheaper than full fine-tuning at comparable quality.

What is QLoRA?

LoRA plus quantization: load the frozen base in 4-bit precision to save memory, then train LoRA adapters on top — letting you fine-tune very large models on a single GPU with minimal quality loss.

What is catastrophic forgetting?

When fine-tuning on a narrow task degrades the model's general abilities, because new weight updates overwrite prior knowledge. LoRA (frozen base), modest training, mixed data, and regression evals all reduce it.

Finished this one? 0 / 29 Handbooks done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.