PEFT

Parameter-efficient fine-tuning — adapt large models on a single GPU by freezing the base weights and training a small delta.

intermediate generative llmfine-tuningquantization
peftloraqloralow-rank-adaptationquantizationoptimisation

Author @Marcus-Wee Updated 2026-07-09

Overview

Fine-tuning adjusts the parameters θ\theta of a pretrained network to minimise a task loss L\mathcal{L}. For a model with ∣θ∣=d|\theta| = d parameters, full fine-tuning optimises all dd of them via Gradient Descent. PEFT (Parameter-Efficient Fine-Tuning) instead freezes θ\theta and learns a much smaller set ϕ\phi with ∣ϕ∣≪d|\phi| \ll d, so the update is θ↦θ+Δθ(ϕ)\theta \mapsto \theta + \Delta\theta(\phi). This collapses the memory cost of training a 7B model from ~112GB to a few GB.

Why It Works

A pretrained model already encodes language, reasoning, and world knowledge. Specialising it to a task is a small adjustment, not a rewrite — empirically the useful update Δθ\Delta\theta lives in a low-dimensional subspace. So you don’t need to move all dd parameters; a tiny trainable set ϕ\phi can express the adjustment, often matching full fine-tuning quality while training under 1% of the weights.

Memory Savings

The weights are the small cost; the optimiser state around them dominates. With Adam in full precision, each trainable scalar carries the weight, its gradient, and two moment estimates. Total training memory MM (in bytes) scales as

M≈4d⏟fp32 weights+(4+4+4) dtrain⏟grad+m+v+MactM \approx \underbrace{4d}_{\text{fp32 weights}} + \underbrace{(4 + 4 + 4)\,d_{\text{train}}}_{\text{grad} + m + v} + M_{\text{act}}

The key term is dtraind_{\text{train}}, the number of trainable parameters. A frozen weight contributes to neither the gradient nor the moments — only its forward-pass storage.

PEFT saves incredible amounts of memory by driving dtrain→ϵdd_{\text{train}} \to \epsilon d, where oftentimes ϵ<0.01\epsilon < 0.01, which practically zeroes the dominant 12 dtrain12\,d_{\text{train}} term and the per-step optimiser cost.

The PEFT Family

MethodMechanismdtraind_{\text{train}}
LoRAadditive low-rank BA\mathbf{B}\mathbf{A}r(m+n)r(m+n)
Prefix/Prompt tuninglearn virtual tokens prepended to input; weights frozen∼\sim embeddings only
Adapters (2019)bottleneck layers inserted between frozen blockssmall, not mergeable
IA³learned vectors rescaling activations h⊙l\mathbf{h}\odot\mathbf{l}one vector per target
DoRA (2024)decompose W=mV∥V∥\mathbf{W}=m\frac{\mathbf{V}}{\lVert\mathbf{V}\rVert}, LoRA the directionLoRA + magnitude

All share the PEFT invariant: freeze the base, learn a small Δθ\Delta\theta. They differ only in the parametrisation of that delta.

LoRA, in Brief

LoRA (Low-Rank Adaptation) is the dominant PEFT method. It freezes each weight matrix W0\mathbf{W}_0 and learns a low-rank update ΔW=BA\Delta\mathbf{W} = \mathbf{B}\mathbf{A} alongside it, where B,A\mathbf{B}, \mathbf{A} hold a fraction of the parameters. The resulting adapter is tiny (megabytes), swappable across tasks on one base model, and mergeable back into W0\mathbf{W}_0 for zero added inference cost. The full low-rank derivation is a future post.

QLoRA, in Brief

QLoRA (Quantized LoRA) goes further: store the frozen base in 4-bit, train fp16 LoRA adapters on top. Quantization shrinks the base ~8×; LoRA keeps the optimiser overhead near zero. Together they put 65B-scale fine-tuning on a single GPU — trading some speed (on-the-fly dequantization) for the ability to run at all. NF4, double quantization, and paged optimizers are a future post.

Choosing a Method

SituationUse
fp16 base fits the GPULoRA — no dequant tax
base too big for 16-bitQLoRA — 4-bit makes it fit at all
max quality, spare computeDoRA
many cheap swappable tasksprompt/prefix tuning

2026 default: LoRA if it fits, QLoRA if it doesn’t. Start r=16, α=32r=16,\ \alpha=32, target attention + MLP projections, escalate only if the task demands it.

Limitations

PEFT adapts the affine projections inside Transformers and the Neural Networks beneath them, training the small delta with Gradient Descent. The low-rank factorisation behind LoRA echoes the surrogate-modelling intuition of Linear Regression and the implicit feature maps of Support Vector Machines.

Learning Path

What should I learn before PEFT?

Start with neural-networks, transformers, gradient-descent before studying PEFT.

How does PEFT connect to other AI topics?

PEFT belongs to Generative and connects to llm, fine-tuning, quantization, peft, lora, qlora, low-rank-adaptation, quantization, optimisation.

Further Reading

  1. LoRA: Low-Rank Adaptation of Large Language Models — Hu et al. (2021)
  2. QLoRA: Efficient Finetuning of Quantized LLMs — Dettmers et al. (2023)
  3. DoRA: Weight-Decomposed Low-Rank Adaptation — Liu et al. (2024)
  4. Parameter-Efficient Transfer Learning for NLP — Houlsby et al. (2019)
  5. Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learning (IA³) — Liu et al. (2022)