让大模型推理更省力:动态跳过无用层,按令牌和模块智能裁剪
SkipGPT: Dynamic Layer Pruning Reinvented with Token Awareness and Module Decoupling
- 根据令牌重要性与模块功能差异,动态决定跳过哪些层
- 参数减少超40%后,性能仍持平或超越原模型
- 适合追求高效部署的大模型应用开发者
大型语言模型(LLMs)在各类任务上表现卓越,但其深层多层结构带来了巨大的计算开销。层剪枝作为缓解效率问题的策略,传统静态方法忽视了推理中的两大动态特性:(1) 横向动态——令牌级别的差异要求上下文感知的剪枝决策;(2) 纵向动态——MLP与自注意力层具有不同功能,需分别制定剪枝策略。本文提出SkipGPT,一种动态层剪枝框架,通过两项核心创新实现资源优化:(1) 全局令牌感知路由,优先保留关键令牌路径;(2) 对MLP与自注意力组件采用解耦剪枝策略。为缓解训练不稳定性,采用两阶段优化:先进行解耦训练,通过软参数化学习路由策略,避免过早剪枝;再使用参数高效的LoRA微调恢复因删层损失的性能。大量实验表明,SkipGPT在减少超过40%参数的同时,在多个基准测试中达到或超越原始密集模型的表现。通过协调动态效率与表达能力,该方法推动了可扩展、资源感知的LLM实际部署。代码已开源:https://github.com/EIT-NLP/SkipGPT。
原文摘要 · Abstract (English)
Large language models (LLMs) achieve remarkable performance across tasks but incur substantial computational costs due to their deep, multi-layered architectures. Layer pruning has emerged as a strategy to alleviate these inefficiencies, but conventional static pruning methods overlook two critical dynamics inherent to LLM inference: (1) horizontal dynamics, where token-level heterogeneity demands context-aware pruning decisions, and (2) vertical dynamics, where the distinct functional roles of MLP and self-attention layers necessitate component-specific pruning policies. We introduce SkipGPT, a dynamic layer pruning framework designed to optimize computational resource allocation through two core innovations: (1) global token-aware routing to prioritize critical tokens, and (2) decoupled pruning policies for MLP and self-attention components. To mitigate training instability, we propose a two-stage optimization paradigm: first, a disentangled training phase that learns routing strategies via soft parameterization to avoid premature pruning decisions, followed by parameter-efficient LoRA fine-tuning to restore performance impacted by layer removal. Extensive experiments demonstrate that SkipGPT reduces over 40% of model parameters while matching or exceeding the performance of the original dense model across benchmarks. By harmonizing dynamic efficiency with preserved expressivity, SkipGPT advances the practical deployment of scalable, resource-aware LLMs. Our code is publicly available at: https://github.com/EIT-NLP/SkipGPT.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。