arXiv:2410.18311cs.LGcs.CL2024-10被引 16

通过语义预测核心神经元,实现大模型推理零开销加速

CoreInfer: Accelerating Large Language Model Inference with Semantics-Inspired Adaptive Sparse Activation

  • 基于句子级语义预测核心神经元,无需额外MLP
  • 在TITAN XP上比Huggingface快10.33倍,比PowerInfer快2.72倍
  • 适合资源受限设备部署,支持多模型多任务通用性

参数达数十亿的大语言模型(LLMs)推动了诸多新AI应用的发展,但其推理阶段的高计算成本和内存需求带来显著挑战。自适应稀疏激活推理通过仅激活少量神经元来加速推理,且不降低性能,对资源受限设备极具潜力。然而,现有方法依赖额外MLP对单个词元预测激活神经元,导致激活图频繁变化与资源调用,限制了加速效果。本文提出CoreInfer,一种无MLP的句级自适应稀疏激活方法。我们引入‘句子级核心神经元’概念,实证其对句子的关键性,并发现核心神经元与语义具有稳定性和相似性——此洞察此前被忽视。据此设计两种基于语义的预测方法以适配不同输入场景。在预填充阶段确定核心神经元并固定于编码阶段,实现零开销稀疏推理。在多种模型与任务上验证了泛化能力,在NVIDIA TITAN XP GPU上相较Huggingface实现10.33倍加速,相较PowerInfer提升2.72倍。

原文摘要 · Abstract (English)

Large language models (LLMs) with billions of parameters have sparked a new wave of exciting AI applications. However, their high computational costs and memory demands during inference pose significant challenges. Adaptive sparse activation inference, which activates only a small number of neurons for each token, offers a novel way to accelerate model inference without degrading performance, showing great potential for resource-constrained hardware devices. Nevertheless, existing methods predict activated neurons based on individual tokens with additional MLP, which involve frequent changes in activation maps and resource calls, limiting the acceleration benefits of sparse activation. In this paper, we introduce CoreInfer, an MLP-free adaptive sparse activation inference method based on sentence-level prediction. Specifically, we propose the concept of sentence-wise core neurons, which refers to the subset of neurons most critical for a given sentence, and empirically demonstrate its effectiveness. To determine the core neurons, we explore the correlation between core neurons and the sentence's semantics. Remarkably, we discovered that core neurons exhibit both stability and similarity in relation to the sentence's semantics -- an insight overlooked by previous studies. Building on this finding, we further design two semantic-based methods for predicting core neurons to fit different input scenarios. In CoreInfer, the core neurons are determined during the pre-filling stage and fixed during the encoding stage, enabling zero-cost sparse inference. We evaluated the model generalization and task generalization of CoreInfer across various models and tasks. Notably, on an NVIDIA TITAN XP GPU, CoreInfer achieved a 10.33 times and 2.72 times speedup compared to the Huggingface implementation and PowerInfer, respectively.

大模型推理稀疏激活语义预测加速

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。