Parameter-Efficient Transfer Learning for NLP

TL;DR

Proposes adapter modules for parameter-efficient transfer in NLP, achieving near state-of-the-art performance on 26 tasks with only 3.6% of full fine-tuning parameters.

cs.LG 🔴 Advanced 2019-02-03 44 views
Neil Houlsby Andrei Giurgiu Stanislaw Jastrzebski Bruna Morrone Quentin de Laroussilhe Andrea Gesmundo Mona Attariyan Sylvain Gelly
transfer learning parameter efficiency NLP models adapter modules deep learning

Key Findings

Methodology

This paper introduces bottleneck adapter modules into pre-trained Transformer models, inserting small neural networks between layers. By freezing original parameters and only training adapter weights, the approach enables multi-task parameter sharing. Using BERT as the base, adapters are applied to 26 text classification tasks, including GLUE. The adapters consist of linear projections with nonlinear activations, with parameters only a few percent of the original model. During training, only adapter and layer normalization parameters are optimized, drastically reducing parameter count. Performance closely matches full fine-tuning, demonstrating high parameter efficiency without sacrificing accuracy.

Key Results

  • On GLUE, adapters achieve an average score of 80.0, within 0.4% of full fine-tuning (80.4), while using only 3.6% of parameters. Across 17 additional datasets and SQuAD, results are similarly strong, with parameter savings of 97%.
  • Adapters automatically focus on higher layers, requiring fewer parameters for certain tasks, and enable continual learning by freezing shared parameters and training only small task-specific modules.
  • Experiments show that varying adapter size (from 2% to 8%) balances performance and parameter savings, with minimal performance loss compared to full fine-tuning.

Significance

This work addresses the critical bottleneck of parameter explosion in multi-task NLP models. By introducing lightweight adapter modules, it enables scalable, cost-effective deployment of large models across numerous tasks, especially in cloud environments. The approach significantly reduces storage and computation, facilitating practical multi-task and continual learning. It also opens new avenues for model modularity, where task-specific adaptations are decoupled from the core model, fostering more flexible AI systems with broad industrial and academic impact.

Technical Contribution

The paper proposes a novel bottleneck adapter architecture integrated into Transformer layers, which maintains the original model parameters frozen while only training a small set of task-specific weights. This design leverages the idea of parameter sharing and incremental task addition, supported by layer normalization tuning. The approach differs from traditional fine-tuning by drastically reducing the number of trainable parameters per task, enabling near-zero overhead for multi-task adaptation. The method also demonstrates robustness across datasets and tasks, establishing a new paradigm for parameter-efficient transfer learning.

Novelty

This is the first systematic application of bottleneck adapter modules within Transformer architectures for multi-task NLP. Unlike previous methods relying on full model fine-tuning or feature extraction, this approach introduces minimal task-specific parameters while preserving near state-of-the-art performance. Its key innovation lies in the modular, frozen backbone with lightweight, trainable adapters, providing a scalable solution to the parameter explosion problem in multi-task settings.

Limitations

  • While effective for classification tasks, the approach's performance on more complex tasks like text generation or sequence labeling requires further validation.
  • Optimal adapter size depends on task complexity, necessitating hyperparameter tuning, which may be resource-intensive.
  • The method's reliance on pre-trained Transformer models limits its applicability to other architectures without adaptation.

Future Work

Future research will explore adaptive adapter architectures, multi-layer and multi-task joint training, and integration with sparse or dynamic routing techniques. Extending the framework to generative tasks, multi-modal data, and low-resource scenarios are promising directions. Investigating theoretical guarantees for continual learning and robustness against catastrophic forgetting will further enhance its practical deployment. Additionally, automating adapter size selection via neural architecture search could optimize performance-efficiency trade-offs.

AI Executive Summary

The rapid advancement of large-scale pre-trained models like BERT has revolutionized NLP, but their deployment in multi-task environments faces significant challenges due to parameter explosion. Traditional fine-tuning requires retraining and storing a full model for each task, which is computationally expensive and impractical at scale. To address this, the authors propose an innovative solution: adapter modules inserted within Transformer layers. These modules are small neural networks that, when trained, adapt the pre-trained model to specific tasks by only updating a tiny fraction of parameters. This approach enables parameter sharing across tasks, drastically reducing the total number of trainable parameters while maintaining near state-of-the-art performance.

Extensive experiments on the GLUE benchmark and additional datasets demonstrate that adapters achieve an average score within 0.4% of full fine-tuning, using only 3.6% of the parameters. The method's core strength lies in its simplicity and scalability; adapters are initialized as near-identity functions, ensuring stable training, and can be selectively activated or ignored. This modularity facilitates continual learning, where new tasks can be added without disrupting previous knowledge, making it highly suitable for cloud-based services and real-world applications.

The significance of this work extends beyond mere parameter savings. It introduces a new paradigm for multi-task NLP, emphasizing modularity, efficiency, and flexibility. By enabling models to learn multiple tasks with minimal additional parameters, it paves the way for more accessible and sustainable AI deployment. Future directions include extending the adapter framework to generative tasks, multi-modal data, and further optimizing adapter architectures for diverse NLP challenges. Despite some limitations in complex tasks, this approach marks a substantial step toward scalable, adaptable NLP systems.

Deep Analysis

Background

近年来,预训练Transformer模型如BERT、GPT系列在自然语言处理(NLP)中取得了突破性进展,极大推动了迁移学习的发展。早期方法主要依赖特征提取或全模型微调,后者虽能获得优异性能,但参数规模庞大,限制了模型在多任务场景中的应用。随着多任务学习和持续学习的兴起,研究者开始探索参数共享和高效微调策略,例如Adapter、Prompt tuning等新技术。尽管如此,如何在保证性能的同时实现参数的极致压缩,仍是学术界的热点难题。本文在此背景下,提出基于瓶颈结构的适配器模块,为多任务迁移提供了新思路。

