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

Balcony:一种面向生成式语言模型动态推理的轻量级方法

Balcony: A Lightweight Approach to Dynamic Inference of Generative Language Models

University of Waterloo(滑铁卢大学)

Benyamin Jamialahmadi, Parsa Kavehzadeh, Mehdi Rezagholizadeh, Parsa Farinneya, Hossein Rajabzadeh, Aref Jafari, Boxing Chen, Marzieh S. Tahaei

AI总结:

Balcony 通过冻结预训练 LLM 并在退出点插入自蒸馏训练的额外 transformer 层,以极少的训练数据和参数实现深度动态推理,在保持性能的同时显著加速,并优于 Flextron、Layerskip 等现有方法。

摘要:

在现实应用中部署大语言模型(LLMs)常常受到严格的计算和延迟约束的阻碍。虽然动态推理提供了根据变化的资源预算调整模型行为的灵活性,但现有方法往往受限于硬件效率低下或性能下降。在本文中,我们引入了 Balcony,一个简单而高效的基于深度的动态推理框架。通过冻结预训练 LLM 并在选定的退出点插入额外的 transformer 层,Balcony 在保持完整模型性能的同时,能够实时适应不同的计算预算。这些额外层使用直接的自蒸馏损失进行训练,使子模型输出与完整模型的输出对齐。与先前方法相比,该方法所需的训练 token 和可调参数显著减少,大幅降低了计算成本。当应用于 LLaMA3-8B 模型时,仅使用原始预训练数据的 0.2%,Balcony 就实现了极小的性能下降,同时带来了显著的加速效果。值得注意的是,我们展示了 Balcony 在多个模型和各种规模上,在多种基准测试中优于 Flextron 和 Layerskip 等最先进方法以及其他领先的压缩技术。

英文摘要:

Deploying large language models (LLMs) in real-world applications is often hindered by strict computational and latency constraints. While dynamic inference offers the flexibility to adjust model behavior based on varying resource budgets, existing methods are frequently limited by hardware inefficiencies or performance degradation. In this paper, we introduce Balcony, a simple yet highly effective framework for depth-based dynamic inference. By freezing the pretrained LLM and inserting additional transformer layers at selected exit points, Balcony maintains the full model's performance while enabling real-time adaptation to different computational budgets. These additional layers are trained using a straightforward self-distillation loss, aligning the sub-model outputs with those of the full model. This approach requires significantly fewer training tokens and tunable parameters, drastically reducing computational costs compared to prior methods. When applied to the LLaMA3-8B model, using only 0.2% of the original pretraining data, Balcony achieves minimal performance degradation while enabling significant speedups. Remarkably, we show that Balcony outperforms state-of-the-art methods such as Flextron and Layerskip as well as other leading compression techniques on multiple models and at various scales, across a variety of benchmarks.

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

↑