Papers › Restructuring Vector Quantization with the Rotation Trick

Restructuring Vector Quantization with the Rotation Trick

8 Oct 2024arXiv:2410.06424archive 2025-07-28

Christopher Fifty, Ronald G. Junkins, Dennis Duan, Aniketh Iger, Jerry W. Liu, Ehsan Amid, Sebastian Thrun, Christopher Ré

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2410.06424")

Code

Syntology Ran 7 of 7 code samples harvested from 1 repository linked to this paper; 0 have no recorded run. Of those that ran: 1 ran · honoured contract; 2 ran · violated contract; 2 ran · our draft was wrong; 2 ran with no contract checked.

By repository: official repository: 7 samples from 1 repository, 7 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

cfifty/rotation_trick officialmentioned in papermentioned on GitHubpytorch report
lucidrains/vector-quantize-pytorch officialmentioned in papermentioned on GitHubpytorchMIT report
EdoardoBotta/RQ-VAE-Recommender mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

7 samples harvested; 7 ran; 1 honoured the contract we drafted; 0 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
2ran · violated contract
2ran · our draft was wrong
2ran

Licence: 7 of the 7 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from cfifty/rotation_trick. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Normalize cfifty/rotation_trick/src/modules/blocks.py official repository ran · our draft was wrong no licence file found · pointer only · c3a6b977022957cb · report
data_to_image cfifty/rotation_trick/src/reconstruction_fid.py official repository ran no licence file found · pointer only · 3d1b48b9b7c6afe0 · report
default cfifty/rotation_trick/src/local_vector_quantize_pytorch/vector_quantize_pytorch.py official repository ran · violated contract fingerprinted no licence file found · pointer only · 60fff7c3c400d7ff · report
exists cfifty/rotation_trick/src/local_vector_quantize_pytorch/vector_quantize_pytorch.py official repository ran · violated contract no licence file found · pointer only · aa5486a3650902d8 · report
get_model_params cfifty/rotation_trick/src/models/model_utils.py official repository ran no licence file found · pointer only · 13e83475b653975d · report
identity cfifty/rotation_trick/src/local_vector_quantize_pytorch/vector_quantize_pytorch.py official repository ran · honoured contract fingerprinted no licence file found · pointer only · f3232418205f7cbd · report
nonlinearity cfifty/rotation_trick/src/modules/blocks.py official repository ran · our draft was wrong fingerprinted no licence file found · pointer only · 3137073275f8c21a · report

Tasks

Quantization

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SETVQ-VAE

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections