ShiftAddLLM: 사전 학습된 대형 언어 모델의 곱셈 연산 제거 재매개변수를 통한 가속화
ShiftAddLLM: Accelerating Pretrained LLMs via Post-Training Multiplication-Less Reparameterization
June 10, 2024
저자: Haoran You, Yipin Guo, Yichao Fu, Wei Zhou, Huihong Shi, Xiaofan Zhang, Souvik Kundu, Amir Yazdanbakhsh, Yingyan Lin
cs.AI
초록
대규모 언어 모델(LLMs)은 언어 작업에서 인상적인 성능을 보여주지만, 방대한 파라미터와 밀집된 곱셈 연산에 의존하기 때문에 자원이 제한된 장치에 배포할 때 높은 메모리 요구량과 지연 시간 병목 현상이라는 문제에 직면합니다. 시프트-앤-애드 재파라미터화는 LLM의 어텐션 및 다층 퍼셉트론(MLP) 레이어에서 비용이 많이 드는 곱셈 연산을 하드웨어 친화적인 기본 연산으로 대체함으로써 유망한 해결책을 제공합니다. 그러나 현재의 재파라미터화 기술은 정확도를 복원하기 위해 처음부터 학습하거나 전체 파라미터 미세 조정이 필요하며, 이는 LLM에 대해 자원 집약적입니다. 이를 해결하기 위해, 우리는 사전 학습된 LLM을 사후 학습 시프트-앤-애드 재파라미터화를 통해 가속화하여 곱셈이 없는 효율적인 모델인 ShiftAddLLM을 제안합니다. 구체적으로, 각 가중치 행렬을 이진 행렬과 그룹별 스케일링 팩터로 양자화합니다. 관련된 곱셈 연산은 (1) 활성화와 스케일링 팩터 간의 시프트와 (2) 이진 행렬에 따른 쿼리 및 덧셈으로 재파라미터화됩니다. 정확도 손실을 줄이기 위해, 우리는 가중치와 출력 활성화 재파라미터화 오류를 모두 최소화하는 다목적 최적화 방법을 제시합니다. 또한, 레이어별로 재파라미터화에 대한 민감도가 다르다는 점을 바탕으로 메모리 사용량과 지연 시간을 더욱 줄이기 위한 자동화된 비트 할당 전략을 개발합니다. 다섯 가지 LLM 패밀리와 여덟 가지 작업에 대한 실험은 ShiftAddLLM의 효과를 일관되게 검증하며, 각각 3비트와 2비트에서 가장 경쟁력 있는 양자화된 LLM과 비교하여 동등하거나 더 낮은 지연 시간에서 평균 5.6 및 22.7 포인트의 perplexity 개선을 달성하고, 원본 LLM 대비 80% 이상의 메모리 및 에너지 감소를 보여줍니다. 코드와 모델은 https://github.com/GATECH-EIC/ShiftAddLLM에서 확인할 수 있습니다.
English
Large language models (LLMs) have shown impressive performance on language
tasks but face challenges when deployed on resource-constrained devices due to
their extensive parameters and reliance on dense multiplications, resulting in
high memory demands and latency bottlenecks. Shift-and-add reparameterization
offers a promising solution by replacing costly multiplications with
hardware-friendly primitives in both the attention and multi-layer perceptron
(MLP) layers of an LLM. However, current reparameterization techniques require
training from scratch or full parameter fine-tuning to restore accuracy, which
is resource-intensive for LLMs. To address this, we propose accelerating
pretrained LLMs through post-training shift-and-add reparameterization,
creating efficient multiplication-free models, dubbed ShiftAddLLM.
Specifically, we quantize each weight matrix into binary matrices paired with
group-wise scaling factors. The associated multiplications are reparameterized
into (1) shifts between activations and scaling factors and (2) queries and
adds according to the binary matrices. To reduce accuracy loss, we present a
multi-objective optimization method to minimize both weight and output
activation reparameterization errors. Additionally, based on varying
sensitivity across layers to reparameterization, we develop an automated bit
allocation strategy to further reduce memory usage and latency. Experiments on
five LLM families and eight tasks consistently validate the effectiveness of
ShiftAddLLM, achieving average perplexity improvements of 5.6 and 22.7 points
at comparable or lower latency compared to the most competitive quantized LLMs
at 3 and 2 bits, respectively, and more than 80% memory and energy reductions
over the original LLMs. Codes and models are available at
https://github.com/GATECH-EIC/ShiftAddLLM.Summary
AI-Generated Summary