AI State of the Art
SOTA/Efficient Fine-tuning (PEFT)/18 min
Section 105

Adapters: Additive Modules

Listen as a podcast →

Before LoRA, There Were Adapters

This page describes the ancestor of the whole family, the one LoRA was built to fix. In 2019 a team at Google had the following idea: rather than modify the model's weights, insert small trainable modules between its layers.

That is the principle of adapters: the large pre-trained model stays entirely frozen, and you add tiny neural networks that carry the specialization on their own.

This is the first of the three principles of what would later be called PEFT (Parameter-Efficient Fine-Tuning). What is learned here is the weights of the small added modules, and nothing else.

Parameter-Efficient Transfer Learning for NLP (Houlsby et al., 2019)

The Idea: A Bottleneck Inserted into the Pipe

Picture a wide pipe (768 channels in BERT (Bidirectional Encoder Representations from Transformers, one of the first large language models)) carrying information. An adapter is a temporary narrowing of that pipe: compress the information into a much smaller space, transform it, widen it back out.

The Structure of an Adapter

Four steps, in order:

  1. Down-projection: take the input, of dimension dd (768 for BERT), and bring it down to a much smaller dimension mm (say 64).
  2. Activation: apply a non-linear function. Two common names: ReLU (Rectified Linear Unit, it replaces every negative number with zero) and GELU (Gaussian Error Linear Unit, a smoothed version of the same). Without this step, stacking two projections would buy nothing: two linear operations in a row always collapse into one.
  3. Up-projection: widen back to the original dimension dd.
  4. Residual connection: add the result to the input itself, that is, leave a bypass route that short-circuits the module.

adapter(x)=x+up(activation(down(x)))\text{adapter}(x) = x + \text{up}(\text{activation}(\text{down}(x)))

Read that back: the output is the input, plus whatever the small module computed. xx is the vector arriving at the module; the two projections are learned weight matrices, of sizes d×md \times m and m×dm \times d.

The residual connection is essential. At the start, the module's weights are near zero, so its contribution is nearly nil and the output roughly equals the input: the module is transparent. It then learns to intervene, gradually. This is the third PEFT principle, start from the identity so you break nothing.

On the left, the internal bottleneck structure of an adapter: a feed-forward down projection from 768 to 48 dimensions, an activation function, then a feed-forward up projection from 48 back to 768. On the right, where the two adapters sit inside a Transformer layer: one after the self-attention block and one after the feed-forward network, each followed by a residual and norm step.
On the left, the bottleneck itself: down from 768 to 48 dimensions, a non-linearity, then back up to 768. On the right, the original Houlsby configuration: two adapters per Transformer layer, one right after attention, one right after the small neural network that follows it. The dashed arrows are the residual connections that make the module nearly transparent at the start of training.Source : Houlsby et al. 2019 paper (Houlsby configuration), via Zilliz
Working Out the Parameter Count

An adapter is two matrices: one d×md \times m going down, one m×dm \times d coming back up, i.e. 2×d×m2 \times d \times m learned parameters.

For BERT-base, d=768d = 768 and m=64m = 64: 2×768×64=98,3042 \times 768 \times 64 = 98{,}304 parameters per adapter. The paper reports a total of 3.6% of the model's parameters added per task, counting both adapters in every layer.

Notice the shape of the calculation: 2dm2dm against r(d+k)r(d + k) for LoRA. In both cases you pay one narrow intermediate dimension times the width of the model. The two methods buy the same thing the same way; they differ on where they wire it in.

Where to Place Them in the Transformer?

In the original configuration, Houlsby's, two adapters per layer are inserted:

  1. after the multi-head attention block;
  2. after the small neural network that follows attention in each layer.

Later work (the so-called Pfeiffer configuration, the one implemented by the adapters library) keeps only the second one, and reports a negligible loss for half the parameters.

Why Does It Work So Well?

The deep intuition is this: pre-training learns general representations of language (grammar, semantics, basic reasoning). Fine-tuning for a specific task doesn't require starting from scratch. It's enough to learn small transformations that redirect these representations toward your task.

It's like a Swiss Army knife that's already assembled. You don't need to reforge the entire knife to add a corkscrew. You just add the missing module.

