TL;DR
SPA-Q is a new post-training quantization (PTQ) framework that allows massive monocular depth estimation (MDE) models to run in 4-bit precision with minimal accuracy loss. By specifically protecting the "structural" integrity of attention maps and fixing feature distribution drift across layers, it outperforms existing methods by nearly 30% in error reduction without adding any computational overhead at inference time.
What Problem Does This Paper Address?
Monocular Depth Estimation (MDE)—the ability to predict 3D depth from a single 2D image—has seen a massive leap forward with foundation models like Depth Anything. However, these models are computationally expensive and memory-heavy, making them difficult to deploy on robots, drones, or mobile devices.
Quantization (converting 32-bit weights to 4-bit) is the standard solution for compression, but it usually "breaks" depth models. The authors identify two main reasons why:
- Attention Mismatch: Standard quantization treats the "Query" and "Key" components of a Transformer independently. However, depth estimation relies on the interaction between them. If their relationship shifts even slightly, the resulting attention map—and thus the geometric structure of the scene—is ruined.
- Distribution Drift: In a deep network, small quantization errors in early layers act like a game of "telephone," accumulating until the features in the final layers look nothing like the original model's features.
Methods
The authors propose SPA-Q (Structure-Preserving Adaptive PTQ), which introduces two clever fixes:
- Attention-Preserving Calibration (APC): Instead of just trying to make the quantized Query and Key weights look like the originals, APC optimizes them to ensure the final attention map (the probability distribution after the Softmax layer) remains the same. They use KL Divergence to measure this, which is much better at capturing structural changes in probability than standard error metrics.
- Channel-Wise Distribution Alignment (CWDA): To stop the "telephone" effect, they add learnable scaling and shifting parameters ($\alpha$ and $\beta$) to each channel. These parameters "re-center" the feature distributions to match the full-precision model.
- Two-Step Depth-Aware Optimization: They don't just train everything at once. First, they align the encoder's features to preserve scene structure. Second, they optimize the decoder specifically to minimize depth-specific loss (SILog).
- Weight Fusion: Critically, after these parameters are learned, they are mathematically "absorbed" back into the model's weights and biases. This means the final 4-bit model runs just as fast as a standard one, with zero extra parameters at runtime.
Datasets
The researchers evaluated SPA-Q across five diverse benchmarks to test "zero-shot" generalization (testing on data the model hasn't seen during training):
- NYUv2: Indoor room scenes.
- KITTI: Outdoor driving scenes.
- ETH3D: High-resolution indoor/outdoor videos.
- DIODE: A mix of indoor and outdoor environments.
- Sintel: Synthetic sequences from an animated film.
Key Insights and Ideas
- Interaction over Fidelity: The biggest "aha moment" is that the fidelity of individual projections (Query/Key) matters less than the fidelity of their interaction. Figure 1 in the paper shows that even if you make Query/Key weights "less accurate" by standard metrics, the model performs better if the resulting attention map is preserved.
- Logits aren't the answer: Simply matching the raw scores (logits) before the Softmax layer isn't enough. Because Softmax is non-linear, small errors in logits can lead to massive shifts in the final attention distribution. You have to calibrate after the Softmax.
- The "Free" Lunch: By using affine transformations that can be fused into weights, the authors provide a way to "train" a PTQ model to be more robust without violating the core requirement of PTQ: efficient, no-overhead deployment.
Key Results
SPA-Q sets a new state-of-the-art for 4-bit MDE quantization:
- Accuracy: On the NYUv2 dataset, it reduced the Absolute Relative Error (AbsRel) by 29.5% compared to the previous best method (QSCA) and improved the $\delta_1$ accuracy (a measure of how many pixels are "mostly correct") by 20.2%.
- Visual Quality: Qualitatively, SPA-Q produces much sharper object boundaries and more coherent depth structures. While other 4-bit methods often produce "blurry" or "noisy" depth maps, SPA-Q closely mimics the 32-bit full-precision (FP32) model.
- Efficiency: It achieved these results while being more efficient than competitors. For a ViT-S backbone, SPA-Q reduced the model size to 14.16 MB (down from 94.55 MB in FP32) and required fewer Bit Operations (BOPs) than other adaptive methods.
Limitations and Future Work
- The 4-bit Gap: While SPA-Q is a massive improvement, there is still a "noticeable gap" between 4-bit performance and full 32-bit precision. In safety-critical applications like autonomous driving, this gap might still be too large for comfort.
- Calibration Data: Like all PTQ methods, it requires a small set of calibration images (the authors used 16). While small, it still means the process isn't entirely "data-free."
- Future Directions: The authors suggest that further narrowing the gap for extremely low-bit (e.g., 2-bit or 3-bit) quantization remains an open challenge for the community.
Summary updated