Topic: llm-training-and-post-training · deep dive

Parameter-Efficient Fine-Tuning (PEFT)

Train a few new numbers beside a frozen model: what each method trains, LoRA's low-rank update on a real matrix, the memory of full fine-tuning against LoRA and QLoRA, when LoRA matches full fine-tuning, DoRA, and serving many adapters on one base. Sources linked inline; data as of October 2026. Reading: 26 min, plus 2 in closed details.

The idea in one screen

PEFT freezes the pretrained weights and trains a small set of new numbers beside them. LoRA, the default, learns each weight matrix's change as the product of two thin matrices, ΔW = (α/r)BA: training holds about 2 bytes per frozen parameter instead of 16, each task ships as megabytes instead of a copy of the model, and the change folds back into the weights for serving.

What follows from freezing the base, with the numbers:

  • Memory. A frozen weight needs no gradient and no optimiser state. Llama 3 8B needs about 128 GB of training state for full fine-tuning, 16.7 GB for LoRA at rank 16 and 6.4 GB for QLoRA, before activations (Memory and QLoRA has the calculator).
  • Cheap per-task copies. A full fine-tune of GPT-3 175B is a 350 GB checkpoint; its LoRA adapter (rank 4 on the query and value matrices) is about 35 MB (LoRA §4.2; derived 18.9M numbers × 2 bytes = 37.7 MB, 36 MiB). Adapters swap in seconds, and many can be served at once against one base (Serving many adapters).
  • Less forgetting, and less learning. The base never moves and a low-rank change can move the model only so far: LoRA "learns less and forgets less" than full fine-tuning (Biderman et al., in Against full fine-tuning). For the instruction and preference data of ordinary post-training the capacity is rarely binding; for billions of tokens of new domain text it is.

You need: what a matrix's rank and its singular value decomposition (SVD) are (Linear algebra for ML: vectors to SVD, rank, conditioning, low-rank methods); where Adam's 16 bytes per parameter come from (ZeRO); the post-training stages a LoRA usually runs (Alignment).

adapter
the small set of trained numbers for one task, saved and loaded apart from the base
rank r
LoRA's inner width: ΔW can point in at most r directions
α (alpha)
a fixed scale; the update is multiplied by α/r (or α/√r in rsLoRA)
target modules
the matrices that get an adapter (q, k, v, o, gate, up, down)
merge
adding (α/r)BA into W0 so the model runs at the base's shape and speed
NF4
QLoRA's 4-bit storage code for the frozen base
multi-LoRA
serving many adapters against one copy of the base in one batch

Fig. 1 · One query matrix of Llama 3 8B, to scale: full fine-tuning trains all 16,777,216 numbers; LoRA at rank 16 trains 131,072 (0.78%) beside the frozen matrix

Shapes from the config (q_proj is 4,096 × 4,096). derived training state: 16 bytes per trained number (bf16 weight and gradient, fp32 master copy and two Adam moments, the ZeRO accounting) and 2 bytes per frozen one, so 268 MB against 35.7 MB for this matrix at rank 16. B and A are drawn at their true thickness, at least 1.5 px.

The methods, and what each one trains

Every method answers one question differently: which numbers are trained, and where do they touch the frozen network? The diagram places each on one decoder block; the table below counts them on Llama 3 8B (8.03B parameters).

Why LoRA won. Adapters sit in series, so every token runs extra sequential layers: the LoRA paper measured a forward pass of GPT-2 medium 20.7% to 30.3% slower at batch size 1 and 128 tokens, shrinking to 2.2% to 3.0% at batch 32 and 512 tokens (LoRA Table 1). Soft prompts spend context positions, train less stably and score lower: on LLaMA-7B commonsense reasoning, prefix tuning averaged 64.6 against LoRA's 74.7 (DoRA Table 1, baselines from LLM-Adapters). LoRA sits in parallel and merges away, so it costs nothing at serving time; its descendants each change one thing (QLoRA the base's storage, DoRA magnitude against direction, LoRA-FA and VeRA what is trained, rsLoRA and LoRA+ the scale and learning rates).

Where each method touches one decoder block: in series (adds work per token), in parallel (merges away), or at the input

