Cross-Lingual Transfer and Alignment › Adapters and Parameter-Efficient Cross-Lingual Transfer
Language AI HandbookAll chapters Full fine-tuning of a 500M-parameter multilingual model for each language and each task is expensive and awkward. The cost is paid in storage, deployment, and engineering. If every language requires its own full copy of the model, a deployment serving 50 languages needs 50 full-sized files, and updates have to be repeated everywhere. Adapters solve this by inserting small trainable modules while keeping the base model frozen.
The adapter idea
The bottleneck adapter considered here is a small residual module that can be added alongside a transformer sublayer.
For hidden state , a bottleneck adapter computes:
where projects down to a chosen bottleneck width , is a nonlinearity, and projects back up. The example below uses GELU and .
Houlsby et al. use task-specific adapters with a largely frozen pretrained model. The number of trainable parameters depends on bottleneck width, placement, and which other parameters are trained. The example below counts the weights and biases for its two projections. Report training time and memory separately. Houlsby et al. (2019)
MAD-X
MAD-X (Pfeiffer et al. 2020) separates language adapters from task adapters so that the same task adapter can be reused across languages. MAD-X, §§4.1–4.3
- Language adapters. Train a language adapter with masked prediction on monolingual text. Measure the usable text available for each language.
- Task adapters. One per task, trained with the task loss on source-language (typically English) data. They capture task-specific features.
During task training, MAD-X freezes the source language’s layer-wise adapters and invertible embedding adapter while learning the task adapter. At target inference, it switches both language-specific components and keeps the task adapter. The same task adapter can then serve languages with their own trained adapters.
Invertibility
MAD-X also learns a reversible transform at the embedding layer. Split an embedding into and compute and . To recover the input, subtract in reverse order: and . The same functions and serve in both directions. In masked language modeling, the forward transform follows the input embeddings and its inverse precedes the tied output embeddings. For zero-shot task inference, the target language supplies this input transform as well as the layer-wise adapters.
MAD-X keeps its language and task modules separate. For this kind of modular design, specify which modules to insert, where they go, and how they run together.
Language-agnostic and language-specific
Not every deployment has a language adapter per language. When a language is not covered, you have three options.
- Try the adapter for another language and validate it on the target task. Choose candidates using lexical overlap, training coverage, or other measured criteria.
- Apply the task adapter directly as a comparison. Report how that differs from the setup in which the task adapter was trained.
- Train a new language adapter from available monolingual data. Compare the result and training cost with your other baselines.
Run the comparison on the actual target language. Script or morphology can help choose which to test. The measured result determines whether that adapter is suitable.
LoRA and modern alternatives
LoRA (Hu et al., 2022) freezes an existing weight matrix and fits a low-rank update. With their scaling convention for rank r,
For a square projection, and have parameters, excluding any other trained parameters. The fixed scale is . At inference, the update can be folded into the existing weight matrix. Hu et al. (2022), §4.1
Train and evaluate any language or task updates under the composition rule you intend to use. A sum of two weight updates is a different operation from stacking independently trained nonlinear bottleneck adapters.
Composition and adapter fusion
The reason modular adapters are interesting beyond parameter cost is composability. If you have:
- Language adapters for French, German, and Japanese.
- Task adapters for NER, sentiment, and QA.
You have nine cross-lingual task systems, from six trainable modules. Adding a new language or task costs one adapter, not one full model. The savings compound: adding a fourth language takes the system from nine to twelve combinations with a single new module, whereas a full-fine-tuning deployment would require three new full models.
AdapterFusion trains a composition layer over separately trained task adapters. It learns input-dependent weights over the adapter features in the original task-composition setting. Treat using language adapters this way as a separate experiment. Pfeiffer et al. (2021), §3
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!