Distillation of a tractable model from the VQ-VAE

Armin Hadzic, Milan Papez, Tomás Pevný · DOI

Introduction

Vector-Quantized Variational Autoencoders (VQ-VAEs) have emerged as a cornerstone of modern deep generative modeling, capable of producing high-fidelity images and audio. Despite their generative prowess, VQ-VAEs are fundamentally "intractable." They cannot efficiently compute exact likelihoods or perform complex marginalization tasks, such as finding the most likely completion of a partial image. This intractability stems from their discrete latent space: even a modest $4 \times 4$ grid with a codebook of 96 entries results in over 85 million possible latent configurations ($96^{16}$). Summing over this exponential space to calculate exact probabilities is computationally prohibitive.

This paper introduces a novel framework to bridge the gap between the flexibility of VQ-VAEs and the mathematical rigor of tractable models. By "distilling" a manageable subset of high-probability latent states, the authors transform the VQ-VAE into a Probabilistic Circuit (PC) capable of exact and efficient inference.

Methodology: Distilling Tractability

The core of the proposed approach is the creation of a Distilled Model (DM). Instead of attempting to model the entire latent space, the DM focuses on a mixture of a finite number of latent components that capture the majority of the probability mass.

Search Strategies

The authors explore two primary methods for identifying these critical latent configurations:

  1. Random Sampling (DMRS): Latent states are sampled directly from the VQ-VAE's prior distribution. This provides a simple baseline but can be difficult to scale to complex priors.
  2. Beam Search (DMBS): To more efficiently navigate the latent space, the authors employ a beam search algorithm. This allows the model to greedily identify the most probable configurations without an exhaustive search, reducing the computational complexity from exponential to polynomial ($O(NHWK)$).

Probabilistic Circuits

The distilled mixture is framed as a Probabilistic Circuit (PC). By ensuring the model follows structural constraints like decomposability, the authors guarantee that complex probabilistic queries—such as exact density estimation and marginalization—can be solved in time linear to the size of the circuit. Crucially, the VQ-VAE decoder is mathematically treated as a "product unit" within this circuit, allowing deep neural networks to be integrated into a tractable framework.

Key Results

The researchers evaluated the Distilled Models on the MNIST dataset, comparing them against state-of-the-art tractable baselines, including Einsum Networks (EiNets) and Continuous Mixtures (CMs).

Density Estimation

In terms of Bits Per Dimension (BPD), the distilled models demonstrated competitive performance. As shown in the scaling analysis, both DMRS and DMBS models closely approach the performance of the "Exact Model" (ExM) as the number of parameters increases, often outperforming or matching established baselines like EiNets.

Density estimation performance (BPD) vs. number of parameters for various models.

Image Inpainting

The practical utility of tractability is most evident in image inpainting. When tasked with completing the right half of an MNIST digit given the left half (red pixels), the distilled models (DMRS and DMBS) produced significantly more coherent and recognizable digits than the Continuous Mixture baseline.

Qualitative comparison of image inpainting results across different models.

The DMRS model, in particular, was noted for its ability to generate a balanced distribution of digit classes, avoiding the biases seen in other models (e.g., the CM model's tendency to over-generate the digit '8').

Discussion: Index Collapse as a Blessing

A significant insight of this work is the reinterpretation of "index collapse"—a common phenomenon where VQ-VAEs ignore a large portion of their available codebook. While typically viewed as a training failure, the authors argue it is a "blessing" for tractability. If the model naturally concentrates its probability mass into a tiny fraction of the latent space, distillation becomes highly effective, as only a small number of components are needed to capture the model's full expressive power.

Conclusion and Future Work

This work demonstrates that the "flaws" of VQ-VAEs can be exploited to create powerful, tractable generative models. While scaling to high-resolution datasets like ImageNet remains a challenge due to the increasing demands on search strategies, the bridge built between VQ-VAEs and Probabilistic Circuits opens new avenues for exact inference in deep learning. Future research will focus on more advanced, data-driven exploration strategies to further enhance the efficiency of latent space distillation.

Summary updated

BibTeX
@inproceedings{hadzic2026distillation,
  author = {Armin Hadzic and Milan Papez and Tomás Pevný},
  title = {{Distillation of a tractable model from the VQ-VAE}},
  booktitle = {ESANN},
  year = {2026},
  doi = {10.14428/esann/2026.es2026-167},
}
Figure