Prompt-prompted Adaptive Structured Pruning for Efficient LLM Generation

📄 arXiv: 2404.01365v3 📥 PDF

作者: Harry Dong, Beidi Chen, Yuejie Chi

分类: cs.LG, cs.AI, cs.CL

发布日期: 2024-04-01 (更新: 2024-08-11)

备注: Revision 1: Updated abstract with code link; re-ran top-k + sampling rows in Table 4, conclusions unchanged Revision 2: Reframing and new experiments, conclusions unchanged

🔗 代码/项目: GITHUB


💡 一句话要点

提出GRIFFIN以解决大语言模型生成中的计算效率问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大语言模型 前馈剪枝 计算效率 激活模式 自然语言处理

📋 核心要点

  1. 现有的剪枝或专家混合方法在实际应用中往往成本高且灵活性差,限制了其广泛使用。
  2. GRIFFIN通过序列级别选择前馈专家,避免了训练和校准的需求,利用了LLMs的激活模式特性。
  3. 实验结果表明,GRIFFIN在减少前馈参数的同时,保持了模型性能并显著提升了生成速度。

📝 摘要(中文)

随着基于变换器的大语言模型(LLMs)的发展,它们因其显著的实用性而被广泛应用,但在部署时却面临着巨大的计算成本。为此,本文提出了一种名为GRIFFIN的新方法,该方法无需训练和校准,通过在序列级别选择独特的前馈专家来实现高效生成。我们观察到许多训练好的LLMs在序列中自然产生高度结构化的前馈激活模式,这一现象被称为“聚群”。尽管方法简单,GRIFFIN在保留50%前馈参数的情况下,仍能在多种分类和生成任务上保持原模型性能,且显著提高了延迟,具体在Gemma 7B和Llama 2 13B上分别实现了1.29倍和1.25倍的速度提升。

🔬 方法详解

问题定义:本文旨在解决大语言模型在生成任务中面临的高计算成本问题。现有的剪枝和专家混合方法往往需要额外的训练,且在不同架构上应用受限,导致灵活性不足。

核心思路:GRIFFIN的核心思路是利用训练好的LLMs在序列中自然产生的高度结构化的前馈激活模式,选择适当的前馈专家以实现高效生成,而无需进行额外的训练或校准。

技术框架:GRIFFIN的整体架构包括数据输入、前馈专家选择和生成输出三个主要模块。首先,输入序列被处理以识别激活模式,然后根据这些模式选择最优的前馈专家,最后生成输出。

关键创新:GRIFFIN的最大创新在于其训练自由和校准自由的特性,能够在多种LLM架构中灵活应用,显著提高计算效率。这与传统方法的依赖训练和特定架构形成了鲜明对比。

关键设计:在设计上,GRIFFIN通过分析激活模式的聚群特性,确定前馈专家的选择策略,确保在减少参数的同时不损失性能。具体的参数设置和选择策略在实验中经过验证,确保了方法的有效性。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,GRIFFIN在保留50%前馈参数的情况下,仍能保持原模型的性能,且在Gemma 7B和Llama 2 13B上分别实现了1.29倍和1.25倍的速度提升,显著提高了生成效率。

🎯 应用场景

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.