Learning from Loss Landscape: Generalizable Mixed-Precision Quantization via Adaptive Sharpness-Aware Gradient Aligning

Lianbo Ma, Jianlun Ma, Yuee Zhou, Guoyang Xie, Qiang He, Zhichao Lu

Introduction

Mixed-Precision Quantization (MPQ) has emerged as a critical technique for compressing deep neural networks (DNNs) for deployment on resource-constrained edge devices. Unlike uniform quantization, MPQ assigns varying bitwidths to different layers based on their sensitivity, optimizing the trade-off between model size, computational complexity (measured in Bit-Operations or BOPs), and predictive accuracy. However, the search space for an optimal MPQ policy is exponentially large. Standard search methods require evaluating candidates on the full target dataset (e.g., ImageNet), which is computationally prohibitive, often requiring dozens of GPU hours.

A potential solution is to perform the search on a smaller "proxy" dataset and transfer the resulting policy to the target task. Unfortunately, policies found on small datasets typically suffer from poor generalization, leading to significant accuracy drops when deployed on larger datasets. This paper introduces Adaptive Sharpness-Aware Gradient Aligning (ASGA), a method designed to find generalizable quantization policies by focusing on the geometry of the loss landscape.

The Generalization Challenge in MPQ

The primary obstacle to proxy-based MPQ search is the distribution shift between the proxy and target datasets. A policy that minimizes loss on a small dataset may inadvertently exploit specific features of that data, leading to a "sharp" minimum in the loss landscape. Sharp minima are highly sensitive to perturbations—such as the noise introduced by quantization—and rarely generalize well to new data distributions.

ASGA addresses this by shifting the optimization objective from simple loss minimization to the search for "flat" minima. The core insight is that the flatness of the loss landscape is a more transferable property than the specific weights learned from a dataset. By finding a policy that creates a flat landscape on a proxy, researchers can ensure that the policy remains robust when applied to a larger, more complex target dataset.

Proposed Method: ASGA

ASGA is built upon three technical pillars designed to ensure that the discovered quantization policies are robust and transferable.

1. Sharpness-Aware Minimization (SAM)

ASGA incorporates Sharpness-Aware Minimization into the search process. Instead of searching for a policy that only minimizes the training loss, SAM looks for a region where the loss remains consistently low even under small perturbations. Because quantization noise inherently increases the sharpness of the loss landscape, explicitly optimizing for flatness counteracts the "jitter" caused by low-precision arithmetic, resulting in more robust policies.

2. Implicit Gradient Direction Alignment

Simultaneously optimizing for task accuracy and landscape flatness can lead to "gradient conflicts." In such cases, the gradient of the accuracy loss and the gradient of the sharpness loss point in divergent directions, leading to unstable optimization. ASGA employs an implicit gradient alignment strategy. By ensuring that the optimization steps move in a direction that satisfies both objectives, the search process becomes more efficient and the resulting policy more stable.

3. Adaptive Perturbation Radius ($\rho$)

In standard SAM, the neighborhood radius ($\rho$) used to calculate sharpness is a fixed hyperparameter. However, a fixed radius may not be optimal throughout the entire search process. ASGA introduces an adaptive mechanism that scales $\rho$ based on the "surrogate gap"—the difference between the perturbed loss and the original loss. This allows the search to adaptively explore the landscape, speeding up convergence and improving the quality of the final policy.

Experimental Results

The researchers evaluated ASGA by searching for MPQ policies on small proxy datasets (CIFAR-10, Flowers, and Food) and deploying them on large-scale targets (ImageNet for classification and VOC for object detection).

Accuracy and Generalization

The results demonstrate that ASGA effectively bridges the generalization gap. Using CIFAR-10—a dataset only 0.5% the size of ImageNet—as a proxy, ASGA identified policies that achieved 66.1% Top-1 accuracy on ResNet-18. This performance is equivalent to or better than policies found by searching directly on the full ImageNet dataset using baseline methods.

Search Efficiency

ASGA significantly reduces the computational overhead of MPQ search. The method achieved search efficiency improvements of up to 150% over state-of-the-art baselines like EWGS and EdMIPS. By decoupling the search phase from the target dataset, ASGA allows researchers to find high-quality policies in a fraction of the time.

Cross-Task Transferability

To further test the robustness of the method, the authors applied policies found on a classification proxy to an object detection task (Faster R-CNN on VOC). The ASGA-derived policies maintained high performance, requiring only 77% of the search cost typically associated with task-specific searches.

Conclusion

ASGA represents a significant step forward in making Mixed-Precision Quantization more accessible and efficient. By focusing on the "flatness" of the loss landscape rather than dataset-specific accuracy, ASGA enables the discovery of quantization policies that generalize across datasets and tasks. This approach not only reduces the carbon footprint of neural network compression but also paves the way for more automated and hardware-aware model deployment on the edge.

Limitations and Future Work

While ASGA shows remarkable transferability, the choice of proxy dataset still plays a role; proxies with higher class-level similarity to the target yield better results. Future research could focus on integrating real-world hardware latency measurements into the ASGA loop and further refining the theoretical relationship between loss sharpness and specific hardware constraints.

Summary updated

BibTeX
@inproceedings{ma2025learning,
  author = {Lianbo Ma and Jianlun Ma and Yuee Zhou and Guoyang Xie and Qiang He and Zhichao Lu},
  title = {{Learning from Loss Landscape: Generalizable Mixed-Precision Quantization via Adaptive Sharpness-Aware Gradient Aligning}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=mHZhbRnwJI},
}
Figure