Efficient Transformer Knowledge Distillation: A Performance Review

📄 arXiv: 2311.13657v1 📥 PDF

作者: Nathan Brown, Ashton Williamson, Tahj Anderson, Logan Lawrence

分类: cs.CL, cs.LG

发布日期: 2023-11-22

备注: Accepted to EMNLP 2023. 12 pages, 1 figure, 11 tables. Models and data available at https://huggingface.co/giant-oak


💡 一句话要点

提出高效变换器知识蒸馏以解决模型压缩与计算效率问题

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture)

关键词: 知识蒸馏 高效注意力 模型压缩 长上下文理解 自然语言处理

📋 核心要点

  1. 现有的预训练变换器模型在计算效率和输入序列长度方面存在挑战,导致高计算需求。
  2. 本文提出通过知识蒸馏对高效注意力变换器进行模型压缩,以实现性能与计算成本的平衡。
  3. 实验结果表明,蒸馏后的模型在多个任务上保留了高达98.8%的性能,同时显著降低了推理时间。

📝 摘要(中文)

随着预训练变换器语言模型在自然语言处理领域取得最先进的性能,研究者们推动了模型压缩和高效注意力机制的进展,以应对高计算需求和有限的输入序列长度。尽管这些努力各自独立,但尚未对这两个领域的交集进行研究。本文评估了通过知识蒸馏对高效注意力变换器进行模型压缩的效果,提供了状态最先进的高效注意力架构的成本-性能权衡,并与全注意力模型进行了比较。此外,本文引入了一个新的长上下文命名实体识别数据集GONERD,以训练和测试长序列上的NER模型性能。研究发现,蒸馏后的高效注意力变换器能够保留原始模型性能的显著部分,短上下文任务(GLUE、SQUAD、CoNLL-2003)保留率高达98.6%,长上下文问答任务(HotpotQA、TriviaQA)保留率高达94.6%,长上下文命名实体识别(GONERD)保留率高达98.8%,同时推理时间减少了57.8%。

🔬 方法详解

问题定义:本文旨在解决高效变换器模型在计算效率和输入序列长度方面的挑战,现有方法在模型压缩与高效注意力机制的结合上存在不足。

核心思路:通过知识蒸馏技术对高效注意力变换器进行模型压缩,旨在在保持模型性能的同时降低计算成本,提升推理速度。

技术框架:整体架构包括预训练的高效注意力变换器、知识蒸馏过程和性能评估模块。首先对高效变换器进行预训练,然后通过蒸馏过程将知识转移到更小的模型中,最后评估其在不同任务上的性能。

关键创新:本文的主要创新在于首次将知识蒸馏与高效注意力机制结合,提出了一种新的模型压缩方法,显著提高了模型的计算效率与性能。

关键设计:在蒸馏过程中,采用了特定的损失函数以优化模型的性能,并对网络结构进行了调整,以适应长上下文任务的需求。

🖼️ 关键图片

fig_0

📊 实验亮点

实验结果显示,蒸馏后的高效注意力变换器在短上下文任务上保留了高达98.6%的性能,在长上下文问答任务上保留了94.6%的性能,而在长上下文命名实体识别任务上保留了98.8%的性能。同时,推理时间减少了57.8%,显示出显著的效率提升。

🎯 应用场景

该研究的潜在应用领域包括自然语言处理中的长文本理解、命名实体识别和问答系统等。通过提高模型的计算效率和性能,能够在资源受限的环境中实现更高效的文本处理,具有重要的实际价值和广泛的应用前景。

📄 摘要(原文)

As pretrained transformer language models continue to achieve state-of-the-art performance, the Natural Language Processing community has pushed for advances in model compression and efficient attention mechanisms to address high computational requirements and limited input sequence length. Despite these separate efforts, no investigation has been done into the intersection of these two fields. In this work, we provide an evaluation of model compression via knowledge distillation on efficient attention transformers. We provide cost-performance trade-offs for the compression of state-of-the-art efficient attention architectures and the gains made in performance in comparison to their full attention counterparts. Furthermore, we introduce a new long-context Named Entity Recognition dataset, GONERD, to train and test the performance of NER models on long sequences. We find that distilled efficient attention transformers can preserve a significant amount of original model performance, preserving up to 98.6% across short-context tasks (GLUE, SQUAD, CoNLL-2003), up to 94.6% across long-context Question-and-Answering tasks (HotpotQA, TriviaQA), and up to 98.8% on long-context Named Entity Recognition (GONERD), while decreasing inference times by up to 57.8%. We find that, for most models on most tasks, performing knowledge distillation is an effective method to yield high-performing efficient attention models with low costs.