藉由權重封裝以支援多種權重格式之統一模型壓縮框架

A Unified Model Compression Framework Supporting Multiple Weight Formats via Weight Packing

檔案

全文未公開。

日期

2025

類型

語言

英文

摘要

近年來,隨著大型語言模型(Large Language Model, LLM)的迅速發展,其推論過程對運算與儲存的需求日益嚴峻。由於 LLM 參數量極為龐大,推論通常必須仰賴顯示卡(Graphics Processing Unit, GPU)執行。雖然現有技術如量化(Quantization)、剪枝(Pruning)等有損壓縮方法,能有效縮減模型大小並降低運算成本,在空間效率上具備優勢,但往往會導致準確率下降。在極端情況下,更可能使模型性能嚴重偏離原始表現。因此,對於某些對精度要求極高,且不允許重新訓練模型的應用場景而言,無損壓縮相較於有損壓縮更具實際價值與應用潛力。
經過量化後的模型權重已可採用 8 位元、4 位元,甚至 3 位元與 2 位元的形式進行儲存,低位元化已盡可能保留模型資訊。因此,相較於原始的浮點格式(Floating-Point 32, FP32;Floating-Point 16, FP16;BFloat16, BF16),其可壓縮空間已大幅縮減。若在此基礎上再進一步施加有損壓縮,極可能導致模型性能急遽下降,並與原始模型表現產生顯著差異。為解決此問題,本論文提出結合 Huffman、Golomb 編碼的後量化(Post-Quantization)壓縮方法,適用於邊緣加速器與雲端,以緩解所面臨的頻寬限制瓶頸。
在實務中,量化後的權重與原生浮點權重(FP16/BF16)已呈現多樣化的格式,例如INT8、INT4、INT3、BitNet-b1.58,以及各式 Microscaling Format(MX-Format)。若為每種格式分別設計專用解碼器,不僅過於繁瑣且缺乏實用性,也難以因應日益多變的格式需求。因此,本研究提出一個硬體友善(Hardware-Friendly)的統一化解碼架構(Unified Decoder),能同時支援多種權重格式,並兼顧效能與實作效率。
本論文提出一種後量化(Post-Quantization)的無損模型壓縮方法,透過結合 Huffman、Golomb 編碼來壓縮經量化後的低位元權重。實驗觀察顯示,若僅將低位元權重直接套用無損壓縮技術,雖能在一定程度上縮減模型大小,但距離理論極限值仍有差距。為突破此限制,我們進一步提出權重封裝(Weight Packing)的方法,以解決低位元權重在壓縮上的瓶頸並提升整效能。該方法的核心思想在於,先將多個低位元權重進行串接,組合成較高位元的權重單元,如此能有效增加編碼效率並提升壓縮率。我們所提出的方法可靈活搭配多種量化策略,例如 GPTQ 或 Microscaling Format(MX-Format),在低位元設定下展現出優異的壓縮效能與模型準確度。,我們進一步地對模型原生浮點權重(FP16 與 BF16)進行分析與壓縮,同時維持模型效能不受影響。
接著,我們設計了一個硬體友善(Hardware-Friendly)的解碼器架構,能同時支援 8、4、3、2 以及 1.58 位元等多種低位元權重格式。與 Huffman 編碼相比,Golomb 編碼的解碼器不僅在硬體實作上具備更高的解碼速度與更小的電路面積,亦能降低控制邏輯複雜度。進一步地,透過結合本研究所提出的權重封裝法,我們的解碼器能在同一個時脈週期內並行解出多個權重,大幅提升整體解壓縮效率與降低頻寬需求。
綜合上述,本研究不僅對多種權重格式的無損壓縮上提出具體可行的解決方案,並透過實際的硬體電路設計來驗證其效益。此方案有效緩解了雲端及 LLM 專用加速器在記憶體頻寬受限環境下的效能瓶頸。更重要的是,該方法在確保模型精度的前提下,實現了高壓縮率、高速、低硬體成本的優勢,為大規模語言模型於雲端、邊緣裝置與加速器上的高效部署與即時推論提供了新的設計思路與可能性。
In recent years, the rapid development of Large Language Models (LLMs) has led to increasingly demanding requirements for computation and storage during inference. Due to the enormous number of parameters, LLM inference is typically executed on Graphics Processing Units (GPUs). Although existing lossy compression techniques, such as Quantization and Pruning, can effectively reduce model size and computational cost, they often result in accuracy degradation. In extreme cases, model performance may deviate significantly from that of the original model. Therefore, for applications that require high accuracy and prohibit retraining, lossless compression provides more practical value and deployment potential compared to lossy compression.
After quantization, model weights can be stored in compact forms, such as 8-bit, 4-bit, or even 3-bit and 2-bit representations, where low-bit representations preserve as much model information as possible. Consequently, compared to the original floating-point formats (FP32, FP16, and BF16), the compressible space is significantly reduced. Applying additional lossy compression on top of this would likely lead to severe performance degradation and substantial divergence from the original model’s accuracy. To address this issue, this thesis proposes a post-quantization compression method based on Huffman and Golomb coding, targeting both edge accelerators and cloud platforms, to alleviate bandwidth bottlenecks.
In practice, quantized weights and native floating-point weights (FP16/BF16) exist in diverse formats, such as INT8, INT4, INT3, BitNet-b1.58, and various Microscaling Formats (MX-Formats). Designing dedicated decoders for each format would be overly cumbersome, impractical, and inflexible for evolving standards. To overcome this, we propose a hardware-friendly unified decoder architecture that supports multiple weight formats while balancing efficiency and implementation complexity.
We propose a post-quantization lossless compression method based on Huffman and Golomb coding for low-bit weights. While direct application of lossless compression to low-bit weights can reduce model size, it still leaves a noticeable gap from the theoretical entropy bound. To overcome this, we introduce the "Weight Packing" method, which packs multiple low-bit weights into a high-bit value, thereby improving the compression ratio and encoding efficiency. Our method can be combined with quantization schemes such as GPTQ and MX-Format, achieving strong compression while preserving accuracy. Moreover, for native FP16 and BF16 weights, it achieves substantial storage reduction while maintaining model performance, demonstrating its effectiveness across both quantized and high-precision formats.
In addition, we present a hardware-friendly decoder architecture that supports multiple weight formats, including 8-bit, 4-bit, 3-bit, 2-bit, and 1.58-bit formats. Compared to Huffman coding, Golomb-based decoding achieves faster speed, smaller circuit area, and lower control complexity. Combined with "Weight Packing", the decoder decodes multiple weights per clock cycle, significantly improving decompression efficiency and reducing bandwidth requirements.
In summary, this work provides practical lossless compression solutions with hardware implementation, alleviating bandwidth bottlenecks. The proposed method achieves high compression ratios, fast decoding, and low hardware cost while preserving accuracy, enabling efficient LLM deployment on cloud, edge, and accelerator platforms.

所屬典藏

電子研究所
顯示完整詮釋資料 統計資料

引用此條目

Chang, T.-Y. (2025). A Unified Model Compression Framework Supporting Multiple Weight Formats via Weight Packing. https://thesis.lib.nycu.edu.tw/handle/20.500.14371/87486

BibTeX RIS

引用文字依 APA 第 7 版格式自動產生,使用前請再核對。

分享

永久網址:https://thesis.lib.nycu.edu.tw/handle/20.500.14371/87486