arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.16710cs.CLcs.AIcs.LG
收藏

LayerSkip:实现提前退出推理与自推测解码

LayerSkip: Enabling Early Exit Inference and Self-Speculative Decoding

FAIR at Meta(Meta FAIR研究院);GenAI at Meta(Meta GenAI部门);Reality Labs at Meta(Meta Reality Labs);University of Toronto(多伦多大学);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);Dana-Farber Cancer Institute(丹娜法伯癌症研究院);Carnegie Mellon University(卡内基梅隆大学)
Mostafa Elhoushi, Akshat Shrivastava, Diana Liskovich, Basil Hosmer, Bram Wasti, Liangzhen Lai, Anas Mahmoud, Bilge Acun, Saurabh Agarwal, Ahmed Roman, Ahmed A … 展开作者

Mostafa Elhoushi, Akshat Shrivastava, Diana Liskovich, Basil Hosmer, Bram Wasti, Liangzhen Lai, Anas Mahmoud, Bilge Acun, Saurabh Agarwal, Ahmed Roman, Ahmed A Aly, Beidi Chen, Carole-Jean Wu

AI总结:

LayerSkip 通过训练时层级丢弃与提前退出损失,结合自推测解码,在不增加辅助模块的情况下实现大语言模型推理加速,并在多个任务上取得最高 2.16 倍加速。

摘要:

我们提出 LayerSkip,这是一种端到端解决方案,用于加速大语言模型(LLMs)的推理。首先,在训练期间我们应用层级丢弃(layer dropout),对较早层使用较低的丢弃率,对较晚层使用较高的丢弃率,并引入提前退出损失,其中所有 Transformer 层共享同一个退出。其次,在推理期间,我们表明这种训练方法提高了较早层提前退出的准确率,而无需向模型添加任何辅助层或模块。第三,我们提出一种新颖的自推测解码解决方案,在较早层退出,并利用模型的剩余层进行验证和纠正。我们提出的自推测解码方法相比其他推测解码方法具有更小的内存占用,并且受益于草稿阶段和验证阶段共享的计算和激活。我们在不同规模的 Llama 模型上进行了不同类型的训练实验:从头预训练、持续预训练、在特定数据领域上微调,以及在特定任务上微调。我们实现了推理解决方案,并展示了在 CNN/DM 文档摘要任务上最高 2.16 倍、在编码任务上 1.82 倍、在 TOPv2 语义解析任务上 2.0 倍的加速效果。我们在 https://github.com/facebookresearch/LayerSkip 开源了代码和检查点。

英文摘要:

We present LayerSkip, an end-to-end solution to speed-up inference of large language models (LLMs). First, during training we apply layer dropout, with low dropout rates for earlier layers and higher dropout rates for later layers, and an early exit loss where all transformer layers share the same exit. Second, during inference, we show that this training recipe increases the accuracy of early exit at earlier layers, without adding any auxiliary layers or modules to the model. Third, we present a novel self-speculative decoding solution where we exit at early layers and verify and correct with remaining layers of the model. Our proposed self-speculative decoding approach has less memory footprint than other speculative decoding approaches and benefits from shared compute and activations of the draft and verification stages. We run experiments on different Llama model sizes on different types of training: pretraining from scratch, continual pretraining, finetuning on specific data domain, and finetuning on specific task. We implement our inference solution and show speedups of up to 2.16x on summarization for CNN/DM documents, 1.82x on coding, and 2.0x on TOPv2 semantic parsing task. We open source our code and checkpoints at https://github.com/facebookresearch/LayerSkip.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