VQ-AR: Vector Quantized Autoregressive Probabilistic Time Series Forecasting

Kashif Rasul, Young-Jin Park, Max Nihlén Ramström, Kyung-Min KimarXiv 2022

Abstract

Time series models aim for accurate predictions of the future given the past, where the forecasts are used for important downstream tasks like business decision making. In practice, deep learning based time series models come in many forms, but at a high level learn some continuous representation of the past and use it to output point or probabilistic forecasts. In this paper, we introduce a novel autoregressive architecture, VQ-AR, which instead learns a discrete set of representations that are used to predict the future. Extensive empirical comparison with other competitive deep learning models shows that surprisingly such a discrete set of representations gives state-of-the-art or equivalent results on a wide variety of time series datasets. We also highlight the shortcomings of this approach, explore its zero-shot generalization capabilities, and present an ablation study on the number of representations.

Introduction

In the world of deep learning for time series, most models follow a similar "analog" philosophy: they ingest the past and map it to a high-dimensional, continuous vector space to predict the future. While flexible, this approach has a downside—continuous models are prone to overfitting and can easily get distracted by "spurious correlations" (noise that looks like a signal). VQ-AR asks a provocative question: Does a time series history actually need an infinite range of representations? By forcing the model to choose from a finite set of "prototypes" (discrete representations), VQ-AR creates a powerful inductive bias for forecasting.

Methods

The VQ-AR (Vector Quantized Autoregressive) architecture consists of three main components designed to tokenize time series history:

  1. Encoder RNN: Processes the historical context window and covariates to produce a continuous latent vector.
  2. Vector Quantizer (The Bottleneck): Instead of passing the continuous vector to the decoder, the model looks up the nearest neighbor in a learned codebook of vectors ($z_1, \dots, z_J$). This effectively "tokenizes" the history of the time series.
  3. Decoder RNN & Distribution Head: The decoder receives only the discrete codebook vector. It then outputs the parameters of a probability distribution (e.g., Student-T or Negative Binomial) to generate probabilistic forecasts.
The VQ-AR architecture diagram showing the flow from input to Encoder RNN, through the Vector Quantizer bottleneck, and finally to the Decoder RNN and distribution head.

The model is trained end-to-end using a combined loss function: the negative log-likelihood of the data plus a VQ loss that encourages the codebook vectors to align with the encoder's output while preventing them from fluctuating too wildly.

Key Insights and Ideas

  • The Power of Discreteness: A discrete set of representations is sufficient for state-of-the-art forecasting. Even with a codebook of just two vectors, the model can produce valid, reasonable forecasts.
  • Natural Regularization: The VQ bottleneck acts as a form of information compression. By forcing the model to map many similar histories to the same discrete "token," it ignores low-level noise and focuses on the underlying structural patterns.
  • Superior Generalization: Because the learned "tokens" represent universal time series shapes rather than dataset-specific noise, VQ-AR significantly outperformed continuous models in zero-shot scenarios.
  • Robustness to Small Noise: Small amounts of noise in the input are simply "rounded off" to the nearest codebook vector, making the forecast more stable than continuous alternatives.

Key Results

VQ-AR was evaluated on a diverse battery of eight datasets covering finance, weather, energy, and retail, including the famous M5 competition dataset and a large-scale proprietary E-Commerce dataset.

Comprehensive performance comparison of VQ-AR against baseline models across eight datasets, showing competitive or state-of-the-art results in metrics like CRPS and MSIS.
  • Performance: VQ-AR achieved state-of-the-art or equivalent results across almost all tested datasets. For example, on the Electricity dataset, it achieved a CRPS (Continuous Ranked Probability Score) of 0.054, beating SQF-RNN (0.078) and DeepAR (0.062).
  • M5 Competition: In the high-stakes M5 dataset, VQ-AR produced results competitive with massive ensembles of tree-based models, achieving this with a single neural network and minimal manual feature work.

Limitations and Future Work

While robust to small noise, the model has a "breaking point." If input noise is high enough to push the representation closer to a different codebook vector, the forecast can jump abruptly. Future work includes extending this to high-dimensional multivariate settings and integrating the VQ bottleneck into Transformer-based architectures to handle even longer sequences.

Summary updated

BibTeX
@misc{rasul2022vq,
  author = {Kashif Rasul and Young-Jin Park and Max Nihlén Ramström and Kyung-Min Kim},
  title = {{VQ-AR: Vector Quantized Autoregressive Probabilistic Time Series Forecasting}},
  year = {2022},
  eprint = {2205.15894},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.15894},
}
Figure