Adapters, prefixes, rescaling and biases: other small ways to adapt
Four more ways to adapt a frozen network - bottleneck adapters, learned prefixes, IA3 rescaling vectors and bias-only BitFit - compared by what they train, what they cost at prediction time, and whether they can be merged away.
What runs in CodeSplash
- LNG070Houlsby adapters Explained here
- LNG069Prefix tuning Explained here
- TRN023IA3 activation rescaling Explained here
- TRN024BitFit bias-only fine-tuning Runs in CodeSplash
- Deep neural network (torch MLP) Verified in Python and R
You will be able to
- Describe where a bottleneck adapter, a prefix, an IA3 vector and BitFit act inside a layer
- Compare their trainable-parameter counts with LoRA's
- Say which ones add cost at prediction time and which can be folded into the weights
- Name the one that runs in CodeSplash today
Four places to add a few weights
ReadEvery method in this lesson freezes the pretrained network and trains something small. They differ in where the trainable numbers sit:
| Method | What trains | Where it acts |
|---|---|---|
| Adapters | A small bottleneck layer | After a sublayer's output |
| Prefix tuning | Virtual key and value vectors | Inside every attention layer |
| IA3 | One multiplier per channel | On keys, values and feed-forward activations |
| BitFit | The existing bias terms only | Everywhere a layer has a bias |
Bottleneck adapters
ReadAdapter layersAdapter layersSmall trainable bottleneck layers (down-project, nonlinearity, up-project, add back) inserted into a frozen network. project a hidden vector down to a small width , apply a nonlinearity, project back up and add the result:
starts near zero, so the network starts unchanged. Each adapter trains about numbers for width . In the reference's example, a two-number hidden state becomes 0.428 and −0.214: a small learned nudge.
Adapters add layers, so every prediction does a little more work, and the nonlinearity means they can't be folded into the frozen weights.
Prefix tuning
ReadPrefix tuningPrefix tuningLearn a few virtual key and value vectors that every attention layer attends to, while every model weight stays frozen. learns a few key and value vectors that every attention layer sees in front of the real tokens. No weight changes; the prefix changes what attention retrieves.
In the reference's example, a query attends over two prefix keys and two token keys; the prefix positions take 0.226 and 0.196 of the attention. Those shares come out of the context: the prefix occupies positions and compute at every step, and it can't be merged away.
IA3: one multiplier per channel
ReadIA3IA3 activation rescalingAdapt a frozen network by learning one multiplier per channel for its keys, values and feed-forward activations. learns three vectors per layer that rescale the keys, the values and the feed-forward activations channel by channel. They start at one, so the base model is the starting point.
In the reference's example, a row times scales becomes 1.0, 1.6 and 3.6. IA3 trains even fewer numbers than LoRA, and a rescaling of a linear layer's output can be folded into that layer's weights.
BitFit: only the biases
ReadBitFitBitFitFine-tuning only a network's bias terms and keeping every weight matrix frozen. trains nothing but the bias terms that already exist. In the reference's example, one gradient step on the bias alone moves the layer's output to 2.597, with the weights untouched.
BitFit runs in CodeSplash: on a trained neural-network model, Make a model from this → Adapt to new data, adapter BitFit. The adapted model needs nothing extra at prediction time. It can only shift each unit's input, so it suits small shifts in the data, not new behavior.
Which costs what?
PredictPredict first
After training, which two methods still add work to every prediction, however small their parameter count?
Reveal
Adapters and prefixes. An adapter is an extra nonlinear layer; a prefix takes attention positions. LoRA's BA and IA3's rescaling can be folded into the weights, and BitFit only changes existing biases.
What runs here
ReadCheck: small adaptations
CheckpointCheck yourself
Why is a bottleneck adapter's up-projection started near zero?
Show the answer
Answer: a
With W_up ≈ 0 the adapter adds almost nothing at first; training grows it only as far as the task needs.
Check yourself
Can a trained bottleneck adapter be folded into the frozen layer's weights like LoRA?
Show the answer
Answer: b
LoRA's update BA is linear, so W0 + BA is one matrix. An adapter computes h + W_up σ(W_down h), which no single matrix reproduces.
Check yourself
What does prefix tuning train?
Show the answer
Answer: a
The weights stay frozen; the learned prefix changes what each attention layer attends to.
Check yourself
A model allows 2,048 tokens of context. You add a prefix of 100 virtual tokens. What changes at prediction time?
Show the answer
Answer: a
Prefixes are cheap to store but not free to run, and they share the attention budget with your real tokens.
Check yourself
What does IA3 learn in each adapted layer?
Show the answer
Answer: a
Elementwise rescaling is the smallest change of all: one number per channel.
Check yourself
For a layer of width d, which trains fewer numbers than LoRA at rank 8?
Show the answer
Answer: a
IA3 trains one multiplier per channel and BitFit one bias per unit; LoRA trains r(d + k) = 16d for d = k and r = 8.
Check yourself
How do you adapt a trained CodeSplash network by its biases only?
Show the answer
Answer: a
BitFit is one of the adapter strategies for neural-network learners. The result is an ordinary run that remembers which model it came from.
Check yourself
When is BitFit least likely to be enough?
Show the answer
Answer: b
Biases only shift each unit's input; they can't change how the weights mix the inputs.
Recap
Recap- Adapters add bottleneck layers; prefixes add attention positions; IA3 rescales channels; BitFit trains biases.
- Adapters and prefixes cost something at every prediction; IA3, LoRA and BitFit can disappear into the weights.
- BitFit runs in CodeSplash as an Adapt strategy; adapters, prefixes and IA3 are explained here.
Concepts in this lesson