Large Language Models Inference Engines based on Spiking Neural Networks
Balaji, Madireddy, Balaprakash
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 아키텍처 기반의 기초 모델은 범용 언어 모델링 및 재료 과학, 기후 과학 등 과학 분야에서 현재 최첨단 기술이다. 그러나 이러한 모델의 훈련과 배포는 입력 시퀀스 길이에 대해 이차 시간 및 공간 복잡도를 가지므로 계산상 매우 도전적이다. 본 논문은 스파이킹 신경망(SNN)을 사용하여 Transformer 모델을 설계하는 방법을 탐색한다. 기존의 대리 학습 방법은 대규모 SNN 훈련이 비효율적이고 시간이 많이 걸리며, 기존 Transformer 모델을 동등한 SNN으로 변환하는 기술은 확장성이 부족하다. 이를 위해 저자들은 기존 변환 방법과 감독 미세조정을 결합하여 SNN 기반 Transformer 추론 엔진을 설계하는 NeuTransformer 방법을 제안한다. 이 방법은 다음을 포함한다: (1) 자기주의 메커니즘을 스파이킹 기반 자기주의(SSA)로 교체, (2) 피드포워드 블록을 동등한 SNN으로 변환, (3) SNN 대리 학습 알고리즘을 사용하여 SSA 블록 미세조정. 실험 결과, 변환된 GPT-2 소형 모델은 코사인 유사도에서 5-12% 손실, 혼란도 9.7% 감소, SSA 블록이 ASA 블록 대비 64.71%-85.28% 에너지 소비 감소를 달성했다.
저자들은 스파이킹 신경망의 생물학적 영감을 받은 특성과 이벤트 기반 계산의 장점을 활용하여 신경형태 하드웨어에서 효율적으로 실행될 수 있는 Transformer 모델을 설계하고자 한다. 이를 통해 데이터 효율적이고 에너지 소비가 적으며 자원 절약적인 대규모 언어모델 추론을 실현하는 것을 목표로 한다.
SNN 변환 방법의 고전 연구 (Rueckauer et al., 2016; Diehl & Cook, 2015)
최근 SNN 기반 Transformer 연구 (Li et al., 2024; Zhou et al., 2023)
대리 기울기 학습 방법 (Eshraghian et al., 2023)
요약: 본 논문은 대규모 언어모델을 스파이킹 신경망 버전으로 변환하는 혁신적인 방법을 제안하며, 수용 가능한 성능을 유지하면서 상당한 에너지 소비 감소를 달성한다. 규모 제한 등의 문제가 있음에도 불구하고, 저전력 AI 추론 및 신경형태 컴퓨팅 분야에 가치 있는 기술 기여를 제공한다.