arXiv:2510.00133cs.LG2025-10

用脉冲神经网络实现Transformer推理,提升能效并保持精度。

Large Language Models Inference Engines based on Spiking Neural Networks

  • 将自注意力机制替换为脉冲版自注意力(SSA),结合微调优化性能。
  • 转换后的小模型在相似度上损失5-12%,困惑度降低9.7%。
  • 脉冲块比传统块节能64.71%-85.28%,适合低功耗部署场景。

基于Transformer的通用语言模型是当前最先进的模型,广泛应用于材料科学、气候等领域。但其训练与部署计算成本高,时间与空间复杂度随输入序列长度呈平方关系。现有高效计算范式和模型架构研究有限。本文探索使用脉冲神经网络(SNN)构建Transformer模型。现有脉冲神经网络训练方法效率低,而模型转换方法难以扩展,因达到最优性能需大量脉冲时步,导致延迟上升。为此,提出NeurTransformer方法:通过监督微调,将预训练Transformer的自注意力模块替换为脉冲自注意力(SSA),再转换前馈模块为等效SNN,并对SSA模块进行基于SNN代理学习的微调。在三类不同规模的GPT-2模型上验证,结果表明转换后的模型在余弦相似度上损失5-12%,困惑度下降9.7%。同时,在数字硬件上实现的脉冲自注意力块相比传统块,能效提升显著,能量消耗减少64.71%至85.28%。

原文摘要 · Abstract (English)

Foundational models based on the transformer architecture are currently the state-of-the-art in general language modeling, as well as in scientific areas such as material science and climate. However, training and deploying these models is computationally challenging as the time and space complexity has a quadratic relation to the input sequence length. Several efforts exploring efficient computational paradigms and model architectures to address these limitations have been made. In this work, we explore spiking neural networks (SNNs) to design transformer models. A challenge in training large-scale SNNs, using existing surrogate learning methods is inefficient and time-consuming. On the other hand, techniques to convert existing transformer-based models to their SNN equivalent are not scalable, as achieving optimal performance comes at the cost of a large number of spike time-steps, i.e. increased latency. To address this, we propose NeurTransformer, a methodology for designing transformer-based SNN for inference using a supervised fine-tuning approach with existing conversion methods. The proposed methodology works by: (1) replacing the self-attention mechanism with a spike-based self-attention (SSA), (2) converting the feed-forward block of the trained transformer model to its equivalent SNN, and (3) fine-tuning the SSA block using SNN-based surrogate learning algorithms. We benchmark the proposed methodology and demonstrate its accuracy and scalability using three variants of the GPT-2 model of increasing model size. We observe that the converted GPT-2 small models demonstrate a 5-12% loss in cosine similarity and a 9.7% reduction in perplexity. Finally, we demonstrate the energy efficiency of the SSA block compared to the ASA block and show between 64.71% and 85.28% reductions in estimated energy consumption when implementing the self-attention mechanism on a digital hardware.

脉冲神经网络Transformer能效优化模型转换

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