随着对深度学习民主化的向往,在资源约束设备上实施基于变压器的自然语言处理(NLP)模型的需求越来越大,以实施低延迟和高准确性。现有的BERT修剪方法要求域专家启发手工制作超参数,以在模型大小,延迟和准确性之间取得平衡。在这项工作中,我们提出了AE-Bert,这是一种具有有效评估的自动和高效的BERT修剪框架,以选择“良好”子网络候选(高精度),鉴于整体修剪比率的约束。我们提出的方法不需要人类专家的经验,并且可以在许多NLP任务上取得更好的准确性能。我们关于一般语言理解评估(胶水)基准的实验结果表明,AE-Bert优于Bert $ _ {\ Mathrm {base}} $的最先进的(SOTA)手工制作的修剪方法。在QNLI和RTE上,我们获得75 \%和42.8%的总体修剪比,同时获得更高的精度。在MRPC上,我们的得分比SOTA高4.6,在相同的整体修剪比为0.5。在STS-B上,与SOTA手工制作的修剪方法相比,我们可以达到40 \%的修剪比,而Spearman相关性的损失非常小。实验结果还表明,在模型压缩之后,单个bert $ _ {\ mathrm {base}} $ coder的推理时间在xilinx alveo u200 fpga板上具有1.83 $ \ times $ speedup,与intel(r)xeon相比)Gold 5218(2.30GHz)CPU,它显示了部署BERT $ _ {\ MATHRM {base}} $模型在计算限制设备上生成的方法生成的子网的合理性。
translated by 谷歌翻译
基于变压器的语言模型应用于自然语言处理的广泛应用程序。但是,它们效率低,难以部署。近年来,已经提出了许多压缩算法来提高目标硬件上大型变压器的模型的实现效率。在这项工作中,我们通过整合体重修剪和模型蒸馏来提出一种训练稀疏预训练的变压器语言模型的新方法。这些稀疏的预训练型号可用于在维护稀疏模式的同时传输广泛的任务。我们展示了我们有三个已知的架构的方法,以创建稀疏的预训练伯特基,BERT-MAT​​RY和DISTOLBERT。我们展示了压缩稀疏的预训练模型如何培训他们的知识,以最小的精度损失将他们的知识转移到五种不同的下游自然语言任务。此外,我们展示了如何使用量化感知培训进一步将稀疏模型的重量压缩为8位精度。例如,在SQUAdv1.1上使用我们稀疏预训练的BERT频率,并量化为8位,我们为编码器达到40美元的压缩比,而不是1 \%$精度损失。据我们所知,我们的结果表明Bert-Base,Bert-Light和Distilbert的最佳压缩至准确率。
translated by 谷歌翻译
AD相关建模在包括Microsoft Bing在内的在线广告系统中起着至关重要的作用。为了利用强大的变压器在这种低延迟设置中,许多现有方法脱机执行广告端计算。虽然有效,但这些方法无法提供冷启动广告,从而导致对此类广告的相关性预测不佳。这项工作旨在通过结构化修剪设计一种新的低延迟BERT,以在CPU平台上授权实时在线推断对Cold Start Ads相关性。我们的挑战是,以前的方法通常将变压器的所有层都缩减为高,均匀的稀疏性,从而产生无法以可接受的精度实现令人满意的推理速度的模型。在本文中,我们提出了SwiftPruner - 一个有效的框架,利用基于进化的搜索自动在所需的延迟约束下自动找到表现最佳的稀疏BERT模型。与进行随机突变的现有进化算法不同,我们提出了一个具有潜伏意见的多目标奖励的增强突变器,以进行更好的突变,以有效地搜索层稀疏模型的大空间。广泛的实验表明,与均匀的稀疏基线和最先进的搜索方法相比,我们的方法始终达到更高的ROC AUC和更低的潜伏度。值得注意的是,根据我们在1900年的延迟需求,SwiftPruner的AUC比Bert-Mini在大型现实世界数据集中的最先进的稀疏基线高0.86%。在线A/B测试表明,我们的模型还达到了有缺陷的冷启动广告的比例,并获得了令人满意的实时服务延迟。
translated by 谷歌翻译
在深度学习中,变压器一直是必不可少的主食。但是,对于现实生活中的应用程序,由于模型的巨大参数和操作,部署有效的变压器非常具有挑战性。为了减轻这种负担,利用稀疏是加速变压器的有效方法。新出现的Ampere GPU利用2:4的稀疏模式来实现模型加速度,而在部署模型时,它几乎无法满足各种算法和硬件约束。相比之下,我们提出了一个算法 - 铁软件合作的框架,以灵活有效地加速变压器,通过使用一般的N:M稀疏模式。 (1)从算法的角度来看,我们提出了一种稀疏性遗传机制以及一种遗传的动态修剪(IDP)方法,以迅速获得一系列N:M稀疏候选变压器。进一步提出了模型压缩方案,以显着减少部署的存储需求。 (2)从硬件的角度来看,我们提出了一种灵活,有效的硬件体系结构,即STA,以在部署N:M稀疏变压器时达到显着加速。 STA不仅具有具有较高计算效率的稀疏密度和致密矩阵乘法的计算引擎,而且还具有可扩展的软模块,从而消除了中级外芯片外数据通信的延迟。实验结果表明,与其他使用IDP生成的其他方法相比,n:m稀疏变压器的准确性平均提高了6.7%。此外,与Intel I9-9900X和NVIDIA RTX 2080 TI相比,STA可以达到14.47倍和11.33倍的速度,并且比最先进的基于FPGA的加速器对变形金刚的最先进的推断速度可以快2.00-19.47倍。
translated by 谷歌翻译
With the development of deep learning and Transformer-based pre-trained models like BERT, the accuracy of many NLP tasks has been dramatically improved. However, the large number of parameters and computations also pose challenges for their deployment. For instance, using BERT can improve the predictions in the financial sentiment analysis (FSA) task but slow it down, where speed and accuracy are equally important in terms of profits. To address these issues, we first propose an efficient and lightweight BERT (ELBERT) along with a novel confidence-window-based (CWB) early exit mechanism. Based on ELBERT, an innovative method to accelerate text processing on the GPU platform is developed, solving the difficult problem of making the early exit mechanism work more effectively with a large input batch size. Afterward, a fast and high-accuracy FSA system is built. Experimental results show that the proposed CWB early exit mechanism achieves significantly higher accuracy than existing early exit methods on BERT under the same computation cost. By using this acceleration method, our FSA system can boost the processing speed by nearly 40 times to over 1000 texts per second with sufficient accuracy, which is nearly twice as fast as FastBERT, thus providing a more powerful text processing capability for modern trading systems.
translated by 谷歌翻译
在本文中,我们提出了一种新型可调微调方法,可提高BERT模型对下游任务的训练和推理时间。在所提出的方法中,我们首先通过我们提出的冗余度量检测每层中的更重要的单词向量,然后通过我们提出的策略消除不太重要的单词向量。在我们的方法中,每层中的字矢量消除速率由倾斜速率超参数控制,并且模型学会使用比原始BERT \ TextSubscript {Base}相当较低数量的浮点操作(闪光)。模型。我们所提出的方法不需要任何额外的训练步骤,并且它也可以推广到其他基于变压器的模型。我们执行广泛的实验,显示较高层中的字矢量具有令人印象深刻的冗余,可以消除和减少训练和推理时间。实验结果对广泛情绪分析,分类和回归数据集,以及IMDB和胶水等基准表明我们的提出方法在各种数据集中有效。通过在BERT \ TextSubscript {Base}模型上应用我们的方法,我们平均将推理时间降低5.3倍的5.3倍,平均精度降低。在微调阶段之后,可以使用我们的方法脱机调整属性调整模型的推理时间,以获得各种倾斜率值选择。此外,我们提出了一种数学加速分析,可以准确估计我们方法的加速。在此分析的帮助下,可以在微调或离线调谐阶段之前选择倾斜速率超参数。
translated by 谷歌翻译
基于变压器的NLP模型是使用数亿甚至数十亿个参数训练的,从而限制了其在计算受限环境中的适用性。尽管参数的数量通常与性能相关,但尚不清楚下游任务是否需要整个网络。在最新的修剪和提炼预培训模型的工作中,我们探索了在预训练模型中放下层的策略,并观察修剪对下游胶水任务的影响。我们能够修剪Bert,Roberta和XLNet型号高达40%,同时保持其原始性能的98%。此外,我们证明,在大小和性能方面,您的修剪模型与使用知识蒸馏的型号相提并论。我们的实验产生有趣的观察结果,例如(i)下层对于维持下游任务性能最重要,(ii)某些任务(例如释义检测和句子相似性)对于降低层的降低和(iii)经过训练的模型更强大。使用不同的目标函数表现出不同的学习模式,并且层掉落。
translated by 谷歌翻译
We revisit the performance of the classic gradual magnitude pruning (GMP) baseline for large language models, focusing on the classic BERT benchmark on various popular tasks. Despite existing evidence in the literature that GMP performs poorly, we show that a simple and general variant, which we call GMP*, can match and sometimes outperform more complex state-of-the-art methods. Our results provide a simple yet strong baseline for future work, highlight the importance of parameter tuning for baselines, and even improve the performance of the state-of-the-art second-order pruning method in this setting.
translated by 谷歌翻译
深度学习技术在各种任务中都表现出了出色的有效性,并且深度学习具有推进多种应用程序(包括在边缘计算中)的潜力,其中将深层模型部署在边缘设备上,以实现即时的数据处理和响应。一个关键的挑战是,虽然深层模型的应用通常会产生大量的内存和计算成本,但Edge设备通常只提供非常有限的存储和计算功能,这些功能可能会在各个设备之间差异很大。这些特征使得难以构建深度学习解决方案,以释放边缘设备的潜力,同时遵守其约束。应对这一挑战的一种有希望的方法是自动化有效的深度学习模型的设计,这些模型轻巧,仅需少量存储,并且仅产生低计算开销。该调查提供了针对边缘计算的深度学习模型设计自动化技术的全面覆盖。它提供了关键指标的概述和比较,这些指标通常用于量化模型在有效性,轻度和计算成本方面的水平。然后,该调查涵盖了深层设计自动化技术的三类最新技术:自动化神经体系结构搜索,自动化模型压缩以及联合自动化设计和压缩。最后,调查涵盖了未来研究的开放问题和方向。
translated by 谷歌翻译
近年来,大型预训练的变压器网络已显示出许多自然语言理解任务的巨大改进。但是,由于延迟和成本限制,这些模型的巨大规模给他们的微调和在线部署带来了重大挑战。支持N:M半结构化的稀疏性和低精油整数计算的新硬件是提高DNN模型效率的有前途解决方案。但是,很少有研究系统地研究预先训练的变压器网络在多大程度上受益于这些技术的组合,以及如何最好地压缩变压器的每个组件。我们提出了一个灵活的压缩框架NXMiformer,该框架使用ADMM和基于Ste的QAT执行同时进行稀疏和量化。此外,我们介绍且廉价的启发式驱动搜索算法,该算法标识了满足压缩比约束的有希望的异质压缩配置。当通过NLU基准测试的胶水套件进行评估时,我们的方法可以达到BERT模型编码器的93%压缩,同时保留了98.2%的原始模型准确性并充分利用硬件功能。异质配置通过搜索启发式发现了基线准确性的99.5%,同时仍将模型压缩为87.5%。
translated by 谷歌翻译
Model compression is a critical technique to efficiently deploy neural network models on mobile devices which have limited computation resources and tight power budgets. Conventional model compression techniques rely on hand-crafted heuristics and rule-based policies that require domain experts to explore the large design space trading off among model size, speed, and accuracy, which is usually sub-optimal and time-consuming. In this paper, we propose AutoML for Model Compression (AMC) which leverage reinforcement learning to provide the model compression policy. This learning-based compression policy outperforms conventional rule-based compression policy by having higher compression ratio, better preserving the accuracy and freeing human labor. Under 4× FLOPs reduction, we achieved 2.7% better accuracy than the handcrafted model compression policy for VGG-16 on ImageNet. We applied this automated, push-the-button compression pipeline to MobileNet and achieved 1.81× speedup of measured inference latency on an Android phone and 1.43× speedup on the Titan XP GPU, with only 0.1% loss of ImageNet Top-1 accuracy.
translated by 谷歌翻译
Despite achieving state-of-the-art performance on many NLP tasks, the high energy cost and long inference delay prevent Transformer-based pretrained language models (PLMs) from seeing broader adoption including for edge and mobile computing. Efficient NLP research aims to comprehensively consider computation, time and carbon emission for the entire life-cycle of NLP, including data preparation, model training and inference. In this survey, we focus on the inference stage and review the current state of model compression and acceleration for pretrained language models, including benchmarks, metrics and methodology.
translated by 谷歌翻译
Language model pre-training, such as BERT, has significantly improved the performances of many natural language processing tasks. However, pre-trained language models are usually computationally expensive, so it is difficult to efficiently execute them on resourcerestricted devices. To accelerate inference and reduce model size while maintaining accuracy, we first propose a novel Transformer distillation method that is specially designed for knowledge distillation (KD) of the Transformer-based models. By leveraging this new KD method, the plenty of knowledge encoded in a large "teacher" BERT can be effectively transferred to a small "student" Tiny-BERT. Then, we introduce a new two-stage learning framework for TinyBERT, which performs Transformer distillation at both the pretraining and task-specific learning stages. This framework ensures that TinyBERT can capture the general-domain as well as the task-specific knowledge in BERT. TinyBERT 41 with 4 layers is empirically effective and achieves more than 96.8% the performance of its teacher BERT BASE on GLUE benchmark, while being 7.5x smaller and 9.4x faster on inference. TinyBERT 4 is also significantly better than 4-layer state-of-the-art baselines on BERT distillation, with only ∼28% parameters and ∼31% inference time of them. Moreover, TinyBERT 6 with 6 layers performs on-par with its teacher BERT BASE .
translated by 谷歌翻译
重量修剪是一种有效的模型压缩技术,可以解决在移动设备上实现实时深神经网络(DNN)推断的挑战。然而,由于精度劣化,难以利用硬件加速度,以及某些类型的DNN层的限制,难以降低的应用方案具有有限的应用方案。在本文中,我们提出了一般的细粒度的结构化修剪方案和相应的编译器优化,适用于任何类型的DNN层,同时实现高精度和硬件推理性能。随着使用我们的编译器优化所支持的不同层的灵活性,我们进一步探讨了确定最佳修剪方案的新问题,了解各种修剪方案的不同加速度和精度性能。两个修剪方案映射方法,一个是基于搜索,另一个是基于规则的,建议自动推导出任何给定DNN的每层的最佳修剪规则和块大小。实验结果表明,我们的修剪方案映射方法,以及一般细粒化结构修剪方案,优于最先进的DNN优化框架,最高可达2.48 $ \ times $和1.73 $ \ times $ DNN推理加速在CiFar-10和Imagenet DataSet上没有准确性损失。
translated by 谷歌翻译
预先接受的语言模型(PLMS)在预训练和微调范式下,在各种自然语言处理(NLP)任务中取得了巨大成功。具有大量参数,PLMS是计算密集型和资源饥饿的。因此,已经引入了模型修剪来压缩大规模的PLM。然而,大多数先前的方法只考虑对下游任务的任务特定知识,但忽略了修剪期间的基本任务无关知识,这可能导致灾难性的遗忘问题并导致普遍性较差。为了在我们的修剪模型中维护任务不可行的特定知识,我们提出了在预训练和微调范式下的对比修剪(盖子)。它设计为一​​般框架,与结构化和非结构化修剪兼容。统一的对比学习,CAP使修剪模型能够从预训练的模型中学到任务无关的知识,以及特定于任务知识的微调模型。此外,为了更好地保留修剪模型的性能,快照(即,每个修剪迭代的中间模型)也是修剪的有效监督。我们广泛的实验表明,采用盖子一致地产生显着的改善,特别是在极高的稀疏性方案中。只有3%的型号参数保留(即97%的稀疏性),CAP成功达到了QQP和MNLI任务的原始BERT性能的99.2%和96.3%。此外,我们的探测实验表明,CAP修剪的模型趋于达到更好的泛化能力。
translated by 谷歌翻译
诸如BERT的预先接受的语言模型在各种自然语言处理任务中显示出显着的效果。但是,这些模型通常包含数百万个参数,这可以防止它们在资源受限设备上实际部署。已知知识蒸馏,重量修剪和量化是模型压缩中的主要方向。然而,通过知识蒸馏获得的紧凑型模型即使对于相对小的压缩比也可能遭受显着的精度下降。另一方面,只有少数量化尝试专门用于自然语言处理任务。它们患有小的压缩比或较大的错误率,因为需要对超参数的手动设置,并且不支持微粒子组 - 方向量化。在本文中,我们提出了一种自动混合精密量化框架,设计用于伯特,其可以同时在亚组 - 明智的水平中进行量化和修剪。具体而言,我们所提出的方法利用可微分的神经结构搜索,搜索自动地分配每个子组中的参数的比例和精度,同时捕获冗余参数组。对BERT下游任务的广泛评估揭示了我们所提出的方法通过提供相同的模型尺寸来实现相同的性能。我们还通过将我们的解决方案与Ottherbert等正交方法相结合来展示获得极其轻量级模型的可行性。
translated by 谷歌翻译
针对变压器的神经体系结构搜索(NAS)已用于创建针对某些延迟约束的最新模型。在这项工作中,我们提出了更大,更快的速度,这是一种新颖的量化参数共享NAS,它为8位整数(INT8)量化变压器的架构。我们的结果表明,我们的方法能够产生胜过当前最新技术的BERT模型,即Autotinybert,我们测试了所有潜伏期目标,达到了2.68%的准确性增益。此外,尽管我们技术发现的模型的参数数量比float32的参数数量更大,但由于其参数为INT8,但它们的内存足迹大大较小。
translated by 谷歌翻译
近年来,在自然语言处理中的伯特等变压器模型越来越多地采用了越来越多的采用,甚至在计算机视觉中。然而,由于大小,在资源受限的计算环境中,在资源受限的计算环境中采用了有限的采用本文提出了通过消除冗余注意头来压缩变压器模型的新颖修剪算法。我们应用A *搜索算法,以获得最小精度保证的修剪模型。我们的结果表明,该方法可以消除BERT变压器模型中的40%的注意力头,几乎没有精确损失。
translated by 谷歌翻译
Pre-trained language models achieve superior performance, but they are computationally expensive due to their large size. Techniques such as pruning and knowledge distillation (KD) have been developed to reduce their size and latency. In most structural pruning methods, the pruning units, such as attention heads and feed-forward hidden dimensions, only span a small model structure space and limit the structures that the pruning algorithm can explore. In this work, we propose Gradient-based Intra-attention pruning (GRAIN), which inspects fine intra-attention structures, and allows different heads to have different sizes. Intra-attention pruning greatly expands the searching space of model structures and yields highly heterogeneous structures. We further propose structure regularization to encourage generating more regular structures, which achieves higher speedups than heterogeneous ones. We also integrate KD into the pruning process with a gradient separation strategy to reduce the interference of KD with the pruning process. GRAIN is evaluated on a variety of tasks. Results show that it notably outperforms other methods at the same or similar model size. Even under extreme compression where only $3\%$ weights in transformers remain, the pruned model is still competitive.
translated by 谷歌翻译
Limited computational budgets often prevent transformers from being used in production and from having their high accuracy utilized. A knowledge distillation approach addresses the computational efficiency by self-distilling BERT into a smaller transformer representation having fewer layers and smaller internal embedding. However, the performance of these models drops as we reduce the number of layers, notably in advanced NLP tasks such as span question answering. In addition, a separate model must be trained for each inference scenario with its distinct computational budget. Dynamic-TinyBERT tackles both limitations by partially implementing the Length Adaptive Transformer (LAT) technique onto TinyBERT, achieving x3 speedup over BERT-base with minimal accuracy loss. In this work, we expand the Dynamic-TinyBERT approach to generate a much more highly efficient model. We use MiniLM distillation jointly with the LAT method, and we further enhance the efficiency by applying low-bit quantization. Our quantized length-adaptive MiniLM model (QuaLA-MiniLM) is trained only once, dynamically fits any inference scenario, and achieves an accuracy-efficiency trade-off superior to any other efficient approaches per any computational budget on the SQuAD1.1 dataset (up to x8.8 speedup with <1% accuracy loss). The code to reproduce this work is publicly available on Github.
translated by 谷歌翻译