Overview of Parameter-Efficient Finetuning Techniques
Full finetuning trains every parameter, which for a 7B model in 16-bit format adds up to about 56 GB before activations, more than most consumer GPUs provide.
Why a 7B Model Strains Ordinary Hardware
Finetuning starts from a model that has already been trained and adjusts it for a new task. The obvious approach is to let every weight in the model move during that adjustment. Early on, models were small enough that this was practical, and the approach came to be called full finetuning. As models grew, the obvious approach started to fail for ordinary people.
The question this article follows is simple: if a model is too large to adjust completely on the hardware you own, what can you change instead? Keep one idea in mind as you read. In full finetuning, the number of trainable parameters equals the total number of parameters in the model. Every later idea in this article is a way of reducing that count, or of reducing the memory cost that comes with it.
Full finetuning also typically needs a large amount of high-quality annotated data, which many people cannot afford to produce. Memory and data both push practitioners toward one question: can they update less of the model?
Counting the Bytes in a Full Finetuning Run
Memory cost is easiest to understand when you add up the pieces. Take a model with 7 billion parameters, written 7B. Suppose the weights are stored in a 16-bit format such as FP16, where each value takes 2 bytes. The first piece of the bill is the weights themselves.
Numeric precision sets how many bytes each parameter occupies. At 16-bit precision each parameter takes 2 bytes; at 32-bit precision each parameter takes 4 bytes, so the same model needs twice as much memory for its weights.
Estimating the weight memory of a 7B model in FP16
How much memory do the weights of a 7B-parameter model need when stored in FP16, and how does this compare with the roughly 56 GB that the source gives for a full finetuning run?
- 1Write down the parameter count
The model has $7 \times 10^{9}$ parameters.
- 2Multiply by bytes per parameter
FP16 uses 2 bytes per value, so $7 \times 10^{9} \times 2 = 14 \times 10^{9}$ bytes.
- 3Convert to gigabytes
$14 \times 10^{9}$ bytes is about 14 GB for the weights alone.
- 4Compare with the full finetuning total
The source states that full finetuning of a 7B model in 16-bit format adds up to about 56 GB before activations. The weights are only one part of that total, so the remaining training state accounts for roughly 42 GB. The source does not itemize that remainder.
The weights alone take about 14 GB. The full finetuning total of about 56 GB, before activations, is more than four times larger, and that is more than most consumer GPUs provide.
The diagram shows the scale of the problem. Weights are only the first slice. The source's 56 GB figure is a total for the full finetuning run, not for the weights alone, and it still excludes activations. A GPU that cannot hold that total cannot run full finetuning on that model, however well the training code is written.
Freezing Layers With Partial Finetuning
The first workaround is partial finetuning. Instead of updating every parameter, you update only some of them and freeze the rest. A frozen parameter keeps its value throughout training. Picture a model with ten layers. If you freeze the first nine and train only the last one, the number of trainable parameters falls to about 10% of what full finetuning would need.
Freezing layers lowers memory use, but it does not solve the core problem. Partial finetuning is parameter-inefficient, which means it still needs many trainable parameters before it approaches the quality of full finetuning. The source reports a study on BERT large in which roughly 25% of the parameters had to be updated to match full finetuning on the GLUE benchmark. Performance rises only as more parameters are opened up.
What Makes a Technique Parameter-Efficient
The natural question follows. How can you reach performance close to full finetuning while training far fewer parameters? Techniques that answer this question are called parameter-efficient. There is no official cutoff that a method must cross to earn the label.
A finetuning technique is generally parameter-efficient when it gets close to full finetuning's performance while using several orders of magnitude fewer trainable parameters. The test is the ratio between trainable and total parameters, judged against the quality it achieves.
Parameter-efficient finetuning, abbreviated PEFT, was introduced by Houlsby and colleagues in 2019. Their key move was to insert extra parameters into the model in carefully chosen places, and then train only those extra parameters. The rest of the model keeps its original values.
Adapter Modules and Where They Sit
The extra pieces inserted by Houlsby and colleagues are called adapter modules. Their authors placed two adapter modules inside each transformer block of a BERT model. The original weights of the block are left alone, and the adapters are the only pieces that receive updates.
During finetuning, the original parameters stay unchanged. The number of trainable parameters is simply the number of parameters inside the adapters. On the GLUE benchmark, this arrangement came within 0.4% of full finetuning while using only 3% of the trainable parameters, as reported by the source.
Now trace what happens to a single input as it moves through the network. The input passes through the frozen base computation, then through the adapter, and then continues onward. The base values stay the same for every example, and only the adapter's values change during training.
Counting trainable parameters across three approaches
A model has 10 layers and the same total parameter count under each approach. Compare the share of parameters that receive updates for full finetuning, partial finetuning that freezes nine layers, and adapter-based finetuning as reported by the source for BERT.
- 1Full finetuning
Every parameter is trainable, so the trainable count equals the total count.
- 2Partial finetuning
Freezing the first nine of ten layers leaves about 10% of the parameters trainable.
- 3Adapter-based finetuning
The source reports that the adapters used only 3% of the trainable parameters of the BERT model on GLUE, and came within 0.4% of full finetuning's performance.
- 4Compare the results
Partial finetuning has the larger share of trainable parameters here, yet the source says it still falls short of full finetuning's quality in its BERT large study. Adapters use the smaller share and get close to full performance.
Full finetuning trains 100% of parameters, the partial example trains about 10%, and the adapter setup trains about 3%. Only the adapter setup is described in the source as close to full finetuning's performance.
Trade-offs of Adapters and Inference Speed
Adapters keep the original weights frozen and train only the inserted modules, which saves memory and data. Lower memory is not the only benefit of PEFT. The source says PEFT enables finetuning on more affordable hardware, which makes the work accessible to many more developers. It also says that PEFT methods are generally sample-efficient: full finetuning may need tens of thousands to millions of examples before quality improves noticeably, while some PEFT methods can deliver strong results with only a few thousand examples.
The cost comes from the path itself. The adapter is an extra computation on every forward pass, so the model does more work than it did before adapters were added. The source points to this as the main drawback: the additional layers add computational steps, which increases inference latency for the finetuned model.
| Approach | Trainable parameters | Memory and data | Inference effect |
|---|---|---|---|
| Full finetuning | Every parameter, equal to the total count | About 56 GB for a 7B model in 16-bit before activations; needs much annotated data | No inserted layers |
| Partial finetuning | Only unfrozen layers, about 10% in the ten-layer example | Lower memory, but still parameter-inefficient | No inserted layers |
| Adapter-based PEFT | Only adapter parameters, 3% in the source's BERT GLUE result | Lower memory and data needs; sample-efficient | Extra sequential steps raise inference latency |
Summary of the trade-offs as reported in the source. It collects the source's claims and is not a complete survey of every method.
Mistakes Learners Make With These Terms
Common mistake Treating freezing as the same thing as parameter-efficiency
What it looks likeFreezing nine of ten layers cuts trainable parameters to about 10%, so it seems efficient.
Why it failsThe source says partial finetuning is parameter-inefficient, because it still needs many trainable parameters to approach full finetuning's quality.
Do this insteadAsk whether the method reaches near full-finetuning performance with several orders of magnitude fewer trainable parameters.
Common mistake Assuming the 56 GB figure is the weights alone
What it looks likeReading 56 GB as the size of a 7B model in FP16.
Why it failsThe weights are about 14 GB at 2 bytes per parameter. The 56 GB is the full finetuning total before activations.
Do this insteadMultiply the parameter count by bytes per parameter for the weights, then account for the training state separately.
Common mistake Believing adapters make the model faster
What it looks likeAdding adapters to a model and expecting lower latency at inference.
Why it failsThe adapter adds computation on every forward pass, which the source identifies as increasing inference latency.
Do this insteadExpect adapters to save training resources while adding some inference cost.
Common mistake Confusing bytes per parameter with the number of parameters
Predicting Memory and Trainable Counts
What do you think happens?
A 7B model stored in 32-bit precision instead of 16-bit. Roughly how much memory do the weights take?
Reveal answer
About 28 GB, because 7 billion parameters at 4 bytes each is $28 \times 10^{9}$ bytes.
At 32-bit precision each parameter takes 4 bytes instead of 2, so the weight memory doubles from about 14 GB to about 28 GB. The same doubling applies to any precision change.
A model has 2 billion parameters and is stored in FP16. Estimate its weight memory, then say whether a full finetuning run is likely to need more than 4 times that weight memory, using the source's observation that full finetuning state adds to the weights.
Hints
- Multiply the parameter count by 2 bytes for FP16.
- The source's 7B example shows a full finetuning total of about 56 GB against about 14 GB of weights, which is four times the weight memory.
Explain in two or three sentences why an adapter-based run can have a much smaller trainable parameter count than full finetuning, and why that smaller count does not remove the inference cost of the adapters.
Hints
- Think about which parameters are frozen and which are inserted.
- Think about what the adapter adds to every forward pass.
Key Takeaways
- Full finetuning trains every parameter, so for a 7B model in FP16 the weights alone take about 14 GB and the full run totals about 56 GB before activations.
- Partial finetuning freezes layers and lowers memory, but it is parameter-inefficient because it still needs many trainable parameters to approach full finetuning's quality.
- A technique is parameter-efficient when it nears full finetuning's performance with several orders of magnitude fewer trainable parameters, and adapter modules do this by freezing the original weights and training only inserted modules.
- Adapters save memory, data, and training effort, but the extra sequential computation on every forward pass increases inference latency for the finetuned model.