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

提示触发的自适应结构化剪枝,用于高效 LLM 生成

Prompt-prompted Adaptive Structured Pruning for Efficient LLM Generation

Carnegie Mellon University(卡内基梅隆大学);CMU(卡内基梅隆大学)

Harry Dong, Beidi Chen, Yuejie Chi

AI总结:

本文提出免训练、免校准的 GRIFFIN,通过利用序列内结构化 FF 激活模式自适应选择专家,在减半 FF 参数时保持 LLM 性能并降低生成延迟。

摘要:

随着基于 transformer 的大语言模型(LLM)的发展,它们凭借显著的实用性被应用于许多领域,但这也在部署时带来了相当高的计算成本。幸运的是,剪枝或构建混合专家(MoE)等方法旨在利用 transformer 前馈(FF)块中的稀疏性,以获得速度提升并降低内存需求。然而,这些技术在实践中可能成本高昂且缺乏灵活性,因为它们通常需要训练,或受限于特定类型的架构。为解决这一问题,我们提出 GRIFFIN,这是一种新颖的免训练且免校准的方法,可在序列层级选择独特的 FF 专家,从而在大量具有不同非 ReLU 激活函数的 LLM 中实现高效生成。这之所以可能,是因为一个关键观察:许多经过训练的 LLM 会在一个序列内自然产生高度结构化的 FF 激活模式,我们将其称为 flocking。尽管该方法十分简单,但我们表明,在仅保留 50% FF 参数的情况下,GRIFFIN 能在多种分类和生成任务上维持原始模型的性能,且退化很小甚至没有退化,同时还改善了延迟(例如,在 NVIDIA L40 上,Gemma 7B 和 Llama 2 13B 分别实现 1.29 倍和 1.25 倍的加速)。代码可在 https://github.com/hdong920/GRIFFIN 获取。

英文摘要:

With the development of transformer-based large language models (LLMs), they have been applied to many fields due to their remarkable utility, but this comes at a considerable computational cost at deployment. Fortunately, some methods such as pruning or constructing a mixture of experts (MoE) aim at exploiting sparsity in transformer feedforward (FF) blocks to gain boosts in speed and reduction in memory requirements. However, these techniques can be very costly and inflexible in practice, as they often require training or are restricted to specific types of architectures. To address this, we introduce GRIFFIN, a novel training-free and calibration-free method that selects unique FF experts at the sequence level for efficient generation across a plethora of LLMs with different non-ReLU activation functions. This is possible due to a critical observation that many trained LLMs naturally produce highly structured FF activation patterns within a sequence, which we call flocking. Despite our method's simplicity, we show with 50% of the FF parameters, GRIFFIN maintains the original model's performance with little to no degradation on a variety of classification and generation tasks, all while improving latency (e.g. 1.29$\times$ and 1.25$\times$ speed-ups in Gemma 7B and Llama 2 13B, respectively, on an NVIDIA L40). Code is available at https://github.com/hdong920/GRIFFIN.

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

↑