Does Vector Quantization Fail in Spatio-Temporal Forecasting? Exploring a Differentiable Sparse Soft-Vector Quantization Approach

Chao Chen, Tian Zhou, Yanjun Zhao, Hui Liu, Rong Jin, Liang Sun

Abstract

Vector Quantization (VQ) is a powerful technique for mapping continuous data into discrete representations, widely used in generative modeling to produce crisp, high-fidelity images. However, its application in spatio-temporal forecasting has historically been detrimental to predictive accuracy. This paper identifies the core limitations of traditional "hard" VQ—specifically its non-differentiability and rigid representation—and introduces Differentiable Sparse Soft-Vector Quantization (SVQ). By framing quantization as a sparse regression problem approximated by a computationally efficient two-layer MLP, SVQ enables the use of massive codebooks while maintaining full differentiability. Our results demonstrate that SVQ acts as an effective noise filter, achieving state-of-the-art performance across weather, traffic, and video prediction benchmarks, including a 7.9% MSE reduction in weather forecasting.

Introduction

Spatio-temporal forecasting involves predicting the evolution of complex systems, such as atmospheric dynamics or urban traffic flows, over space and time. A successful model must distinguish between recurring structural patterns and stochastic noise. While Vector Quantization (VQ) theoretically offers a mechanism to capture these patterns in a discrete codebook, empirical evidence suggests that integrating standard VQ modules often degrades forecasting performance. This "failure" of VQ is often overlooked in generative contexts where visual sharpness is prioritized over numerical precision.

The Failure of Traditional Vector Quantization

The authors identify two primary bottlenecks that cause traditional VQ to fail in forecasting tasks:

  1. Non-Differentiability: Standard VQ employs a "hard" assignment, selecting the single nearest neighbor from a codebook. This operation is non-differentiable, necessitating the use of a "straight-through estimator" (STE) during backpropagation. The STE introduces significant gradient mismatch, hindering the training of deep spatio-temporal models.
  2. Rigid Representation: Forcing a complex, rapidly changing latent state into a single discrete code results in a loss of subtle but critical information. In forecasting, these nuances are essential for maintaining long-term accuracy.

Methodology: Sparse Soft-Vector Quantization (SVQ)

To overcome these limitations, we propose Sparse Soft-Vector Quantization (SVQ). Instead of a hard selection, SVQ represents an input latent vector as a sparse linear combination of multiple codebook entries.

The SVQ architecture integrates a quantization module between the encoder and translator, utilizing an MLP to approximate sparse regression for efficient, differentiable codebook selection.

Sparse Regression and MLP Approximation

SVQ reformulates the quantization process as a sparse regression problem. To ensure computational efficiency, the authors prove that a two-layer Multi-Layer Perceptron (MLP) can serve as a universal approximator for this optimization. This "surrogate" MLP allows the model to learn the mapping from latent features to sparse weights over a large-scale codebook (up to 10,000 entries) in a single, differentiable forward pass.

Plug-and-Play Integration

The SVQ module is designed for seamless integration into existing architectures. It typically resides between the spatial encoder and the temporal translator (e.g., a Transformer or SimVP backbone), refining latent features before they are projected forward in time.

Experimental Results

The proposed SVQ was evaluated against five diverse datasets: WeatherBench (meteorology), TaxiBJ (traffic), and Human3.6M, KTH, and KittiCaltech (video prediction).

Comparison of SVQ against various VQ variants shows that while traditional methods often degrade forecasting performance (negative effect), SVQ provides a significant positive boost.

Performance Gains

SVQ consistently outperformed both the base models and alternative VQ methods like Residual VQ (RVQ) and Multi-headed VQ (MHVQ). In weather forecasting (WeatherBench-S), SVQ achieved a 7.9% reduction in Mean Squared Error (MSE). In video prediction tasks, it reduced Mean Absolute Error (MAE) by an average of 9.4% across three datasets. Furthermore, perceptual quality, measured by LPIPS, improved by 17.3%, indicating that the model produces sharper, more realistic predictions without sacrificing numerical accuracy.

The "Frozen" Codebook Phenomenon

A significant finding is the efficacy of a randomly initialized, frozen codebook. Due to the high dimensionality and large size of the codebook, random vectors act as a near-orthogonal basis, covering the latent space sufficiently. This suggests that the primary value of SVQ lies in its ability to sparsely project signals onto a robust feature space, rather than in the specific learned values of the codes themselves.

Discussion and Conclusion

SVQ transforms Vector Quantization from a performance-degrading bottleneck into a powerful denoising filter for spatio-temporal forecasting. By enabling differentiable, sparse, and high-capacity representations, SVQ allows models to focus on predictable signals while discarding irrelevant noise. Future research will explore the synergy between SVQ and probabilistic frameworks, such as diffusion models, to further enhance the authenticity and reliability of long-term spatio-temporal predictions.

Summary updated

BibTeX
@inproceedings{chen2025does,
  author = {Chao Chen and Tian Zhou and Yanjun Zhao and Hui Liu and Rong Jin and Liang Sun},
  title = {{Does Vector Quantization Fail in Spatio-Temporal Forecasting? Exploring a Differentiable Sparse Soft-Vector Quantization Approach}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2025},
  doi = {10.1145/3711896.3736914},
}
Figure