Core Problem

大规模预训练模型在多任务环境中面临参数爆炸问题。每个任务都需微调一份完整模型,导致存储和计算成本高昂,难以在实际场景中大规模部署。此外,模型在不断接收新任务时,如何实现无灾难遗忘和高效扩展,也是亟待解决的难题。现有方法如全微调虽然效果优异,但参数成本过高,限制了其应用范围。特征提取策略虽参数少,但在任务适应性和性能方面存在不足。因此,设计一种既能保持性能,又能大幅减少参数的迁移策略成为研究重点。

Innovation

本研究的核心创新包括:1)引入瓶颈适配器模块,将其插入Transformer层中,显著降低每个任务的参数量;2)冻结预训练模型的所有参数,只训练适配器参数,实现参数共享和任务扩展;3)结合层归一化参数调节,增强模型的适应性。这些创新使得模型在多任务迁移中实现了参数的极大节省,同时保持了几乎最优的性能。与传统的微调和特征提取方法相比,适配器提供了更高的参数效率和扩展性,为云端多任务服务提供了新范式。

Methodology

  • �� 在预训练的BERT模型中,每层插入两个瓶颈适配器模块,分别位于多头注意力和前馈层后。
  • �� 每个适配器由两个线性投影层组成,中间加非线性激活,形成瓶颈结构,参数量远少于原层。
  • �� 适配器初始化为接近恒等映射,训练时只调整适配器参数和层归一化参数,原模型参数保持冻结。
  • �� 采用Adam优化器,学习率线性升降,训练多次取最优。
  • �� 适配器尺寸(如8、64、256)作为超参数调优,确保性能与参数效率的平衡。
  • �� 适配器模块可在不同任务间复用,支持连续学习和任务扩展。

Experiments

采用GLUE基准和多样化文本分类任务,比较全微调、部分微调和适配器微调的性能差异。训练在Google Cloud TPUs上进行,调优超参数包括学习率、适配器尺寸和训练轮数。每个任务都进行多次随机初始化,选择验证集最佳模型。评估指标包括准确率、F1和相关相关性系数。通过消融实验验证不同适配器尺寸的效果,分析适配器在不同层次的影响,评估其在SQuAD问答中的表现。

Results

适配器在GLUE任务上达到了80.0的平均分,几乎与全微调的80.4持平,参数仅为3.6%。在17个额外任务中,适配器表现优异,参数节省达97%。不同任务中,适配器自动优先调整高层特征,部分任务只需微调少量参数即可获得优异性能。实验还显示,冻结底层参数,训练少量适配器层,模型能实现持续学习和任务扩展,参数共享优于传统微调策略。

Applications

该方法适用于云端多任务模型部署、个性化推荐、问答系统和文本分类等场景。只需少量参数调整,即可快速适应新任务,降低存储和计算成本。未来可结合多模态数据,扩展到图像、语音等领域,推动AI模型的普及。

Limitations & Outlook

适配器在极端复杂或差异巨大的任务中可能表现不足,尤其在任务间差异过大时,适配器的表达能力有限。设计适配器尺寸需调优,过小影响性能,过大降低参数效率。此外,当前主要验证于文本分类和问答任务,泛化到生成、序列标注等任务仍需验证。未来需优化适配器结构,提升其泛用性和鲁棒性。

Plain Language Accessible to non-experts

想象你在一家工厂工作,工厂里有很多不同的生产线,每条生产线都用不同的机器。以前,每条生产线都要有一套完整的机器,调试和维护都很麻烦。现在,工厂引入了一种新方法:在每条生产线的关键位置安装一个小型的调节装置,只需要调节这个小装置,就能让不同的生产线适应不同的产品。这些小装置可以随时安装或拆除,不影响工厂的整体运作。这样,工厂可以用更少的机器,快速适应不同的订单,节省成本,也更灵活。这就像论文中的适配器,把它插到模型的不同层里,只调节少量参数,就能让模型适应各种任务,既节省空间,又保持性能。

ELI14 Explained like you're 14

想象你在学校里,有很多不同的科目,比如数学、英语、科学。以前,每学科都要用一套完整的学习资料,准备工作很繁琐。现在,有一种聪明的方法,只用在每个科目的重点部分做一些小调整,比如在数学课上只调整一些公式的参数,这样就可以用同一份基础资料,快速变成不同科目的内容。这个方法节省了很多时间和空间,也让你可以轻松应对新科目。这就像论文里的适配器,把它放在大模型里,只调整少量参数,就能让模型学习不同任务,既高效又灵活。

Abstract

Fine-tuning large pre-trained models is an effective transfer mechanism in NLP. However, in the presence of many downstream tasks, fine-tuning is parameter inefficient: an entire new model is required for every task. As an alternative, we propose transfer with adapter modules. Adapter modules yield a compact and extensible model; they add only a few trainable parameters per task, and new tasks can be added without revisiting previous ones. The parameters of the original network remain fixed, yielding a high degree of parameter sharing. To demonstrate adapter's effectiveness, we transfer the recently proposed BERT Transformer model to 26 diverse text classification tasks, including the GLUE benchmark. Adapters attain near state-of-the-art performance, whilst adding only a few parameters per task. On GLUE, we attain within 0.4% of the performance of full fine-tuning, adding only 3.6% parameters per task. By contrast, fine-tuning trains 100% of the parameters per task.

cs.LG cs.CL stat.ML