Skip to main content
QUICK REVIEW

[Paper Review] Finite Scalar Quantization: VQ-VAE Made Simple

Fabian Mentzer, David Minnen|arXiv (Cornell University)|Sep 27, 2023
Advanced Image and Video Retrieval TechniquesComputer Science12 citations
TL;DR

This paper replaces vector quantization in VQ-VAEs with Finite Scalar Quantization (FSQ), a simple, bounded, low-dimensional scalar quantization that yields competitive results across image generation and dense vision tasks while avoiding codebook-related drawbacks.

ABSTRACT

We propose to replace vector quantization (VQ) in the latent representation of VQ-VAEs with a simple scheme termed finite scalar quantization (FSQ), where we project the VAE representation down to a few dimensions (typically less than 10). Each dimension is quantized to a small set of fixed values, leading to an (implicit) codebook given by the product of these sets. By appropriately choosing the number of dimensions and values each dimension can take, we obtain the same codebook size as in VQ. On top of such discrete representations, we can train the same models that have been trained on VQ-VAE representations. For example, autoregressive and masked transformer models for image generation, multimodal generation, and dense prediction computer vision tasks. Concretely, we employ FSQ with MaskGIT for image generation, and with UViM for depth estimation, colorization, and panoptic segmentation. Despite the much simpler design of FSQ, we obtain competitive performance in all these tasks. We emphasize that FSQ does not suffer from codebook collapse and does not need the complex machinery employed in VQ (commitment losses, codebook reseeding, code splitting, entropy penalties, etc.) to learn expressive discrete representations.

Motivation & Objective

  • Motivate a simpler discrete representation by replacing VQ with bounded scalar quantization.
  • Demonstrate that FSQ can serve as a drop-in replacement in diverse architectures (MaskGIT, UViM) and tasks.
  • Analyze codebook utilization, scaling behavior, and representation complexity of FSQ vs VQ.
  • Show that FSQ avoids codebook collapse and auxiliary losses common in VQ-based methods.

Proposed method

  • Introduce Finite Scalar Quantization (FSQ) where a d-dimensional encoder output is bounded per channel and rounded to L_i levels, yielding an implicit codebook of size ∏ L_i.
  • Use straight-through estimator (STE) to propagate gradients through the rounding operation.
  • Provide a heuristic for choosing FSQ hyperparameters (d and L_i) to approximate target codebook sizes, with a practical recommendation L_i ≥ 5.
  • Treat FSQ as a drop-in replacement for VQ in neural networks supporting discrete representations, adapting input/output layers accordingly.
  • Compare VQ and FSQ in MaskGIT (image generation) and UViM (depth, colorization, panoptic segmentation) across codebook sizes.

Experimental results

Research questions

  • RQ1Can FSQ serve as a drop-in replacement for VQ in VQ-VAE-based architectures without auxiliary losses?
  • RQ2How do FSQ and VQ compare in terms of codebook utilization, reconstruction quality, and sampling performance as codebook size grows?
  • RQ3Do larger FSQ codebooks improve performance, and is there a point of diminishing returns due to modeling complexity?
  • RQ4Is FSQ robust across diverse Vision tasks and architectures (MaskGIT, UViM) with limited architectural changes?
  • RQ5What are the trade-offs between representation complexity and compressor-like metrics (e.g., compression cost) for FSQ vs VQ?

Key findings

  • FSQ can replace VQ in VQ-VAE-based models with only small drops in performance (0.5–3% in reported metrics).
  • FSQ achieves near-complete codeword usage (≈100%) for large codebooks, while VQ struggles to utilize many codewords (drops below 50%).
  • FSQ demonstrates competitive reconstruction and sampling quality for image generation (MaskGIT) and dense vision tasks (UViM) across multiple runs.
  • FSQ does not require auxiliary losses like commitment or entropy penalties and avoids codebook collapse.
  • The FSQ codebook is typically much smaller in dimensionality (d<10) than VQ (d≥512), contributing to fewer parameters and simpler optimization.
  • Increasing FSQ codebook size improves reconstruction FID for FSQ, while sampling FID saturates beyond around 2^12 codes due to increased compression cost.
  • Across tasks, FSQ remains competitive with VQ even when side information/context is reduced or removed (e.g., FSQ vs VQ in UViM without context).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.