TL;DR
This paper introduces "minifloats," a novel reduced-precision floating-point format (3-8 bits) for FPGAs, demonstrating that they can achieve comparable or better accuracy than integer quantization for vision transformers and other complex models, especially when dealing with outliers. The authors provide a comprehensive analysis of accuracy-hardware trade-offs, showing minifloats offer a compelling alternative for resource-constrained edge devices.
What Problem Does This Paper Address?
Deploying increasingly large and complex neural networks on resource-constrained edge devices (like FPGAs) is a major challenge. Post-training quantization (PTQ) is a popular technique to compress models by reducing the numerical precision of weights and activations without retraining. While integer quantization is common, it can struggle with outliers in activation distributions, leading to accuracy loss. Floating-point formats, with their inherent dynamic range, are better suited for outliers, but traditional FP formats (like FP32) are too resource-intensive for edge devices. Recent work has explored 8-bit floating-point (FP8) formats, but the exploration of even lower-precision floating-point formats (minifloats) on FPGAs, and a direct comparison with integer quantization across various bit-widths, has been limited. This paper aims to fill this gap by investigating the accuracy and hardware efficiency of minifloats (3-8 bits) on FPGAs.
Methods
The core of this work is the introduction and evaluation of "minifloats," which are custom floating-point formats with bit-widths ranging from 3 to 8 bits. These minifloats are designed to be more hardware-efficient than standard FP formats while retaining the dynamic range benefits of floating-point representation. The authors developed a custom FPGA-based operator library to implement multiply-accumulate (MAC) units for both minifloats and integers. They systematically explored the design space by varying the number of exponent and mantissa bits for minifloats. Additionally, they investigated the applicability of existing PTQ optimization techniques like SmoothQuant, gradient-based learned rounding, and GPTQ to their minifloat framework. The hardware evaluation focused on LUT (Look-Up Table) utilization and memory footprint on an AMD VersalTM VCK190 FPGA.
Datasets
The models were evaluated on the ImageNet-1K dataset for the ImageNet classification task. A small calibration dataset of 1000 images was used for activation calibration, bias correction, learned rounding, and GPTQ.
Key Insights and Ideas
- Minifloats excel with outliers: The inherent dynamic range of minifloats makes them particularly effective for models with outlier-heavy activation distributions (like vision transformers), where they can maintain higher accuracy than integer quantization.
- FPGA flexibility is key: FPGAs, with their ability to support arbitrary bit-level precision, are ideal platforms for exploring and deploying custom minifloat formats, offering an advantage over fixed-architecture GPUs.
- Accuracy-hardware trade-offs are complex: While minifloats can achieve higher accuracy, integer quantization often retains Pareto optimality in terms of hardware footprint (LUTs) at lower bit-widths due to its simpler MAC structure.
- PTQ techniques adapt well: Existing PTQ optimization techniques like SmoothQuant, learned rounding, and GPTQ can be seamlessly integrated with the minifloat quantization framework, requiring minimal or no additional hyperparameter tuning.
- Design space exploration is crucial: The optimal minifloat configuration (exponent and mantissa bits) varies significantly between models and even between weights and activations within the same model, highlighting the need for thorough design-space exploration.
Key Results
- Accuracy: For bit-widths of four or more, minifloat quantization typically outperforms integer quantization. For example, with 4-bit weights and 8-bit activations, both formats approach full-precision accuracy. Minifloats showed up to a 6% accuracy improvement over integers for models like ViT-B-32 with 4-bit weights and 5-bit activations.
- Memory Footprint: Minifloats offer significant compression rates. For ViT-B-32, minifloat quantization achieved a remarkable 8x compression compared to FP32.
- Hardware Utilization (LUTs): At very limited LUT budgets, integer quantization tends to outperform minifloats in terms of accuracy. However, as the resource budget increases, the accuracy gap between integer and minifloat quantization narrows considerably, with minifloats often matching or exceeding integer performance.
- MAC Complexity: The minifloat MAC unit is more complex than the integer MAC, primarily due to the need for significand shifting and potentially a longer accumulator, which can impact hardware resource utilization.
Limitations and Future Work
- Uniformity Assumption: The current experiments assume uniform precision formats for all weights and activations within a given model. Future work could explore mixed-precision strategies where different layers or components use different minifloat configurations.
- Hardware Cost Model: While the study considers LUT utilization and memory footprint, the authors acknowledge that the hardware cost of converting minifloat accumulated values back to FP32 was omitted, as it could be merged into subsequent operations.
- Limited Model Scope: The study focused on vision models. Future work could extend this analysis to other model architectures and domains, such as natural language processing.
- Integer Dominance at Low Bit-widths: While minifloats show promise, integer quantization still dominates the Pareto frontier for MAC resource utilization at very low bit-widths. Future research could explore ways to make minifloat MACs more competitive in these extreme low-resource scenarios.
Summary updated