Introduction
Deploying deep learning models on edge devices—such as smartphones or IoT sensors—requires a delicate balance between maintaining high accuracy and adhering to strict hardware constraints like memory, latency, and power. Two of the most common solutions to this challenge are Neural Architecture Search (NAS), which automates the discovery of the best model architecture, and Quantization, which reduces the precision of weights and activations (e.g., from 32-bit floats to 4-bit integers).
Combining these two approaches into Joint NAS and Quantization is considered a "holy grail" of model optimization. However, it is notoriously difficult. Training a "supernet" (a massive model where smaller "subnets" share weights) with mixed-precision quantization is highly unstable. Activation distributions shift wildly depending on which subnet is sampled during training, causing standard Quantization-Aware Training (QAT) to fail. Consequently, most existing methods compromise by either limiting the search space or requiring time-consuming retraining steps for every new device target.
To solve this, researchers introduce BatchQuant, a robust quantizer that enables the stable training of a single "weight-sharing" supernet capable of supporting over $10^{76}$ different quantized architectures. This overarching approach, termed Quantized-for-all (QFA), allows practitioners to find and deploy high-performance mixed-precision models for any hardware constraint without expensive retraining or fine-tuning.
Methodology: BatchQuant and QFA
The authors propose two main innovations to overcome the instability of mixed-precision supernets:
- BatchQuant (BQ): This novel quantizer formulation is inspired by Batch Normalization. Standard quantizers rely on an Exponential Moving Average (EMA) to track the range of activations. However, in a supernet where the architecture changes every iteration, EMA is too slow to adapt, leading to "gradient explosion." BatchQuant solves this by calculating the quantization scale based on current batch statistics. This makes the quantizer robust to the rapidly shifting distributions of different subnets.
- Quantized-for-all (QFA) Framework: QFA utilizes a two-stage training strategy:
- Stage 1: The supernet is trained with a mix of low-bitwidth (2, 3, 4-bit) and full-precision (32-bit) subnets to stabilize early learning.
- Stage 2: The supernet is trained exclusively on low-bitwidth subnets.
- Search: Once trained, a multi-objective evolutionary algorithm (NSGA-II) and an accuracy predictor are used to find the best-performing models (the Pareto front) for any given complexity constraint.
Key Insights
The EMA Failure: The paper mathematically demonstrates why EMA-based scale estimation fails in supernets. Because the expected maximum value of a tensor grows logarithmically with its size, and subnets vary significantly in size, the "target" for the EMA is constantly moving. This prevents convergence and destabilizes training.
Batch Statistics as a Stabilizer: By using batch-wise extreme value estimators (specifically a biased version that balances variance and accuracy), BatchQuant "standardizes" the activation distribution across different subnets, much like how Batch Normalization standardizes features.
Zero Marginal Cost: Because the supernet is "Quantized-for-all," finding a model for a new device (e.g., a new chip with specific 3-bit support) takes less than an hour on a CPU once the initial training is complete. There is no need to utilize a GPU or retrain the weights.
Key Results
The primary benchmark used for training and evaluation is ImageNet, demonstrating that QFA scales effectively to challenging, large-scale image classification tasks.
- Massive Search Space: QFA supports a search space of over $10^{76}$ quantized subnets, exponentially larger than previous state-of-the-art methods like OQA ($10^{20}$).
- Efficiency: The supernet takes only 190 epochs to train, compared to 495 epochs for OQA, while achieving superior results.
- State-of-the-Art Performance: On ImageNet, QFA achieves state-of-the-art Top-1 accuracy under ultra-low complexity constraints (less than 20 MFLOPs).
- Robustness: Ablation studies show that without BatchQuant's specific formulation (specifically the residual $\gamma$ and $\beta$ terms and the batch-based estimator), the training loss simply diverges.
Limitations and Future Work
While highly effective, the QFA approach has a few limitations. Like many weight-sharing NAS methods, QFA only visits a small fraction of the $10^{76}$ subnets during training, meaning some subnets might not reach their full potential. Techniques to prioritize "important" paths could mitigate this in the future.
Furthermore, while BatchQuant works empirically, a full theoretical explanation of its effect on the training dynamics of mixed-precision supernets remains an open research question. Finally, the current paper focuses on simulated quantization (BitOPs/MFLOPs); future work should involve testing these mixed-precision models on actual specialized hardware to measure real-world latency gains.
Summary updated