Input tokensembeddings
prompt tuning: n virtual tokens prepended
↓
AttentionWq Wk Wv Wo
LoRA, DoRA, VeRA, LoRA-FA: BA beside each matrix, in parallelprefix tuning: n keys and values per layer(IA)³: scales keys and values
↓
Adapterbottleneck MLP, in series
adapters (Houlsby): down to m, up to d
↓
MLPWgate Wup Wdown
LoRA family: beside each matrix(IA)³: scales the hidden units
↓
Adapterin series
adapters (Houlsby)
↓ × 32 blocks
Output head
head-only tuning: a new head, backbone frozen

Grey boxes are frozen; dashed boxes are new layers in the token's path. Methods in the highlight colour add nothing to the path once merged.

MethodWhat is trainedTrainable on Llama 3 8BExtra cost when serving
Full fine-tuningEvery weight8.03B (100%)None, but one full copy per task
Head onlyA new output layertask-sizedNone
Adapters (Houlsby 2019)Two bottleneck MLPs per block33.8M at m = 64Extra sequential layers on every token
Prompt tuningn "virtual token" embeddings81,920 at n = 20n more tokens of context
Prefix tuning, P-tuning v2n keys and values per layer1.31M at n = 20n more cached positions
(IA)³One scaling vector each for keys, values and the MLP hidden units0.52MNone once folded into the weights
LoRATwo thin matrices B, A per adapted matrix41.9M at r = 16, all 7 matricesNone once merged
LoRA-FALoRA with A frozen at its random start; only B trains22.0M at r = 16, allNone once merged
VeRATwo scaling vectors per matrix; one random B, A pair shared by all layers and frozen1.61M at r = 1,024, all 7None once merged
QLoRALoRA, on a base stored in 4-bit NF4as LoRAMerge needs care (see Memory and QLoRA)
DoRALoRA for each weight's direction plus one magnitude per output unit43.3M at r = 16, allNone once merged

Counts from the config.json by the page's formulas, identical to the counts the PEFT library itself reports; the Trainable parameters tab recomputes them for any model, rank and target set. (IA)³ scales keys, values and the input of the MLP's down projection, as PEFT does for Llama; VeRA's rank 1,024 on every linear layer is the VeRA paper's instruction-tuning setup (VeRA §4.3). Adapter count from the LoRA paper's formula 2L(2dm + m + d) (LoRA §5.1).

The families one by one, with their papers (optional)
  1. Head-only tuning: freeze the backbone, train a task head. The classic transfer-learning baseline; too weak to change how a generative model behaves, because nothing inside the network moves.
  2. Adapters (Houlsby et al. 2019): small bottleneck MLPs inserted into each block. On GLUE they came within 0.4% of full fine-tuning while adding 3.6% parameters per task.
  3. Soft prompts: learn embeddings instead of words. Prompt tuning (Lester et al. 2021) prepends them to the input only, and "closes the gap" with full tuning only as T5 models exceed billions of parameters. Prefix tuning (Li and Liang 2021) prepends keys and values at every layer, about 0.1% of the parameters; P-tuning v2 (Liu et al. 2021) made deep prompts match fine-tuning on understanding tasks with 0.1% to 3% of the parameters. Niche today.
  4. (IA)³ (Liu et al. 2022): rescale activations with learned vectors; among the fewest parameters of any method here (fewer than LoRA by about 80 times on Llama 3 8B), built for few-shot fine-tuning of T0 (the T-Few recipe).
  5. LoRA (Hu et al. 2021): learn the change to a frozen matrix as a product of two thin matrices.
  6. LoRA-FA (Zhang et al.) freezes A, arguing the update collapses to a regression on B, which saves activation memory; VeRA (Kopiczko et al.) shares one frozen random pair across all layers and trains only scaling vectors, for storage-bound settings with many adapters.

LoRA, on one real matrix

LoRA (Hu et al. 2021) leaves a pretrained matrix W0 frozen and learns its change as the product of two thin matrices. Fig. 2 runs it on a real matrix: the query projection of layer 14 of SmolLM2-135M (576 × 576). For the "after" it uses a real fine-tuning update: the same matrix in SmolLM2-135M-Instruct, which its model card says was made from the base by SFT and then DPO. Full fine-tuning produced that update; LoRA cannot, because it is limited to rank r, so the LoRA steps show the closest rank-r matrix to it (its truncated SVD, the best any rank-r update can do in squared error).

