通过早退出与二值化结合,实现快速高效文本推理。
BEExformer: A Fast Inferencing Binarized Transformer with Early Exits
- 引入可感知二值化的训练机制,保留权重符号与幅度信息。
- 早退出减少52.27%计算量,准确率反而提升3.22%。
- 适合资源受限场景下的高速文本生成与推理任务。
基于Transformer的大语言模型在各类应用中表现卓越,但其庞大的规模和计算需求限制了在资源受限设备上的部署。为提升效率,二值化与早退出(EE)被证明是有效方案。然而,二值化可能因精度降低影响梯度估计与参数更新,而早退出机制仍处于研究初期。为此,我们提出首个融合二值化感知训练(BAT)与早退出的分层选择性学习型Transformer——BEExformer。每个Transformer模块内嵌选择性遗忘网络(SLFN),增强上下文保留并剔除无关信息。BAT采用对符号函数的可微二阶近似,实现梯度计算,捕获权重的符号与幅度,使模型尺寸缩小21.30倍。早退出机制基于中间层熵的分数级下降,结合软路由损失估计,使推理FLOPs降低52.27%,并解决深层网络“过度思考”问题,准确率反提升3.22%。在涵盖九个数据集、多个NLP任务的大量对比实验与消融分析中,BEExformer展现出帕累托最优的性能-效率平衡。
原文摘要 · Abstract (English)
Large Language Models (LLMs) based on transformers achieve cutting-edge results on a variety of applications. However, their enormous size and processing requirements hinder deployment on constrained resources. To enhance efficiency, binarization and Early Exit (EE) have proved to be effective solutions. However, binarization may lead to performance loss as reduced precision affects gradient estimation and parameter updates. Besides, research on EE mechanisms is still in its early stages. To address these challenges, we introduce Binarized Early Exit Transformer (BEExformer), a first-of-its-kind selective learning-based transformer integrating Binarization-Aware Training (BAT) with EE for efficient and fast textual inference. Each transformer block has an integrated Selective-Learn Forget Network (SLFN) to enhance contextual retention while eliminating irrelevant information. The BAT employs a differentiable second-order approximation to the sign function, enabling gradient computation that captures both the sign and magnitude of the weights. This aids in 21.30 times reduction in model size. The EE mechanism hinges on fractional reduction in entropy among intermediate transformer blocks with soft-routing loss estimation. This accelerates inference by reducing FLOPs by 52.27% and even improves accuracy by 3.22% by resolving the "overthinking" problem inherent in deep networks. Extensive evaluation through comparison with the SOTA methods and various ablations across nine datasets covering multiple NLP tasks demonstrates its Pareto-optimal performance-efficiency trade-off.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。