ChatPaper.aiChatPaper

T-MAC: エッジデバイス向け低ビットLLM展開のためのテーブル参照によるCPUルネサンス

T-MAC: CPU Renaissance via Table Lookup for Low-Bit LLM Deployment on Edge

June 25, 2024
著者: Jianyu Wei, Shijie Cao, Ting Cao, Lingxiao Ma, Lei Wang, Yanyong Zhang, Mao Yang
cs.AI

要旨

エッジデバイス上での大規模言語モデル(LLMs)の展開は、オンデバイスインテリジェンスを強化するためにますます重要になっています。重みの量子化は、デバイス上のLLMsのメモリフットプリントを削減するために不可欠です。しかし、低ビットのLLMsは、推論時に低精度の重みと高精度のアクティベーションの混合精度行列乗算(mpGEMM)を必要とします。既存のシステムは、mpGEMMのネイティブサポートを欠いているため、高精度計算のために重みを逆量子化することを余儀なくされています。このような間接的な方法は、推論のオーバーヘッドを大幅に増加させる可能性があります。 本論文では、CPU上での効率的な低ビットLLM(すなわち、重み量子化されたLLM)推論のために設計された、革新的なルックアップテーブル(LUT)ベースの方法であるT-MACを紹介します。T-MACは、逆量子化なしでmpGEMMを直接サポートし、同時に乗算を排除し、必要な加算を削減します。具体的には、T-MACは従来のデータ型中心の乗算をビット単位のテーブルルックアップに変換し、統一されたスケーラブルなmpGEMMソリューションを実現します。 私たちのLUTベースのカーネルは、重みのビット幅に対して線形にスケールします。低ビットのLlamaおよびBitNetモデルで評価されたT-MACは、llama.cppと比較して最大4倍のスループット向上と70%のエネルギー消費削減を示しました。BitNet-b1.58-3Bでは、T-MACはM2-Ultra上でシングルコアで30トークン/秒、8コアで71トークン/秒のトークン生成スループットを提供し、Raspberry Pi 5のような低スペックデバイスでも11トークン/秒を達成し、成人の平均読書速度を大幅に上回ります。LUTベースのコンピューティングパラダイムを採用したT-MACは、計算効率を損なうことなく、リソースが制約されたエッジデバイス上での低ビットLLMsの実用的な展開の道を開きます。このシステムはhttps://github.com/microsoft/T-MACでオープンソース化されています。
English
The deployment of Large Language Models (LLMs) on edge devices is increasingly important to enhance on-device intelligence. Weight quantization is crucial for reducing the memory footprint of LLMs on devices. However, low-bit LLMs necessitate mixed precision matrix multiplication (mpGEMM) of low precision weights and high precision activations during inference. Existing systems, lacking native support for mpGEMM, resort to dequantize weights for high precision computation. Such an indirect way can lead to a significant inference overhead. In this paper, we introduce T-MAC, an innovative lookup table(LUT)-based method designed for efficient low-bit LLM (i.e., weight-quantized LLM) inference on CPUs. T-MAC directly supports mpGEMM without dequantization, while simultaneously eliminating multiplications and reducing additions required. Specifically, T-MAC transforms the traditional data-type-centric multiplication to bit-wise table lookup, and enables a unified and scalable mpGEMM solution. Our LUT-based kernels scale linearly to the weight bit-width. Evaluated on low-bit Llama and BitNet models, T-MAC demonstrates up to 4x increase in throughput and 70% reduction in energy consumption compared to llama.cpp. For BitNet-b1.58-3B, T-MAC delivers a token generation throughput of 30 tokens/s with a single core and 71 tokens/s with eight cores on M2-Ultra, and 11 tokens/s on lower-end devices like Raspberry Pi 5, which significantly exceeds the adult average reading speed. T-MAC with LUT-based computing paradigm, paves the way for the practical deployment of low-bit LLMs on resource-constrained edge devices without compromising computational efficiency. The system is open-sourced at https://github.com/microsoft/T-MAC.

Summary

AI-Generated Summary

PDF121November 28, 2024