Research
StableVQ: Practical Guidelines for Stable Vector-Quantized Tokenizer Training
StableVQ: Practical Guidelines for Stable Vector-Quantized Tokenizer Training Overview Research area: Computer vision — discrete visual tokenization and vector-quantized (VQ) representation learning f

- arXiv
- 2609.26774
- Published
- 2026-09-22
- Authors
- Bao Tang, Jiahao Guo, Haoxiang Cao, Wenyu Liu, Changqian Yu, Kun Gai, Xinggang Wang
AI summary
StableVQ: Practical Guidelines for Stable Vector-Quantized Tokenizer TrainingOverview
Research area: Computer vision — discrete visual tokenization and vector-quantized (VQ) representation learning for generative image models.
Technical level: Advanced. The paper assumes familiarity with VQ-VAE training, the straight-through estimator (STE), codebook collapse, and distribution-alignment views of codebook optimization.
Scope: The paper diagnoses why VQ tokenizer training remains unstable even after shared-projection codebook methods fixed low codebook utilization, and proposes three parameter-free interventions — Dynamic STE, Region VQ Loss, and Decoupled Schedule — that reach 100% codebook utilization and improved reconstruction on ImageNet 256×256.
What This Paper Is About
Modern image generation systems — autoregressive transformers, masked generative models, and multimodal language models — depend on VQ tokenizers that map continuous image features to discrete tokens through a learned codebook. Codebook collapse (most code vectors never being used) has been largely mitigated by shared-projection methods that reparameterize code vectors as ẽ_k = f_θ(e_k) so gradients reach all codes, but training stability remains a critical and underexplored problem. The authors argue the root cause is entanglement of the Encoder–Decoder and Codebook training objectives: neither module can fulfill its own responsibility in isolation, so the system only works when the two happen to cooperate — a condition that breaks down exactly when training is most stressed.
Key Contributions
-
A separation-of-concerns analysis of VQ tokenizer training. The authors revisit the proper responsibility of each module and show that inter-module entanglement has concealed latent dysfunctions in both. This reframes training instability as a failure of modular responsibility rather than a fundamental limitation of the quantization paradigm.
-
Three parameter-free interventions in StableVQ. (a) Dynamic STE corrects the Encoder's learning objective, letting it optimize the reconstruction space under discrete regularization even when codebook utilization is low. (b) Region VQ Loss reconceives the Codebook's objective so it can independently guarantee full tracking of the encoder output distribution. (c) Decoupled Schedule assigns the Encoder–Decoder and the Codebook independent learning rate schedules, since they have different optimization characteristics.
-
A more accessible performance ceiling. By removing dependence on heuristic initialization and shared-projection architecture design, StableVQ lets a single linear projection reach state-of-the-art quality. It is built on top of shared-projection codebooks, introduces no learnable parameters, and imposes no structural constraints (unlike FVQ's patch embedding, which constrains codebook size to perfect squares).
Main Findings
-
Three characteristic failure modes are identified. (a) Code scale ≪ token scale: the Codebook gets sparse targets and the token distribution fluctuates unpredictably, causing prolonged low utilization and commitment-loss spikes that can escalate to NaN. (b) Code scale ≫ token scale: utilization rises quickly but signals saturate for out-of-range codes, producing permanent dead codes. (c) Scale divergence: a momentary failure to track a distributional shift causes erroneous STE gradients to amplify the divergence in a positive-feedback loop, causing near-instantaneous utilization collapse.
-
Dynamic STE fixes Encoder-side instability. A per-token weight
w_ij = sg[d*_k*_ij / ||z_ij − f_θ(e_k*_ij)||²] ∈ (0,1]attenuates STE gradients for tokens that are relatively farther from their assigned code. When all tokens are well matched,w_ij ≈ 1and the method reduces to standard STE — it is self-deactivating and needs no threshold hyperparameter. -
Region VQ Loss fixes Codebook-side instability. The standard VQ loss is asymmetric: every token gets an explicit target via commitment loss, but only selected codes get meaningful objectives. Region VQ propagates targets from active codes to nearby inactive codes proportionally to selection counts, using a FIFO queue of length W to define window-active sets and persistently inactive sets. In a pilot study freezing the Encoder, standard VQ loss stagnates at around 12.5% utilization even after 5000 steps, while Region VQ Loss reaches full utilization by Step 500 and maintains it.
-
Coupled learning rates are the wrong design. Pilot studies show that, using the FVQ architecture, setting the Codebook to a constant learning rate incurs no performance degradation, whereas applying a constant rate to the Encoder–Decoder causes a clear quality drop. Using the SimVQ architecture, Codebook utilization is not improved by complex schedules but benefits from a stable, sufficiently high constant learning rate.
-
StableVQ achieves the best reconstruction with the simplest projector. On ImageNet 256×256 with 16×16 tokens and 40 epochs, StableVQ (Linear-1) reaches rFID 1.22 / LPIPS 0.2235 / 100% utilization at 16,384×256, and rFID 1.05 / LPIPS 0.1947 / 100% at 262,144×256. At 120 epochs it reaches rFID 1.13 / LPIPS 0.2134 and rFID 0.92 / LPIPS 0.1893 respectively. For comparison, SimVQ (Linear-1, 40 epochs) scores rFID 2.89 / LPIPS 0.2492 and rFID 3.16 / LPIPS 0.2516, and FVQ (ViTBlock-2, 40 epochs) scores rFID 1.70 / LPIPS 0.2176 and rFID 1.29 / LPIPS 0.2003 — all at 100% utilization.
-
StableVQ is far more robust to distributional mismatch. The newly introduced UR-AUC (Usage Recovery AUC) metric measures codebook utilization recovery under codebook–token distribution mismatch. StableVQ scores 60.59 ± 1.52, versus FVQ at 8.08 ± 0.24 and SimVQ at 2.17 ± 0.32. SimVQ and FVQ recover usage slowly and only under limited mismatch conditions.
-
Better tokens yield better generation. Training class-conditional autoregressive transformers on StableVQ tokens following the IBQ setup: with IBQ-B (342M parameters), FID improves from 2.88 to 2.35, with IS 256.0, Precision 0.82, Recall 0.58. With IBQ-L (649M), FID improves from 2.45 to 2.18, with IS 250.4, Precision 0.82, Recall 0.59.
-
Ablation under codebook expansion (small-range initialization, peak LR 1e-4). The baseline reaches 53.11 peak commitment loss and 49.13% utilization. Region VQ alone causes NaN collapse (>200 peak commitment); Dynamic STE alone keeps peak commitment below 0.1 but utilization falls to 1.27% with rFID 6.68; Decoupled Schedule alone reaches 83.77% utilization with rFID 1.71. Combining Region VQ with Dynamic STE or Decoupled Schedule recovers 100% utilization (rFID 1.72 and 1.75, respectively), while Dynamic STE + Decoupled Schedule reaches 21.66% utilization with rFID 2.07. All three together give 100% utilization with rFID 1.70, LPIPS 0.2208, PSNR 21.81, SSIM 0.5879.
-
Ablation under codebook shrinkage (dimension 1024, FVQ-style ViTBlock projector). FVQ fails to reach full utilization under either initialization (uniform: 18.75%, rFID 2.4355; gaussian: 62.5%, rFID 1.9530). Adding Region VQ reaches 100% utilization with both initializations and improves reconstruction (rFID 1.8176 and 1.8966 respectively), showing the result is insensitive to initialization.
-
Additional metrics are reported. Under a common evaluation script, FVQ at 120 epochs reaches rFID 1.46 / PSNR 21.91 / SSIM 0.5951 at 16,384×256 and rFID 1.07 / PSNR 22.55 / SSIM 0.6244 at 262,144×256, versus StableVQ at rFID 1.22 / PSNR 21.84 / SSIM 0.5816 and rFID 1.05 / PSNR 22.77 / SSIM 0.6277 at the same sizes.
Methodology in Plain English
The authors start from a conceptual diagnosis rather than a new architecture. They observe that the Encoder–Decoder and the Codebook are trained as if coupled together, so each module's hidden flaws are masked by the other's behavior. They unpack this into two questions: what should the Encoder learn, and what should the Codebook learn?
For the Encoder, the answer is "optimize the reconstruction space under the constraint that tokens must sit near discrete codes." The problem is that when a token is assigned to a far-away code, the straight-through gradient passed back from the reconstruction loss is a bad estimate of the true direction — it can fight the commitment loss and push distributions further apart. The fix punishes those unreliable gradients: each token's gradient is scaled by how far it sits from its code relative to the closest token for that same code, so well-matched tokens keep the full gradient.
For the Codebook, the answer is "track the encoder output distribution on its own." Standard VQ loss only supervises the codes that were selected this step. Shared projections spread that signal to all codes, but faintly and undirectedly, and the signal decays once a few codes fit the tokens well. The fix is to move from point-wise to distribution-wise alignment: codes that were active donate their targets to nearby inactive codes, in proportion to how many tokens selected them, so that every code in the "effective target" set gets a real target.
For the learning rate, the observation is that the two systems want different things. The Encoder–Decoder handles a complex multi-objective problem and benefits from warmup-plus-annealing. The Codebook has one clean job — continuously tracking a moving target — which is better served by a constant high learning rate with no warmup, so it has adequate gradient magnitude from the very first step.
The whole system is validated with controlled pilot studies (freezing the Codebook to test the Encoder fix; freezing the Encoder to test the Codebook fix; ablating schedules), then tested on ImageNet 256×256 with a VQGAN-style encoder–decoder at downsampling factor f = 16, producing 16×16 = 256 tokens per image, with rFID, LPIPS, and
Authors’ abstract
Vector Quantization (VQ) is fundamental to discrete visual tokenizers that power modern autoregressive and masked image generation models. While recent shared-projection codebook methods have substantially advanced codebook utilization, training stability remains a critical and underexplored challenge. We argue that the root cause lies in the entanglement of the Encoder--Decoder and Codebook training: because neither module can reliably fulfill its own responsibility in isolation, the system can only function when the two subsystems happen to cooperate---a fragile condition that breaks down precisely when training is most stressed. We propose StableVQ, which revisits the proper learning objective of each module and resolves the problems that arise when each is trained to fulfill its own role independently. Concretely, (1) Dynamic STE corrects the instability in the Encoder's learning objective, enabling it to robustly optimize the reconstruction space under discrete regularization even when codebook utilization is low. (2) Region VQ Loss reconceives the Codebook's learning objective so that it can independently guarantee full tracking of the encoder output distribution, without relying on encoder oscillations to drive activation. (3) Decoupled Schedule recognizes that the distinct responsibilities of the Encoder--Decoder and the Codebook demand distinct optimization dynamics, and assigns each an independent learning rate schedule to ensure robust system-level behavior. Built on top of shared-projection codebooks, StableVQ is lightweight and introduces no learnable parameters. Experiments on ImageNet demonstrate consistent improvements in training stability, codebook utilization, and reconstruction quality across diverse codebook sizes and initialization settings.