arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.06954cs.CL
收藏

采用统一层跳过策略加速大语言模型推理

Accelerating Inference in Large Language Models with a Unified Layer Skipping Strategy

Pattern Recognition Center, WeChat AI, Tencent Inc(腾讯微信AI模式识别中心)

Yijin Liu, Fandong Meng, Jie Zhou

AI总结:

针对现有大语言模型动态层跳过方法加速不稳定、易致性能退化的问题,提出仅依目标加速比均衡跳过中间层的统一策略,兼容主流加速技术,在两项任务上实现更优推理性能与吞吐量。

摘要:

近年来,动态计算方法通过精巧的启发式规则或额外预测器跳过若干层计算,已在大语言模型(LLM)加速方面展现出显著效果。然而,现有方法的解码过程中,不同样本被分配不同的计算预算,无法保证稳定且精确的加速效果。此外,现有方法通常跳过模型底部或顶部的多个连续层,导致模型的层级表示发生剧烈变化,进而引发性能退化。为此,我们提出统一层跳过策略(Unified Layer Skipping strategy),该策略仅根据目标加速比确定需跳过的层数,随后以均衡的方式跳过对应数量的中间层计算。由于统一层跳过策略与输入样本无关,它天然支持批量解码、KV缓存等主流加速技术,因此在实际应用中更具实用性。在机器翻译、文本摘要两项常见任务上的实验结果表明,在给定目标加速比的情况下,统一层跳过策略相较于现有动态方法,能显著提升推理性能与实际模型吞吐量。

英文摘要:

Recently, dynamic computation methods have shown notable acceleration for Large Language Models (LLMs) by skipping several layers of computations through elaborate heuristics or additional predictors. However, in the decoding process of existing approaches, different samples are assigned different computational budgets, which cannot guarantee a stable and precise acceleration effect. Furthermore, existing approaches generally skip multiple contiguous layers at the bottom or top of the layers, leading to a drastic change in the model's layer-wise representations, and thus a consequent performance degeneration. Therefore, we propose a Unified Layer Skipping strategy, which selects the number of layers to skip computation based solely on the target speedup ratio, and then skips the corresponding number of intermediate layer computations in a balanced manner. Since the Unified Layer Skipping strategy is independent of input samples, it naturally supports popular acceleration techniques such as batch decoding and KV caching, thus demonstrating more practicality for real-world applications. Experimental results on two common tasks, i.e., machine translation and text summarization, indicate that given a target speedup ratio, the Unified Layer Skipping strategy significantly enhances both the inference performance and the actual model throughput over existing dynamic approaches.

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

↑