Restructuring Vector Quantization with the Rotation Trick
Christopher Fifty, Ronald Guenther Junkins, Dennis Duan, Aniketh Iyengar, Jerry Weihong Liu, Ehsan Amid, Sebastian Thrun, Christopher Ré
Abstract
Vector Quantized Variational AutoEncoders (VQ-VAEs) are designed to compress a continuous input to a discrete latent space and reconstruct it with minimal distortion. They operate by maintaining a set of vectors -- often referred to as the codebook -- and quantizing each encoder output to the nearest vector in the codebook. However, as vector quantization is non-differentiable, the gradient to the encoder flows around the vector quantization layer rather than through it in a straight-through approximation. This approximation may be undesirable as all information from the vector quantization operation is lost. In this work, we propose a way to propagate gradients through the vector quantization layer of VQ-VAEs. We smoothly transform each encoder output into its corresponding codebook vector via a rotation and rescaling linear transformation that is treated as a constant during backpropagation. As a result, the relative magnitude and angle between encoder output and codebook vector becomes encoded into the gradient as it propagates through the vector quantization layer and back to the encoder. Across 11 different VQ-VAE training paradigms, we find this restructuring improves reconstruction metrics, codebook utilization, and quantization error. Our code is available at https://github.com/cfifty/rotation_trick.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 1eaa6cc1-0a6b-48cb-8dca-71382a3f8be9Cited by top-tier papers19
- CODA: Repurposing Continuous VAEs for Discrete TokenizationZeyu Liu, Zanlin Ni, Yeguo Hua, Xin Deng et al.ICCV 2025 · 9 citations
- Spherical Leech Quantization for Visual Tokenization and GenerationYue Zhao, Hanwen Jiang, Zhenlin Xu, Chutong Yang et al.CVPR 2026 · 7 citations
- DiVeQ: Differentiable Vector Quantization Using the Reparameterization TrickMohammad Hassan Vali, Tom Bäckström, Arno SolinICLR 2026 · 6 citations
- PathVQ: Reforming Computational Pathology Foundation Model for Whole Slide Image Analysis via Vector QuantizationHonglin Li, Zhongyi Shui, Yunlong Zhang, Chenglu Zhu et al.NeurIPS 2025 · 6 citations
- Diffusion Generative Recommendation with Continuous TokensHaohao Qu, Shanru Lin, Yujuan Ding, Yiqi Wang et al.WWW 2026 · 5 citations
Builds on18
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
- High-Resolution Image Synthesis with Latent Diffusion ModelsRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser et al.CVPR 2022 · 13,123 citations
- Is Space-Time Attention All You Need for Video Understanding?Gedas Bertasius, Heng Wang, Lorenzo TorresaniICML 2021 · 2,927 citations
- Vector-quantized Image Modeling with Improved VQGANJiahui Yu, Xin Li, Jing Yu Koh, Han Zhang et al.ICLR 2022 · 753 citations
- vq-wav2vec: Self-Supervised Learning of Discrete Speech RepresentationsAlexei Baevski, Steffen Schneider, Michael AuliICLR 2020 · 730 citations
Related papers
- SQ-VAE: Variational Bayes on Discrete Representation with Self-annealed Stochastic QuantizationYuhta Takida, Takashi Shibuya, Wei-Hsiang Liao, Chieh-Hsin Lai et al.ICML 2022 · 99 citations
- Diffusion bridges vector quantized variational autoencodersMax Cohen, Guillaume Quispe, Sylvain Le Corff, Charles Ollion et al.ICML 2022 · 16 citations
- ArcVQ-VAE: A Spherical Vector Quantization Framework with ArcCosine Additive MarginJaeyung Kim, YoungJoon YooICML 2026
- Vector Quantization-Based Regularization for AutoencodersHanwei Wu, Markus FlierlAAAI 2020 · 33 citations
- Learning to Quantize for Training Vector-Quantized NetworksPeijia Qin, Jianguo ZhangICML 2025
