Abstract
The rise of Modular Deep Learning showcases its potential in various Natural Language Processing applications. Parameter-efficient fine-tuning (PEFT) modularity has been shown to work for various use cases, from domain adaptation to multilingual setups. However, all this work covers the case where the modular components are trained and deployed within one single Pre-trained Language Model (PLM). This model-specific setup is a substantial limitation on the very modularity that modular architectures are trying to achieve. We ask whether current modular approaches are transferable between models and whether we can transfer the modules from more robust and larger PLMs to smaller ones. In this work, we aim to fill this gap via a lens of Knowledge Distillation, commonly used for model compression, and present an extremely straightforward approach to transferring pre-trained, task-specific PEFT modules between same-family PLMs. Moreover, we propose a method that allows the transfer of modules between incompatible PLMs without any change in the inference complexity. The experiments on Named Entity Recognition, Natural Language Inference, and Paraphrase Identification tasks over multiple languages and PEFT methods showcase the initial potential of transferable modularity.
Introduction
Modular Deep Learning has become a cornerstone strategy for adapting massive models to specific tasks or languages without the prohibitive cost of retraining entire networks. By utilizing Parameter-Efficient Fine-Tuning (PEFT) methods like Adapters or LoRA, researchers can achieve high performance by training only a tiny fraction of a model's total parameters.
However, a significant bottleneck remains: these modules are typically "locked" to the specific architecture they were trained on. An adapter trained for mBERT-base cannot be directly applied to DistilmBERT or RoBERTa. This lack of portability means that every time a new, more efficient base model is released, previous task-specific tuning must be repeated from scratch. This paper investigates whether modularity can be made transferable, specifically by migrating "knowledge" from large "teacher" models to smaller "student" models.
Methodology
The study explores two primary scenarios for transferring PEFT modules: matching architectures and incompatible architectures.
1. Matching PLMs
In this scenario, the teacher and student share the same hidden dimension size and are typically related via task-agnostic distillation (e.g., transferring from mBERT to DistilmBERT). Because the student model has fewer layers, the authors evaluate two transfer strategies:
- SKIP: Transferring every $n$-th layer from the teacher to the student to maintain functional depth.
- AVG: Averaging groups of teacher layers to create a single representative student layer.
2. Incompatible PLMs
When the teacher and student have different hidden dimensions and were trained independently (e.g., XLM-R Large to XLM-R Base), a simple layer mapping is insufficient. The authors propose a Pruning and Alignment method to bridge this gap:
- Sampling: Latent embeddings are generated by passing identical data through both models.
- Correlation: A Pearson correlation matrix is calculated between the teacher's and student's latent dimensions.
- Linear Sum Assignment (LSA): The LSA algorithm identifies the optimal mapping between the teacher's high-dimensional space and the student's lower-dimensional space.
- Weight Mapping: Teacher module weights are pruned and reordered to match the student's dimensions based on the LSA mapping.
Experimental Setup
The proposed methods were benchmarked across three diverse NLP tasks covering over 20 languages:
- Named Entity Recognition (NER): Evaluated on the WikiNeuRal dataset.
- Paraphrase Identification (PI): Evaluated on the PAWS-X dataset.
- Natural Language Inference (NLI): Evaluated on the XNLI dataset.
Key Insights and Results
The Role of Distillation
Transferability is significantly enhanced when the student model was originally distilled from the teacher. This suggests that the distillation process preserves a "shared latent language" between the models, allowing transferred modules to function effectively with minimal adjustment.
Layer Identity and Functional Roles
Experimental results consistently showed that the SKIP method outperformed the AVG method. This finding implies that individual layers in a Transformer perform distinct functional roles that are blurred when averaged. Preserving specific layers through the SKIP method better maintains the task-specific logic captured during fine-tuning.
Performance Gains
For matching models, initializing a student with transferred teacher modules (TM-Student) consistently outperformed standard random initialization. In the PAWS-X (PI) task using Adapters, transferred modules significantly closed the performance gap, showing up to a +4 point improvement in languages like Korean compared to the baseline student.
For incompatible models, results were more varied. While the pruning/alignment method provided gains in certain contexts (e.g., +2 points in Korean PAWS-X), it occasionally led to slight performance drops in others. This indicates that while alignment is possible, transferring between "unrelated" models remains a more complex challenge.
Conclusion and Future Work
This work demonstrates that modularity is indeed transferable, particularly when leveraging the relationship established by knowledge distillation. While the proposed alignment method for incompatible models is a promising parameter-free start, the authors note that alignment becomes more difficult in deeper layers where model representations diverge. Future research may explore non-linear alignment techniques or methods to bake "transfer-readiness" directly into the pre-training phase of language models.
Summary updated