Start studying
Module 10 · Fine-Tuning Module contents
Module 10  ·  Card 8 / 15intermediate

Adapters

An adapter is a small trainable module inserted between frozen layers.

Only the adapter's parameters are updated during training.

Different adapters can be trained for different tasks on one shared base.

You load whichever adapter the current request needs.

It is much cheaper than storing a full model copy per task.

Learn in depth ↓
Module 10 · Fine-Tuning · 15 concepts
In depth  /  15 lines

Adapters, in more detail

An adapter is a small trainable module inserted into a frozen model.

The original weights never change, and only the adapter learns.

The classic design places a small bottleneck block inside each transformer layer.

It projects down to a small size, applies a non-linearity, and projects back up.

It starts near identity so the untrained model behaves exactly as before.

That means training begins from the base model's behaviour rather than from noise.

Adapters typically add one to five per cent of the parameters.

Each task gets its own adapter and they all share one base model in memory.

You load whichever adapter the request needs, which takes milliseconds.

Serving fifty customer-specific variants becomes one model plus fifty small files.

The classic adapter sits in the forward path and adds a little inference latency.

LoRA avoids that by being mergeable into the base weights.

That is largely why LoRA became the default choice.

Adapters can be composed or stacked, though results are inconsistent.

The general idea, small modules over a frozen base, is now standard practice.

Want the full technical article? Wikipedia ↗
Deep dive

What is underneath Adapters

A bottleneck inserted into a frozen stack

h←h+f(hWdown)Wup\mathbf{h} \leftarrow \mathbf{h} + f\big(\mathbf{h} W_{\mathrm{down}}\big) W_{\mathrm{up}}
  • Wdown∈Rd×rW_{\mathrm{down}} \in \mathbb{R}^{d \times r}: projects down to a small width.
  • Wup∈Rr×dW_{\mathrm{up}} \in \mathbb{R}^{r \times d}: projects back up.
  • r≪dr \ll d: the bottleneck, typically 8 to 64 against a model width of 4,096.

Two small matrices and a nonlinearity are inserted after each sublayer. Everything around them is frozen.

2rd parameters per adapter2 r d \text{ parameters per adapter}

With d=4096d = 4096 and r=16r = 16 that is 131,000 parameters per insertion point, so a 32-layer model with two per layer trains about 8 million of them.

8×1067×109≈0.1%\frac{8 \times 10^{6}}{7 \times 10^{9}} \approx 0.1\%

Why it starts as the identity

Wup=0  ⟹  h←hW_{\mathrm{up}} = 0 \implies \mathbf{h} \leftarrow \mathbf{h}

The up projection is initialised to zero, so the adapter contributes nothing at step one and the model behaves exactly as it did before.

Training then moves it away from zero gradually. Without that, inserting random matrices into a trained network destroys its behaviour before any learning happens.

The residual connection around the bottleneck is what makes the identity reachable at all, and it is the same reasoning as in a transformer block.

One adapted model, in order

  1. Freeze every original parameter.
  2. Insert an adapter after the attention sublayer and after the feed-forward sublayer in each block.
  3. Initialise the up projection to zero and the down projection normally.
  4. Train only the adapters and the normalisation parameters.
  5. Save the adapters alone, which is a file of tens of megabytes rather than tens of gigabytes.

Leaving the layer norm parameters trainable is a small addition that reliably helps, since it lets the model rescale what the adapter changed.

The cost LoRA removed

Latency rises by 2 to 6 percent.

An adapter is a genuine extra operation in the forward pass, so it is still there at inference and every token pays for it.

LoRA:W′=W+BA\text{LoRA} : W' = W + BA

LoRA's update is a linear term parallel to an existing weight matrix, so it can be added into that matrix once and disappear entirely.

That single property is why LoRA displaced adapters as the default, despite the two performing about the same on quality.

Where adapters still win

LoRA and adapters both serve many tasks from one base model, and adapters do it without the merge step, so switching task is swapping a small module rather than rewriting weights.

AdapterFusion is the clearest example.

Several adapters trained on different tasks can be combined with a learned attention over their outputs, which is a composition story LoRA has no direct equivalent for.

The nonlinearity inside the bottleneck also gives them strictly more expressive power than a low-rank linear update at the same parameter count, which occasionally shows on hard tasks.

Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
What is the operational advantage of adapters when you serve many tasks?
Fine-Tuning

15 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close