NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Distance-aware Quantization

Dohyung kim, Junghyup Lee, Bumsub Ham

TL;DR

Distance-aware Quantization (DAQ) introduces a unified framework to train low-precision neural networks by treating the rounding process as a distance-based assignment problem. By using a novel "soft rounding" technique paired with an adaptive temperature controller, the authors eliminate the common "quantizer gap" between training and inference while maintaining stable, accurate gradients.

What Problem Does This Paper Address?

To run deep learning models on edge devices like phones or drones, we often need to quantize them—converting high-precision 32-bit floating-point numbers into low-bit integers (like 4-bit or even 1-bit). The heart of quantization is the rounding function, which maps a continuous value to the nearest discrete step.

However, rounding is a "staircase" function: its derivative is zero almost everywhere and undefined at the steps. This breaks the gradient-based optimization (backpropagation) used to train networks. Researchers usually solve this in two ways:

  1. Straight-Through Estimator (STE): They pretend the derivative is 1 during the backward pass. This works but creates a gradient mismatch because the forward and backward passes are doing different things.
  2. Soft Quantizers: They use smooth, sigmoid-like functions during training. This helps gradients flow but creates a quantizer gap: the model behaves differently during training (smooth) than it does during testing (discrete rounding).

DAQ aims to solve both problems simultaneously.

Methods

The authors re-imagine the discretizer (the rounding function) as a two-step process: first, calculate the distance between an input and the nearest available quantized levels, and second, pick the one with the minimum distance (an argmin operation).

Figure 1: The discretizer takes a full-precision input, and then assigns it to the nearest quantized value, e.g., q1 in this example. We interpret the assignment process of a discretizer as follows: It first computes the distances between the full-precision input and quantized values, q1 and q2, and then applies an argmin operator over the distances to choose the quantized value. Since this operator is non-differentiable, the quantized network cannot be trained end- to-end with gradient-based optimizers. (Best viewed in color.)

To make this differentiable, they introduce two components:

  • Distance-Aware Soft Rounding (DASR): Instead of a hard argmin, they use a kernel soft argmax. This uses a Gaussian kernel to weight the nearest quantized values, creating a differentiable approximation of rounding.
  • Temperature Controller: This is the core innovation. Usually, soft quantizers use a fixed "temperature" parameter ($\beta$). A low $\beta$ makes the function too smooth (large gap), while a high $\beta$ makes it too sharp (vanishing gradients). DAQ calculates an adaptive temperature ($\beta^*$) for every single input based on its distance to the "transition point" (the halfway mark between two quantized levels).
Figure 2: An overview of DAQ. Our quantizer Q mainly consists of DASR with a temperature controller. DAQ first normalizes a full- precision input ˆx. DASR inputs the normalized input, and computes distance scores w.r.t quantized values. It then assigns the input to the nearest quantized value Q(ˆx). For the assignment, we exploit a differentiable version of the argmax with an adaptive temperature β∗, obtained from our controller.

Datasets

The authors evaluated DAQ on standard computer vision benchmarks:

  • ImageNet: Used for large-scale classification with ResNet-18, ResNet-34, and MobileNet-V2.
  • CIFAR-10: Used for smaller-scale testing with ResNet-20.
  • Set5: A benchmark for Super-Resolution (SR) tasks to prove DAQ works for regression, not just classification.

Key Insights and Ideas

  • Rounding is Assignment: By viewing quantization as an assignment problem rather than just a mathematical truncation, the authors could leverage differentiable "soft" assignment tools from other fields (like landmark detection).
  • The "Goldilocks" Temperature: The adaptive temperature $\beta^*$ is high near transition points to ensure the model learns exactly where the "flip" happens, but low when the input is close to a quantized value to keep gradients healthy and avoid the vanishing gradient problem.
  • Closing the Gap Mathematically: The authors prove that by using their adaptive temperature and a specific rescaling function, the "soft" function used in training becomes mathematically identical to the "hard" rounding used in testing. This effectively deletes the quantizer gap.
How adaptive temperature samples from different soft functions to create a perfect step.

Key Results

DAQ consistently outperformed previous state-of-the-art methods across various bit-widths:

  • ResNet-18 on ImageNet: At ultra-low precision (1-bit weights and activations), DAQ achieved 56.2% top-1 accuracy, significantly beating the previous best of 53.6% (QNet).
  • Binarization: DAQ proved highly effective for binarizing networks (1-bit), where gradient mismatch is usually most severe.
  • MobileNet-V2: On this already "lightweight" architecture, DAQ achieved 70.0% accuracy at 4-bit precision, coming within 1.9% of the full-precision model.
  • Super-Resolution: DAQ is one of the few quantization papers to show strong results on regression tasks, achieving near-original PSNR (image quality) on the Set5 dataset with 4-bit and 8-bit models.

Limitations and Future Work

  • Training Overhead: Calculating the adaptive temperature for every input adds a small amount of computational complexity during training. The authors noted a roughly 3-4% increase in training time per iteration compared to simpler methods.
  • Hyperparameters: While the temperature is adaptive, the system still relies on a few global hyperparameters (like $\gamma$ and the kernel's standard deviation) that require grid searching to optimize for different architectures.
  • Future Directions: The authors suggest that this distance-aware approach could be extended to non-uniform quantization, where the steps between levels aren't equal, potentially leading to even better compression.

Summary updated

BibTeX
@misc{kim2021distance,
  author = {Dohyung kim and Junghyup Lee and Bumsub Ham},
  title = {{Distance-aware Quantization}},
  year = {2021},
  eprint = {2108.06983},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2108.06983},
}
Figure