Predict, then watch: what share of this real update can a rank-64 matrix (of a possible 576) hold? Pick r = 64 and look at step 3. (Rank 64 recovers 57% of the update's squared size.)

  1. The frozen matrix. W0, 576 × 576 = 331,776 numbers; the plate shows its top-left 16 × 16 entries as bars (up positive, down negative), and the input x streams through it to h. LoRA never changes it: no gradient, no optimiser state, 2 bytes each in bf16.
  2. Add A and B; B starts at zero. A (r × 576, random) and B (576 × r, all zeros) sit on a parallel path, drawn to scale at r = 16. x flows through them too, but B = 0, so ΔW = BA = 0 and the model is exactly the base. Only 18,432 numbers are new. Their product is multiplied by α/r (PEFT's default is α = 8 with r = 8; LoRA Without Regret used α = 32).
  3. Train: gradients reach A and B only. The update fills in, in at most r directions. Shown: the closest rank-r matrix to the update full fine-tuning actually made, which holds 23% of that update's squared size.
  4. Against the real update. Behind it, the real ΔW (Instruct minus base), at the same scale: its size is 8.3% of W0's, spread over many directions, and what the rank-r copy misses lies in directions LoRA cannot reach at this rank. Full fine-tuning trained every number, at about 16 bytes each (5.31 MB of training state for this matrix, 8 times the frozen 2), and ships the whole matrix per task: 664 KB here, 269 MB for the whole 135M model in bf16.
  5. Merge for serving. W = W0 + (α/r)BA is one ordinary 576 × 576 matrix again: A and B disappear and each token does no extra work. Subtract the product to get the base back, or keep A and B separate to swap tasks.

At rank 16 LoRA's training state for this matrix is 958 KB (2 B per frozen number plus 16 B per trained one), and it ships 37 KB per task.

measured by delta_probe.py from the two published checkpoints (bf16; storing the fine-tuned weights in bf16 can account for well under 0.1% of the update's squared size). Plates show the top-left 16 × 16 corner of each matrix; counters are for the whole matrix. Both updates are drawn at their own scale, 12 times finer than W0's, the same for both plates. Rank 1, 4, 16 and 64 hold 2.3%, 7.8%, 23% and 57% of the update. Bytes: 2 per bf16 number shipped; training state 16 bytes per trained number and 2 per frozen one.

The formula, in the figure's names:

h = W0x + (α / r) · B A x
W0
the frozen weight, dout × din
A
r × din, starts random (the paper: Gaussian; PEFT: Kaiming-uniform)
B
dout × r, starts at zero, so ΔW = BA = 0 and training begins exactly at the base model
r
the rank: trainable numbers r(din + dout) instead of dindout
α / r
a fixed scale, so the effective step size does not change when you change r
  • Zero-initialised B. Because ΔW starts at exactly zero, step 0 of training is the base model, and the first gradient step moves only B (the gradient of A is multiplied by B, which is zero).
  • Rank and alpha. Dividing by r keeps the optimal learning rate roughly independent of rank; Thinking Machines found the learning curves of different ranks "exactly the same at the beginning of training" (LoRA Without Regret). rsLoRA argues the right divisor is √r, because 1/r "results in slowed learning and stunted performance" at higher ranks; PEFT switches with use_rslora=True. Changing r under one convention while keeping α from a recipe written for the other changes the effective learning rate; know which one your library applies.
  • Merging. After training, W = W0 + (α/r)BA is one ordinary matrix: the merged model has exactly the base's shape and speed. Subtracting the product un-merges it, which is how one base can switch tasks.
Initialisation in the reference code, and LoRA+ (optional)

Microsoft's own loralib initialises A Kaiming-uniform, "different than what is described in the paper but should not affect performance". LoRA+ (Hayou et al. 2024) shows that one learning rate for A and B is suboptimal at large width and gives B a larger one: 1 to 2% better and up to about 2 times faster, at the same cost.

The LoRA paper's own animation of a token through LoRA against an adapter, its GPT-3 parameter calculator, and a LoRA you can train in the browser on a task whose true update is known are on the LoRA paper page.

How low is the rank of a real update?

LoRA's bet is that the change fine-tuning needs is low-rank. The LoRA paper supported it with GPT-3, where rank 1 to 4 on the query and value matrices already matched larger ranks on its tasks. Full fine-tuning has no such limit, and its updates are not low-rank: Biderman et al. found full fine-tuning on code and math learns "perturbations with a rank that is 10-100× greater than typical LoRA configurations", rising with more data and higher in the MLP than in attention (LoRA Learns Less and Forgets Less). SmolLM2's real update says the same, first for the matrix of Fig. 2, direction by direction:

  1. 576 directions. Each column is one singular value of the real update, tallest first, read row by row from the front-left corner; its height is σ², the update's squared size along that direction. The largest is σ₁ = 1.42, against 16.6 for W0 itself.
  2. Rank 1. The best rank-1 update keeps only the tallest column: 2.3% of the squared size.
  3. Rank 16, a common LoRA rank: 23%.
  4. Rank 64: 57%.
  5. 90% needs 198 of 576. The columns fall off slowly, so most of the update is spread over hundreds of directions: it is not low-rank.

measured by delta_probe.py, the same two checkpoints; σ² are the squared singular values of ΔW, so the lit columns' heights add up to the share a rank-r matrix can hold.

Every other matrix of the model, the same way: the heatmap shows all 210 and the table their medians over the 30 layers.

What this does not show
That LoRA would be worse here. Full fine-tuning has no reason to keep its update low-rank, so much of it may be directions that do not matter for the task. LoRA finds a different solution, not a compressed copy of this one; the share held is an upper bound on how closely any rank-r update could copy this one, nothing more. Whether LoRA scores as well is measured by training both, as the studies in Against full fine-tuning do.

All 210 matrices (30 layers × 7): the MLP updates are the most spread out; a rank-16 LoRA could hold a quarter to a third of an attention query or output update and about a sixth of an MLP one

Click or tap a cell.

measured SmolLM2-135M to SmolLM2-135M-Instruct, every layer; medians over the 30 layers in the table (about 200 of 576 directions for 90% of the attention query and output, about 350 for the MLP matrices). Rank shares are of min(din, dout): 576 for q, o and the MLP, 192 for k and v (grouped-query attention). Some single matrices did change in few directions: layer 0's value projection moved by 33% of its size with 90% of that in 22 directions.

Which matrices to adapt

The LoRA paper adapted only the attention query and value matrices of GPT-3. Practice has moved to every linear layer, especially the MLP:

  • QLoRA could not match full fine-tuning with LoRA on q and v; "LoRA on all linear transformer block layers are required", and the total number of adapters mattered more than the rank (QLoRA §4).
  • LoRA Without Regret: attention-only LoRA underperforms MLP-only LoRA "even when we match the number of trainable parameters by using higher rank for attention-only LoRA"; MLP-only performs about as well as MLP plus attention; and "LoRA performs better when applied to all weight matrices, especially MLP and MoE layers" (Thinking Machines). QLoRA found MLP plus attention above MLP alone; the two studies differ on that second step only.
  • Biderman et al. recommend targeting "All" modules, at rank 256 when memory allows, because ranks 16 to 64 "tend not to suffice for code tasks".

Fig. 4 shows why the choice matters for cost: on a dense model most of an all-linear adapter sits in the MLP.

  1. One block, to scale. Llama 3 8B's seven linear matrices, width the input size and height the output size: q and o 4,096 × 4,096, k and v 1,024 × 4,096 (8 key-value heads of 128), gate and up 14,336 × 4,096, down 4,096 × 14,336; 32 such blocks. The dashed square in front of each is where its LoRA would stand.
  2. q and v, the LoRA paper's choice. At rank 16: 6.8M trained numbers, 16% of an all-linear adapter at the same rank.
  3. All of attention. 13.6M, 32.5%.
  4. Every linear layer. 41.9M, of which the MLP holds 28.3M, 67.5%, at any rank.
  5. Matched parameters. Attention alone at 2.08 times the rank (about rank 33) trains as many numbers as MLP alone at rank 16, the comparison LoRA Without Regret ran: attention-only still did worse.

Each matrix costs r(din + dout) per layer: q and o 8,192, k and v 5,120 (8 KV heads), gate, up and down 18,432 each, so 55,296 of the 81,920 numbers per unit of rank per layer are in the MLP. The q and v of the LoRA paper's choice are 16% of an all-linear adapter at the same rank. derived from the config. The Trainable parameters tab breaks any configuration down, including a mixture-of-experts model where the expert matrices dominate.

Memory: full fine-tuning, LoRA and QLoRA

Training with Adam in mixed precision holds about 16 bytes per trained parameter: the bf16 weight and gradient (2 + 2), an fp32 master weight and two moments (12) (ZeRO). LoRA pays them only for the adapter, and QLoRA (Dettmers et al., 2023) also stores the frozen base in 4 bits. On Llama 3 8B with a rank-16 adapter on every linear layer the three need 128.5 GB, 16.7 GB and 6.4 GB. How the 16 bytes split across GPUs is on Distributed Training.

Predict, then pick LLaMA 65B: does QLoRA's 65B fit one 48 GB card at the QLoRA recipe's rank 64? (Fig. 5 says about 47 GB before activations; the paper measured 45.0 GB at batch 1.)

  1. Full fine-tuning: 16 bytes per parameter. Llama 3 8B has 8.03B parameters: bf16 weights and gradients take 32.1 GB, Adam's fp32 master copy and two moments 96.4 GB, 128.5 GB in all.
  2. LoRA: freeze the base. The base stays in bf16 with no gradient and no optimiser state, 16.1 GB; only the rank-16 adapter (41.9M numbers) pays the 16 bytes: 16.7 GB.
  3. QLoRA: a 4-bit base. The linear weights in NF4 at 4.127 bits, 3.60 GB; the embeddings and norms stay in bf16, 2.10 GB; the same adapter on top: 6.37 GB.
  4. The adapter is a sliver. Heights stretched to see it: its weights and gradients take 0.17 GB and its Adam state 0.50 GB, 0.67 GB in all. Freezing the base removes 14 of the 16 bytes per parameter; 4-bit storage removes most of the remaining 2.
  5. Which card holds it. The planes are 24, 48 and 80 GB cards. Before activations, full fine-tuning needs 2 × 80 GB, LoRA 24 GB and QLoRA 24 GB.

derived before activations, KV cache and framework overhead: full = 16N; LoRA = 2N + 16P; QLoRA = 4.127/8 × (linear weights) + 2 × (embeddings and norms) + 16P, with P the adapter's count; 4.127 bits = 4 + 8/64 + 32/(64 × 256), NF4 plus double-quantised block constants. Published checks: Biderman et al. put a 7B model at 112 GB with Adam and 15.12 GB with LoRA (Table S14), the same accounting with 7B rounded (112 = 16 × 7) and adapters of about 1% (15.12 = 2 × 7 + 16 × 0.07); QLoRA's "more than 780 GB" for 16-bit fine-tuning of LLaMA 65B reproduces at 12 bytes per parameter (no fp32 master copy: 783 GB), the 16 used here give 1,045 GB. QLoRA's Figure 6 prints 37,074 MB for the 65B model in 4 bits, which does not reproduce: this arithmetic gives 34.46 GB, 2.6 GB less, and the paper does not itemise it; the figure also keeps adapters in bf16 with no master copy (12 rather than 16 bytes each) (QLoRA paper page).

QLoRA backpropagates through the dequantised 4-bit weights into bf16 adapters. That took fine-tuning a 65B model from more than 780 GB of GPU memory to under 48 GB, one GPU, "without degrading the runtime or predictive performance compared to a 16-bit fully finetuned baseline". Three pieces make it work:

  • 4-bit NormalFloat (NF4): a 16-value code whose levels follow a normal distribution, since pretrained weights roughly do; blocks of 64 weights share one scale. The paper calls it "information theoretically optimal for normally distributed weights"; Yoshida (2023) shows it cannot quite be, because the distribution of the scaled values depends on the block size. The code itself, built and measured on real LLaMA weights, is on the QLoRA paper page; NF4 among the other number formats is on Quantization and Precision.
  • Double quantisation: the per-block scales are themselves quantised, saving about 0.37 bits per parameter (about 3 GB on a 65B model).
  • Paged optimizers: optimizer state in NVIDIA unified memory, so a long batch's memory spike pages to CPU instead of crashing.

QLoRA's recipe put LoRA on every linear layer (r = 64, α = 16). The trade is time: Sebastian Raschka measured 33% less memory for 39% more training time (21.33 GB and 1.85 h with bf16 LoRA against 14.18 GB and 2.79 h with QLoRA, in one of his runs) (Practical tips).

Merging onto a quantised base needs care. The adapter was trained against the dequantised 4-bit weights, so its product is right relative to those. The usual routes: merge into the original 16-bit weights and quantise the result again (which adds a fresh rounding error, so evaluate the merged model); keep the adapter separate at serving time; or train so the merge stays quantised, as QA-LoRA does. Some formats cannot merge at all: the PEFT docs say adapters on AQLM-quantised models "shall be saved separately, as merging them with AQLM quantized weights is not possible" (PEFT quantization guide). LoftQ goes the other way, choosing the LoRA initialisation to cancel part of the quantisation error.

LoRA against full fine-tuning

Two careful studies, a year apart, agree more than their titles suggest: LoRA matches full fine-tuning when the data fits in its capacity and it is set up right, and falls behind when the data is pretraining-sized.

"LoRA learns less and forgets less" (Biderman et al., 2024)

Biderman et al. trained Llama-2-7B on code and on math, two ways each: continued pretraining (CPT: StarCoder-Python up to 20B tokens; OpenWebMath, 14.7B tokens) and instruction fine-tuning (IFT: Magicoder-Evol-Instruct-110K, 73M tokens; MetaMathQA, 103M tokens). They scored the target skill (HumanEval for code, GSM8K for math) and, to measure forgetting, the average of HellaSwag, WinoGrande and ARC-Challenge, which the base model already knew.

Predict, then look: on code CPT, which run ends highest, and which forgets most? Then switch Fig. 6 to code IFT, where LoRA at rank 256 matches or beats full fine-tuning at epoch 4 while forgetting far less.

  • Continued pretraining: LoRA learns less. After 20B tokens of code, full fine-tuning reaches 0.263 on HumanEval and LoRA at rank 256 0.224; on math after 20B tokens, 0.293 against 0.202 on GSM8K. Rank 16 barely moves at all (0.162, 0.158).
  • Instruction fine-tuning: the gap mostly closes. Code IFT at epoch 4: LoRA r = 256 0.498 against full fine-tuning 0.470 (full fine-tuning's best, 0.497, comes at epoch 8). Math IFT at epoch 4: 0.625 against 0.642.
  • LoRA forgets less. After code IFT at epoch 4 the forgetting average is 0.632 for LoRA r = 64 and 0.512 for full fine-tuning; after one epoch the LoRA runs still sat at about 0.65. LoRA "mitigates forgetting more aggressively than classic regularization techniques" (dropout, weight decay).
  • Their recommendations: LoRA for instruction fine-tuning, not continued pretraining; all modules; rank 256 when memory allows; α = 2r; sweep the learning rate from 1e-5 to 5e-4.

Fig. 6 · Full fine-tuning climbs higher but slides left (forgets); LoRA stays right, and on instruction data catches up

published values from Tables S1 to S8, one run per point; the paper's figures plot the same data. Further right is less forgetting; higher is more learning.

"LoRA without regret" (Thinking Machines, 2025)

John Schulman and Thinking Machines Lab (29 September 2025) swept learning rates for LoRA and full fine-tuning on Llama 3 and Qwen3 models (including a mixture-of-experts one), with SFT on Tulu3 and OpenThoughts3 and RL on MATH and GSM. When "a few key details" are right, LoRA learns with the same sample efficiency as full fine-tuning:

  • All layers, especially the MLP and MoE layers (Which matrices).
  • Not capacity-constrained: the adapter must have more parameters than the information to be learned. LLM datasets carry "around 1 bit (0.69 nats) per token"; for typical instruction and reasoning sets LoRA has room. "For datasets that exceed LoRA capacity, LoRA underperforms FullFT", not by hitting a floor but by learning less efficiently. Engram measured the capacity directly on one model (Qwen3.5-0.8B): about 1.4 bits per adapter parameter for a single matrix at low rank, falling as rank grows, and 1.65 to 2.85 bits when many layers are adapted together; the code length of a dataset under the base model then predicted the rank needed to memorise it, erring high (median 12%) on 15 real datasets (Predicting LoRA size for any dataset).
  • Learning rate about 10 times full fine-tuning's: "the optimal LR for LoRA is consistently 10x the one used for FullFT in the same application, for both supervised learning and reinforcement learning". A LoRA run that "doesn't learn" at full fine-tuning's rate is often just under-stepped.
  • Modest batch sizes: LoRA "pays a larger penalty in loss as batch size increases beyond some point", and a higher rank does not fix it, "a property of the product-of-matrices parametrization". Hugging Face's TRL guide turns this into "an effective batch size < 32".
  • RL needs almost no capacity. LoRA "fully matches" full fine-tuning for policy-gradient RL "even with ranks as low as 1". Supervised learning gives O(tokens) bits per episode, a policy gradient only O(1) bits through the advantage. Their MATH run used about 10,000 problems × 32 samples, so at one bit each about 320,000 bits, against "3M parameters" in a rank-1 LoRA on Llama-3.1-8B (derived: 2,621,440 on all seven matrices, which rounds to their figure; check it in the Trainable parameters tab). The TRL guide's ranks: 256 for post-training-scale SFT, 1 to 32 for RL.
  • Cheaper per step: "slightly more than ⅔ of the FLOPs that full fine-tuning does per pass", from 2N² + 6NR multiply-adds against 3N² for an N × N matrix at rank R (no weight gradient for the frozen matrix). derived 67.4% at N = 4,096, R = 16; 79.2% at R = 256.
The two studies, reconciled
Biderman et al.'s continued pretraining runs (14.7 to 20B tokens) are exactly the "datasets that exceed LoRA capacity" regime; their instruction runs, where LoRA caught up, are the "low-regret" regime. Thinking Machines cites them for this: LoRA underperforms "in settings that resemble pre-training". Use full fine-tuning or continued pretraining (Data mixing, section 6) for billions of tokens of new domain text; LoRA for post-training.
A worked instance at the small end, and a correction (optional)

A 4B model (empero-ai/Qwen3.8-4B-Distill, a third party's distillation of Qwen 3.8 into Qwen 3.5 4B) was taught to write PostgreSQL query plans: SFT on 394 GPT-6 Astra trajectories (440 generated in two rounds of 120 and 320, 40 kept for validation and 6 dropped) through a LoRA of 21.2 million parameters (42.5 MB), then a custom "anchored" GRPO against measured execution time. On 113 join-heavy queries its plans averaged 1.40 times the speed of Postgres's own planner in one search (geometric mean); the headline 1.81 times is the best of three searches, picked by single timings, for $1,200 in total (about $800 of rented 2 × H100 time and $400 of API fees; development on two RTX 3090s) (write-up, 16 September 2026; the evidence judged: our reading).

Corrected from the old page
The old text said this cost "a few hundred dollars", ran "on consumer GPUs" and beat "a hand-tuned production planner". The write-up gives $1,200, training on a rented H100 node (consumer cards for development), and compares against PostgreSQL's built-in planner.

Fig. 7 · The same 60° turn: LoRA's length dips and recovers on the way; DoRA turns at constant length, with the length as its own number

illustrative one 2-D column moved toward a target turned 60° at the same length, along the straight path each parametrisation takes in its own parameters; not a trained model. Both reach the target: it shows how each moves, not which is more accurate.

DoRA: magnitude and direction

DoRA (Liu et al., ICML 2024) starts from a measurement: across training checkpoints, full fine-tuning's changes in each weight column's length and in its direction were negatively correlated (a large turn with a small stretch, or the reverse), while LoRA's were positively correlated, because one low-rank update moves both together. DoRA separates them: it trains each column's length directly and its direction with LoRA.

  1. The start. One column of W0, length 1, and the target: the same column turned 60° at the same length (on the dotted circle).
  2. LoRA's path. Training adds the update's column (BA) to the original, so the tip moves along the straight chord. The length is not a separate number: turning drags it down, 13% shorter halfway, then back up.
  3. DoRA's path. The column is split into a length m (the bar) and a unit direction. LoRA updates only the direction, which turns along the arc; m is its own trainable number and need not move at all.
  4. Both reach the target. In LoRA a change of length and a change of angle come from the same few numbers, so they move together: the positive correlation the paper measured in LoRA. DoRA decouples them, so one can change a lot while the other barely moves, the pattern it measured in full fine-tuning.
W′ = m · (W0 + BA) / ‖W0 + BA‖c
m
a trainable magnitude vector, one number per column (per output unit in PyTorch's layout), initialised to ‖W0‖c
‖·‖c
"the vector-wise norm of a matrix across each column vector"

The results (Table 1): on eight commonsense-reasoning tasks, LLaMA-7B averaged 74.7 with LoRA (0.83% of parameters trained), 78.4 with DoRA (0.84%) and 77.5 with DoRA at half the rank (0.43%); LLaMA3-8B 80.8 against 85.2. Two cautions: the LoRA numbers for LLaMA 7B and 13B are taken from an earlier paper (LLM-Adapters) rather than re-tuned, while DoRA kept LoRA's configuration "adjusting only the learning rate"; and the extra 0.01% is the magnitude vector (the Trainable parameters tab's LLaMA-7B preset reproduces 0.83%, 0.84% and 0.43%). To save memory DoRA treats the norm as a constant in the backward pass, which cut training memory by about 24.4% on LLaMA with a 0.2-point difference in accuracy. Once trained, DoRA merges like LoRA, so serving is free; PEFT enables it with use_dora=True.

Serving many adapters

One adapter is best merged: the model is the base's shape and speed. Many adapters on one base are a different problem, and LoRA's parallel form answers it with multi-LoRA serving (Fig. 8); routing, adapter limits and engine settings are on LLM serving in production.

  1. One merged copy per adapter. Merging makes a full model per adapter: five requests for five adapters need five copies. S-LoRA's merged baseline (vLLM-packed) ran 2.04 requests per second with 5 adapters and ran out of memory at 100.
  2. One shared base. Kept unmerged, one copy of W0 serves the whole batch in one batched matmul, x · W0.
  3. A small product per request. Each request adds x · Ai · Bi beside the base, per request for whichever adapter it asked for.
  4. The adapter pool. Every adapter lives in host memory; the ones the running requests need are paged onto the GPU into one memory pool shared with the KV cache ("Unified Paging").
  5. Thousands at almost the speed of five. S-LoRA served 2,000 adapters on one GPU at 7.61 requests per second, against 8.05 with five (Table 3, setting S1: Llama-7B, rank 8).

S-LoRA is the design of Fig. 8: the adapter pool in host memory, "Unified Paging" for adapter weights and the KV cache, and kernels that batch requests for adapters of different ranks. The merged baseline ran out of memory beyond a handful of adapters, and was 4 times slower even then: derived 8.05 / 2.04 = 3.9 times, and 7.99 / 0.25 = 32 times faster than PEFT, which swaps adapters between batches. Punica introduced the batching kernel for many LoRA models against one copy of the base; vLLM (--enable-lora) and SGLang ("techniques from S-LoRA and Punica") ship it; vLLM's limits (max_loras, max_lora_rank, max_cpu_loras), their defaults and what each costs are on vLLM: inside the default engine, section 5. The memory side of serving (KV cache, paging) is PagedAttention.

LoRA in products (optional)

Apple's on-device foundation model swaps rank-16 adapters, "10s of megabytes" each, per feature (Apple, June 2024), and Thinking Machines' Tinker fine-tuning service is built on LoRA.

Thousands of adapters on one GPU at almost the throughput of five

S-LoRAvLLM-packed (one merged copy per adapter)Hugging Face PEFT

published S-LoRA Table 3: requests per second on one A100 80GB, synthetic workload; OOM is out of memory; "not run" means the paper did not run PEFT there. Settings from its Table 1.

Choosing a method (2026)

SituationChoiceWhy
Post-training on one node, model fits in bf16LoRA on all linear layers, r = 16 to 64 (256 for large SFT sets), learning rate about 10 times full fine-tuning's, modest batches; FSDP2 if the base needs shardingMatches full fine-tuning in the low-regret regime at a fraction of the memory (Distributed Training for sharding)
Short of GPU memory, large baseQLoRA (NF4 base, bf16 adapters)65B on one 48 GB card; costs training time; evaluate after merging
RL fine-tuning (GRPO and its family)LoRA, low rank (1 to 32)RL absorbs about a bit per episode (RL for LLMs, Alignment)
Domain adaptation on billions of tokensFull fine-tuning or continued pretraining (Data mixing, section 6)Exceeds LoRA's capacity; LoRA learns less there
Many tenants or tasks on one deploymentOne LoRA adapter per task, multi-LoRA servingOne base in memory; S-LoRA-style batching
Thousands of adapters where storage dominatesVeRA or (IA)³Ten to a hundred times fewer numbers than LoRA; check quality on your task