What the Paper Actually Claims

The abstract is precise, and the figure checks out: adding 3.6% of parameters per task, adapters land within 0.4 points of full fine-tuning on GLUE (General Language Understanding Evaluation, a battery of nine English comprehension tasks that served as the reference at the time).

Put differently: 96.4% of the model's parameters need not move to adapt it to a new task. That is the founding result of the whole field.

Adapters and LoRA: The Decisive Difference

AspectAdaptersLoRA
Mechanismmodules inserted in series between layerscorrection added in parallel to a weight matrix
Internal non-linearityyes (ReLU or GELU)no, purely linear
Merging into the weightsimpossiblepossible
Inference latencyincreasedunchanged
The Flaw LoRA Fixes, in One Sentence

An adapter is one more step to walk through: at inference, information has to descend into the bottleneck, pass the non-linearity, come back up, and none of that can be precomputed. LoRA's correction is purely linear and has the same shape as the original matrix, so it can be added to it once and for all before deployment.

The non-linearity is exactly what forbids merging. Adding two matrices gives a matrix; chaining a matrix, a non-linear function and another matrix collapses into no single matrix at all. It is this detail, not any quality gap, that tipped the scales towards LoRA.

Interesting Descendants

The adapter idea has spawned powerful variants:

AdapterFusion: train several adapters on different tasks, then let an attention mechanism learn to combine them, without retraining any of the individual adapters.

AdapterHub: a sharing platform. A "French" adapter, a "legal" one, a "summarization" one, assembled like bricks.

The Star Use Case: Multilingual

This is where adapters truly shine, and where LoRA doesn't have an equally elegant answer:

  1. Base model: trained on English.
  2. Language adapter: a "French" adapter capturing the syntax and quirks of the language.
  3. Task adapter: a named entity recognition adapter (NER, spotting people, places and organizations in a text), trained on English data.
  4. Combination: stack the two and you get entity recognition in French, without ever having had annotated French data.

Here is where stacking in series, a flaw at inference time, becomes an asset: because the modules are traversed one after another, they can be composed.

Two Transformer layers side by side. On the left, the training phase: a language adapter MLM En Adapt and a task adapter NER En Adapt are stacked after the feed-forward block. On the right, the test phase: the English language adapter is swapped for a Quechua language adapter MLM Qu Adapt, while the NER En Adapt task adapter stays unchanged.
Modularity in practice. At training time (left) an English language adapter and an entity-recognition task adapter are stacked. At inference (right) you swap only the language adapter for a Quechua one and keep the same task adapter: you get Quechua entity recognition without ever having seen Quechua data annotated for that task. MLM stands for masked language modelling, the word-masking pre-training used to train the language adapter.Source : Sebastian Ruder, Recent Advances in Language Model Fine-tuning (diagram after MAD-X)
Composing Skills

This is the asset that belongs to adapters alone: composition. A "French" adapter plus an "entity recognition" adapter gives entity recognition in French. A "German" adapter plus a "sentiment" adapter gives sentiment analysis in German, with no training example for the combination itself.

LoRA does not do this as cleanly, precisely because its corrections are added rather than stacked: adding two corrections blends their effects, whereas stacking two modules applies them one after the other.

The Legacy: The Foundations of Modern PEFT

LoRA dominates today, but adapters laid down the three principles every method in the family reuses:

  • Freeze the base model: the pre-trained weights are not touched.
  • Train only small additions: a few percent of the parameters suffice.
  • Start from the identity: at the outset, the addition changes nothing in the model's output. LoRA gets the same effect by initializing its B matrix to zero.

The adapters library (formerly AdapterHub) is still maintained and supports classic adapters, prefix tuning, LoRA, and their combinations.


Historical perspective. Adapters lost to LoRA on one technical point, inference latency. They won on substance: it was in 2019 that they established that a giant model could be adapted by touching only a fraction of its parameters. The full comparison of methods is in PEFT: comparing the methods.

Check your understanding0 / 4

1. Why did LoRA displace adapters as the default method?

2. What is the residual connection that bypasses each adapter for?

3. How do you get named entity recognition in French with no annotated French data, using adapters?

4. What does the founding result of the 2019 paper establish?