The Hidden Space of Transformer Language Adapters

Jesujoba Alabi, Marius Mosbach, Matan Eyal, Dietrich Klakow, Mor GevaACL 2024

Abstract

Language adapters enable parameter-efficient cross-lingual transfer, but their internal operations have remained poorly understood. This research demonstrates that adapted models maintain internal representations in the source language for the majority of the forward pass, performing translation only in the final layers. Furthermore, adapters are shown to be deeply entangled with the base model's representation space, reusing existing linguistic structures rather than utilizing an isolated subspace. This structural dependence explains why adaptation difficulty scales with linguistic distance.

Introduction

To make large language models (LLMs) multilingual without the prohibitive cost of retraining, researchers often employ parameter-efficient fine-tuning (PEFT) methods like adapters or LoRA. These small neural modules are inserted into the layers of a frozen, pre-trained model. While effective, the internal mechanics of how these modules shift a model's predictions to a new language have been a "black box."

This paper investigates whether the model immediately switches its internal processing to the target language or if it processes information in its primary source language and translates at the output stage. Additionally, it explores whether adapters utilize unused capacity within the model or if they are constrained by existing linguistic structures.

Methodology

The authors trained an 814M-parameter auto-regressive language model from scratch on English. This model was then adapted to four target languages—German, French, Hebrew, and Arabic—using Pfeiffer adapters and LoRA. The study also included experiments on mBERT to validate findings on established multilingual models.

To analyze the internal state, several interpretability techniques were used:

  • Logit Lens: Projecting intermediate hidden representations into the vocabulary space to identify the language of "thought" at specific depths.
  • Adapter Dropping: Systematically removing adapters during inference to measure layer-wise importance.
  • Structural PCA: Mapping linguistic features (POS, tense, number) to compare the geometric alignment between source and target language representations.

The Late Translation Phenomenon

A primary finding of the study is that adaptation is not a layer-wide transformation. Instead, the model processes information in the source language for almost the entire forward pass. Vocabulary projections show that target language tokens only dominate the top predictions in the final 1-2 layers.

Figure 4: Fraction of target language tokens across layers for different adaptation methods (Adapters, LoRA) and models (custom en-based, mBERT). The sharp spike at the end illustrates the late translation effect.

Across the first 22 layers of a 24-layer model, target language tokens typically constitute less than 20% of the top-10 predicted tokens. This figure spikes dramatically to 80-90% in layers 23 and 24, suggesting the model "thinks" in English and translates at the last possible moment.

Adapter Sensitivity and Layer Importance

The importance of adapters is not uniform across the model. The authors found that adaptation is "top-heavy." Early and middle adapters can often be removed with negligible impact on performance, whereas the final layers are indispensable for target language output.

Figure 6: Heatmap showing the increase in perplexity when removing contiguous blocks of adapters. The high values in the bottom-right corner indicate that the final layers are most critical for model performance.

As shown in the ablation studies, removing up to three consecutive adapters in early layers increased perplexity by less than 10 points for French and German. However, removing the final two layers caused perplexity to spike by over 100 points across all tested languages, confirming their role in the final linguistic transformation.

Structural Entanglement and Language Distance

Contrary to the hypothesis that adapters might operate in an isolated, unused subspace of the model, the study found that adapters are deeply entangled with the core model's representations. Intervening on random features was found to be as detrimental as intervening on "adapter-specific" features.

Furthermore, adapters appear to reuse the underlying model's existing linguistic geometry. The geometric layout of concepts like part-of-speech and tense in the target languages aligns closely with the original English structures. This reliance on existing structures makes adapting to linguistically distant languages (like Arabic or Hebrew) significantly harder than adapting to closely related ones (like French or German), requiring larger mathematical updates and showing higher sensitivity to adapter removal.

Conclusion and Future Work

This research reveals that language adaptation is a localized process occurring at the end of the model's computation, constrained by the source language's internal geometry. These insights suggest that future PEFT methods could be made more efficient by focusing on final layers or by developing techniques that better navigate the structural constraints of distant languages. Additionally, the redundancy of early-layer adapters presents an opportunity for compute savings during inference through automated adapter dropping.

Summary updated

BibTeX
@inproceedings{alabi2024hidden,
  author = {Jesujoba Alabi and Marius Mosbach and Matan Eyal and Dietrich Klakow and Mor Geva},
  title = {{The Hidden Space of Transformer Language Adapters}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.356},
}
Figure