MixPE: Quantization and Hardware Co-design for Efficient LLM Inference

Yu Zhang, Mingzi Wang, Lancheng Zou, Wulong Liu, Hui-Ling Zhen, Mingxuan Yuan, Bei YuarXiv 2024 · DOI

TL;DR

This paper introduces MixPE, a novel hardware accelerator and co-design approach for efficient LLM inference. By cleverly delaying dequantization until after mixed-precision GEMM (mpGEMM) and using efficient shift-and-add operations instead of traditional multipliers, MixPE significantly reduces computational overhead and energy consumption, achieving substantial speedups over existing methods.

What Problem Does This Paper Address?

Large Language Models (LLMs) are incredibly powerful but also computationally demanding, making their deployment on edge devices or even standard servers challenging due to high memory and processing requirements. Quantization, which reduces the precision of model weights and activations, is a key technique to mitigate these issues. However, a common and effective quantization strategy involves multiplying low-precision weights (e.g., 4-bit) with higher-precision activations (e.g., 8-bit or 16-bit), known as mixed-precision GEMM (mpGEMM). The problem is that current hardware accelerators like GPUs and TPUs lack native support for this mpGEMM. Consequently, existing solutions resort to dequantizing the low-precision weights to a higher precision before performing the GEMM operation. This dequantization step, especially when done within the main computational loop and for every element, introduces significant overhead, negating much of the potential speedup and energy savings from low-bit quantization.

Methods

The core innovation of MixPE lies in its two-pronged approach:

  • Dequantization After GEMM: Instead of dequantizing weights before each GEMM operation, MixPE performs the mixed-precision multiplication first. It leverages the fact that for group-wise quantization (where scale and zero-point are shared within small groups of weights), the dequantization can be postponed until after the per-group mpGEMM computation. This dramatically reduces the number of dequantization operations by a factor related to the group size.
  • Shift-and-Add for Multiplication: To further boost efficiency, MixPE replaces traditional, power-hungry multipliers with a custom processing element (PE) that uses efficient bit-shift and addition operations. For integer weights (e.g., UINT4), multiplication by powers of two (inherent in the dequantized representation) is directly mapped to bit shifts. For floating-point activations (e.g., FP16), scaling by powers of two is achieved by directly manipulating the exponent bits, avoiding the need for complex floating-point multipliers.

These two techniques are co-designed: the hardware PE is optimized for the "dequantize-after-GEMM" strategy, and the strategy is enabled by the efficient PE.

Datasets

The paper uses the Pile dataset for evaluating quantization accuracy (specifically, for sampling activation distributions). For model evaluation, they use four open-source LLM models: ViT-base, ViT-Huge, OPT-6.7B, and LLaMA-2-13B.

Key Insights and Ideas

  • Dequantization is the Bottleneck: The paper highlights that the dequantization step, not the GEMM itself, is often the primary performance bottleneck in current low-bit LLM inference.
  • Group Quantization is Key: The effectiveness of the "dequantize-after-GEMM" strategy hinges on group-wise quantization, where scale and zero-point are shared within small groups. This allows for efficient batch processing of these groups.
  • Shift-and-Add is Underrated: Traditional hardware often relies on complex multipliers. MixPE demonstrates that for specific low-bit operations, simple shift-and-add operations can achieve comparable or better results with significantly less power and area.
  • Hardware-Software Co-design Pays Off: The most significant gains come from jointly optimizing the quantization algorithm (when to dequantize) and the hardware processing element (how to multiply).

Key Results

  • Speedup: MixPE achieves a 2.6x speedup compared to state-of-the-art quantization accelerators. For W4A16, it delivers a 2.44x speedup over traditional FP16 multiplication PEs.
  • Energy Reduction: MixPE offers a 1.4x energy reduction compared to state-of-the-art accelerators. Specifically, MixPE-A16 reduces FP16 energy consumption by 68% on average.
  • Hardware Efficiency: MixPE-A8 shows a 54% area reduction compared to standard INT8 PEs, and MixPE-A16 reduces area to 77% of FP16 PEs. Power efficiency is also significantly improved, with a 64% reduction in total power compared to FP16 PEs.
  • Dequantization Overhead: Figure 9 shows that MixPE's dequantization overhead is significantly smaller than that of INT8 PEs, especially at lower batch sizes.

Limitations and Future Work

  • Model Scope: While the paper evaluates on four representative LLMs, future work could explore a wider range of architectures and model sizes.
  • Quantization Schemes: The primary focus is on W4A8 and W4A16. Exploring other mixed-precision formats or even lower bit-widths could be beneficial.
  • Hardware Platform: The experiments are conducted on an FPGA. Evaluating MixPE on ASICs would provide a more direct comparison to commercial hardware like TPUs and GPUs.
  • DSE Framework: The paper introduces a Design Space Exploration (DSE) framework to find Pareto-optimal configurations. Further exploration and refinement of this framework could uncover even more efficient designs.
  • Heavy-Tailed Distributions: The paper notes that some layers might exhibit heavy-tailed weight distributions, which are not explicitly addressed by the current quantization approach. Future work could investigate methods to handle these cases more effectively.

Summary updated

BibTeX
@misc{zhang2024mixpe,
  author = {Yu Zhang and Mingzi Wang and Lancheng Zou and Wulong Liu and Hui-Ling Zhen and Mingxuan Yuan and Bei Yu},
  title = {{MixPE: Quantization and Hardware Co-design for Efficient LLM Inference}},
  year = {2024},
  eprint = {2411.16158},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.16158},
}
Figure