Adapter Tuning & PEFTthe "don't touch the walls" idea

Topic 22 of 90Module 3: Fine-Tuning Methods3 min read

The family name for everything in this lesson is PEFT: Parameter-Efficient Fine-Tuning. One shared insight powers the whole family:

The 112 GB bill comes from trainable parameters — each one drags gradients and optimizer states along. Frozen parameters cost only their own 2 bytes. So: freeze the base model entirely, and train a small number of new parameters bolted onto it.

Freeze 7B params (14 GB, sitting quietly) and train, say, 40M new ones (40M × 16 bytes ≈ 0.6 GB of training overhead). The 112 GB monster collapses to under 20 GB. The whole trick is choosing what small thing to train so that it can meaningfully steer a frozen giant.

Daily-life analogy: Renovating a rented apartment. You can't demolish walls (the base weights are frozen — you don't own them, and touching everything is what made it expensive). But you can add furniture, lamps, and removable fixtures — small additions that completely change how the space works, and can be swapped or removed without a trace.

The family members, in historical order:

  • Classic adapters (2019): insert tiny bottleneck layers between the transformer's existing layers — little "squeeze down to 64 dims, process, expand back" modules. Worked, but the inserted layers sit in the inference path forever: permanent extra latency. Furniture you can never remove from the hallway.
  • Prompt tuning / prefix tuning: don't add layers at all — learn a handful of virtual tokens (trainable embedding vectors, not real words) that get prepended to every input, steering the frozen model like a magic incantation. Elegant, ultra-cheap, but weaker steering power and it eats context window.
  • LoRA (2021): the one that won, so decisively that "fine-tuning" in open-source practice now means LoRA by default. Why it won is the next topic — the short version: all the steering power of adapters, with zero inference latency after a merge step.
  • Modern refinements you'll see in tooling: DoRA (splits weight updates into magnitude and direction components; often edges out LoRA at the same size), rsLoRA (a scaling fix for high ranks). Know the names; reach for them when squeezing the last few percent.

One product-level consequence worth planting now: because the base stays untouched and adapters are tiny files, you can keep one base model in memory and hot-swap many adapters — a support-tone adapter, a JSON-extraction adapter, a per-customer adapter — like outfits on one mannequin. Serving frameworks exploit this (multi-LoRA serving in vLLM and friends, Module 5), and it's the economic foundation of "a fine-tune per customer" products. Full fine-tuning could never afford that: each customer would need their own 14 GB copy.

Summary

PEFT freezes the base model and trains small attached modules, collapsing training memory by concentrating cost only on trainable parameters. The family evolved from bottleneck adapters through prompt tuning to LoRA, the modern default.

Mental model

The rented apartment — transform the space with removable additions; never touch the walls.

Mistakes to avoid

  • Thinking PEFT is a quality compromise you accept grudgingly. For typical fine-tuning jobs (style, format, task specialization — Module 2's sweet spots), LoRA matches full fine-tuning; the gap appears mainly when cramming lots of genuinely new material.
  • Confusing prompt tuning (trainable virtual tokens, a training method) with prompt engineering (writing better text, Module 7). Unrelated skills with confusable names.

Exercise

Back-of-envelope: for a 7B model, compute training memory for (a) full fine-tuning at 16 bytes/param, (b) frozen base at 2 bytes/param + 40M trainable at 16 bytes/param. Then answer: how many different 40M-param adapters could you store in the space of one full fine-tuned model copy? (~350 — that number is the multi-tenant business model.)