[Paper Review] Differentiable Model Compression via Pseudo Quantization Noise
DiffQ proposes a differentiable model compression method that uses independent pseudo quantization noise (PQN) to enable end-to-end training with gradient backpropagation through quantized weights, eliminating the need for Straight-Through Estimator (STE). It jointly optimizes both model accuracy and size by automatically tuning the number of bits per weight or group, achieving state-of-the-art performance with a single hyperparameter, including 4-bit-like compression on ImageNet with only 0.3% accuracy drop.
We propose DiffQ a differentiable method for model compression for quantizing model parameters without gradient approximations (e.g., Straight Through Estimator). We suggest adding independent pseudo quantization noise to model parameters during training to approximate the effect of a quantization operator. DiffQ is differentiable both with respect to the unquantized weights and the number of bits used. Given a single hyper-parameter balancing between the quantized model size and accuracy, DiffQ optimizes the number of bits used per individual weight or groups of weights, in end-to-end training. We experimentally verify that our method is competitive with STE based quantization techniques on several benchmarks and architectures for image classification, language modeling, and audio source separation. For instance, on the ImageNet dataset, DiffQ compresses a 12 layers transformer-based model by more than a factor of 8, (lower than 4 bits precision per weight on average), with a loss of 0.3% in model accuracy. Code is available at github.com/facebookresearch/diffq.
Motivation & Objective
- To address the challenge of training quantized deep learning models with non-differentiable quantization operations.
- To eliminate reliance on gradient approximation methods like the Straight-Through Estimator (STE), which introduces bias and instability.
- To enable end-to-end, differentiable optimization of both model weights and the number of bits per parameter or group.
- To achieve mixed-precision quantization with automatic bitwidth allocation during training using a single hyperparameter.
- To provide a stable, accurate, and efficient alternative to existing quantization-aware training (QAT) methods for image, language, and audio models.
Proposed method
- Introduces pseudo quantization noise (PQN) as a differentiable surrogate for the quantization operator during training.
- Adds independent, i.i.d. noise to each weight during forward pass to simulate quantization effects while preserving gradient flow.
- Derives a differentiable estimate of model size based on the number of bits per weight or group, enabling end-to-end optimization.
- Uses a single regularization penalty term (λ) to balance model size and accuracy, allowing automatic bitwidth tuning.
- Optimizes both unquantized weights and bitwidths jointly via standard backpropagation, avoiding gradient approximation.
- Applies the method end-to-end to convolutional networks, Transformers, and sequence models across image, language, and audio tasks.
Experimental results
Research questions
- RQ1Can pseudo quantization noise (PQN) serve as a fully differentiable alternative to the Straight-Through Estimator (STE) in model quantization?
- RQ2Can the number of bits per weight or group be jointly optimized with model weights during training using a single hyperparameter?
- RQ3Does PQN-based training achieve better accuracy than STE-based methods at equivalent compression levels?
- RQ4How does automatic mixed-precision bit allocation affect model performance and size across diverse architectures and tasks?
- RQ5Can the method achieve 4-bit-level compression with minimal accuracy degradation while maintaining training stability?
Key findings
- On ImageNet with a DeiT model, DiffQ achieves 82.0% Top-1 accuracy with a model size of 45.7MB using λ=1e−2, outperforming QAT 4-bit (79.2% accuracy) and matching QAT 8-bit (81.6%) with a smaller model.
- For the same 4-bit target, DiffQ achieves 82.0% accuracy on DeiT, while QAT 4-bit drops to 79.2%, demonstrating superior stability and performance.
- On EfficientNet-B3, DiffQ achieves 81.5% accuracy with a 33.02MB model size (λ=0.1), outperforming QAT 8-bit (81.3% accuracy, 12MB) and QAT 4-bit (80.8% accuracy, 8.5MB).
- DiffQ reduces model size by over 8× on a 12-layer Transformer-based model on ImageNet, achieving less than 4 bits per weight on average with only 0.3% accuracy drop.
- For ResNet-18 on CIFAR-100, DiffQ with 2-bit quantization outperforms QAT, especially in the low-bit regime where QAT becomes unstable.
- The method introduces only a 10-25% training time overhead on most models, with worst-case doubling on EfficientNet-B3, and decompression time of ~2.8s for Demucs on a MacBook Pro.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.