Non-Uniform Quantization Framework (NU-RQ-VAE)
- The paper introduces NU-RQ-VAE, which inserts an invertible transformation before residual quantization to address codeword imbalance and generation bias.
- It reconditions non-uniform latent distributions by mapping encoder outputs into a balanced space, enabling efficient multi-stage residual quantization with reduced autoregressive complexity.
- Empirical evaluations in recommendation tasks show improved recall metrics and effective codeword utilization compared to standard RQ-VAE setups.
Searching arXiv for the cited papers to ground the article in the current record. Searching for "Autoregressive Image Generation using Residual Quantization" and "CARD: Non-Uniform Quantization of Visual Semantic Unit for Generative Recommendation". Non-Uniform Quantization Framework (NU-RQ-VAE) denotes a residual-quantization variational autoencoder in which quantization is preceded by a learnable, invertible transformation that explicitly compensates for skewed embedding distributions. In the formulation introduced within CARD, NU-RQ-VAE targets recommendation settings where item semantic embeddings are highly non-uniform, so standard residual quantization suffers from codeword imbalance and generation bias; it therefore learns a transform that maps the encoder output into a more balanced latent space, performs residual quantization there, and then reconstructs through (Wei et al., 29 Apr 2026). Conceptually, it extends the residual-quantized VAE substrate of RQ-VAE, which had already shown that multi-stage residual quantization can preserve fidelity while shortening the effective autoregressive sequence length relative to conventional single-stage VQ formulations (Lee et al., 2022).
1. Residual-quantized VAE as the substrate
RQ-VAE begins from an image input
an encoder that produces
and a decoder that reconstructs . At a spatial location , the latent vector is denoted
Instead of single-stage vector quantization, RQ-VAE applies a -stage residual quantizer with initial residual
0
followed, for 1, by nearest-code selection,
2
codeword assignment
3
and residual update
4
The partial reconstruction is
5
with full quantized feature map 6 (Lee et al., 2022).
This residual formulation underwrites the later non-uniform extension because it decouples representational capacity from latent spatial resolution. The encoder plus residual quantizer yields a discrete tensor
7
Each spatial location is treated as one time step 8 with 9, and the autoregressive model predicts the stack
0
The key efficiency point is that inference predicts 1 codes in parallel per spatial location, so the spatial transformer sees only 2 context-vectors rather than 3 separate symbols. In the rate-distortion account given for RQ-VAE, a single-stage VQ at resolution 4 uses 5 bits, whereas residual quantization with depth 6 and codebook size 7 can in principle partition space into up to 8 regions, making aggressive spatial compression feasible without exponential growth of a single codebook (Lee et al., 2022).
2. Motivation for non-uniform quantization
The non-uniform extension is motivated by a distributional mismatch. In recommendation scenarios, learned item embeddings 9 are described as highly skewed: popular or semantically similar items cluster densely, while long-tail items occupy sparse regions. Standard vector-quantized VAEs, including residual variants, minimize average reconstruction error under an implicit assumption of uniform embedding density. When applied directly to such a non-uniform 0, two failure modes are identified: codeword imbalance, in which a small subset of codebook entries dominates assignments in dense regions, and generation bias, in which frequent codewords are over-chosen during autoregressive decoding, amplifying popularity bias (Wei et al., 29 Apr 2026).
NU-RQ-VAE addresses this problem by moving quantization into a transformed coordinate system. Let 1 denote the continuous representation produced by an encoder, described in CARD as a small MLP. The objective is to learn an invertible transform
2
such that 3 is a “more uniform” latent representation. Quantization is then performed in 4-space, after which the model returns to the original representation through 5. This preserves the residual-quantization machinery while reconditioning the geometry on which nearest-neighbor assignment operates (Wei et al., 29 Apr 2026).
Within CARD, this mechanism is paired with a visual semantic unit that unifies textual, visual, and collaborative signals into a structured visual representation prior to encoding. NU-RQ-VAE is therefore not introduced as an isolated quantizer, but as the quantization component of a broader two-stage generative recommendation framework (Wei et al., 29 Apr 2026).
3. Learnable invertible transformation
CARD specifies two dimension-wise monotonic parameterizations for 6, each intended to map individual coordinates toward 7 with roughly uniform density. In both cases, transformation parameters are learned jointly with the encoder, decoder, and codebooks (Wei et al., 29 Apr 2026).
The first is a Kumaraswamy-based transformation: 8 with
9
and inverse
0
The second is a scaled logistic-logit transformation: 1 with inverse
2
where
3
In vector form, the transformed and inverse-transformed latents are written
4
The Kumaraswamy and logistic-logit variants are reported separately in the experimental section as NU-RQ-VAE5 and NU-RQ-VAE6 (Wei et al., 29 Apr 2026).
4. Quantization loop, losses, and training mechanics
After transformation, residual quantization proceeds in 7-space. CARD maintains 8 residual codebooks 9, each
0
With 1, the recursion for 2 is
3
The resulting discrete Semantic ID is
4
and the quantized sum in transformed space is
5
Decoding then uses
6
The backward pass uses a straight-through estimator with gradients
7
The quantization and reconstruction objective consists of three terms. The reconstruction term is
8
The residual-quantization term is
9
where 0 is stop-gradient and 1 balances codebook versus encoder updates. The non-uniform transformation is regularized by the consistency loss
2
The full objective is
3
with 4 tuned in the range 5 (Wei et al., 29 Apr 2026).
The reported training algorithm first obtains 6 from a pretrained vision-language encoder 7, computes 8, applies 9, performs residual quantization, reconstructs through 0 and the decoder, and updates encoder, decoder, transform parameters, and codebooks jointly. After convergence of NU-RQ-VAE, the codebooks and 1 are fixed; all items are quantized into SIDs; and an autoregressive generator, exemplified by T5, is trained over SID sequences (Wei et al., 29 Apr 2026).
5. Instantiated architecture and empirical behavior
CARD reports a concrete implementation of NU-RQ-VAE for generative recommendation. The vision-language encoder is SigLIP2 with 2 on 3 card images. The encoder and decoder are 3-layer MLPs with hidden sizes 4. The codebooks use 5 residual stages, 6 embeddings per codebook, and embedding dimension 7. The autoregressive model is a T5 encoder-decoder with 4 layers, 6 heads, head-dim 8, and model-dim 9. Optimization uses AdamW with learning rate 0 for NU-RQ-VAE and T5 fine-tuning, batch size 1, and 2 (Wei et al., 29 Apr 2026).
| Component | Reported configuration |
|---|---|
| Vision-language encoder | SigLIP2, 3 |
| Encoder/Decoder | 3-layer MLPs, 4 |
| Codebooks | 5, 6, 7 |
| AR model | T5, 4 layers, 6 heads, model-dim 8 |
| Optimization | AdamW, lr 9, batch size 0 |
The empirical motivation for the non-uniform transformation is supported by codeword-utilization and recommendation metrics. On the Food dataset, the RQ-VAE baseline reports Recall@5 / Recall@10 of 1, NU-RQ-VAE2 reports 3, and NU-RQ-VAE4 reports 5. On Phones, RQ-VAE reports 6, while NU-RQ-VAE7 reports 8. Figure 1 is summarized as showing an effective number of used codewords of approximately 9 for TIGER (uniform RQ-VAE), approximately 00 for CARD without NUT, and approximately 01 for CARD with NUT (Wei et al., 29 Apr 2026).
| Model | Food Recall@5 / Recall@10 | Phones Recall@5 / Recall@10 |
|---|---|---|
| RQ-VAE baseline | 02 | 03 |
| NU-RQ-VAE04 | 05 | — |
| NU-RQ-VAE06 | 07 | 08 |
The ablation study further reports, on Food, that full CARD09 achieves 10, whereas removing the non-uniform transform yields 11; removing the visual region yields 12; removing the text region yields 13; removing the collaborative region yields 14; and replacing all “cards” with text-only input yields 15 (Wei et al., 29 Apr 2026).
6. Interpretation, scope, and relation to other non-uniform variants
A central interpretive point is that the term “NU-RQ-VAE” can refer to two distinct, though related, directions. In the RQ-VAE paper, a non-uniform extension is described as a possible modification of the residual quantizer itself: one could introduce stage-specific codebooks 16 of different sizes 17, or allocate per-depth bit budgets 18, with minimal changes to the quantization loop. That possibility is motivated by empirical rate-distortion gains at different residual depths (Lee et al., 2022).
However, the published ablations in RQ-VAE also report that separate per-depth codebooks, each of size 19, produce higher reconstruction FID than a single shared 20-sized codebook. Code-usage histograms across depths show that deeper stages use embeddings of smaller norm, but with substantial overlap, which is presented as evidence that a uniform shared codebook is reused effectively. This creates an important distinction: non-uniformity in the original RQ-VAE discussion is primarily a prospective allocation strategy over residual stages, whereas the implemented NU-RQ-VAE in CARD is a transform-based method that leaves the residual quantization mechanism intact and instead reshapes the latent distribution before quantization (Lee et al., 2022).
This distinction also clarifies a common misunderstanding. NU-RQ-VAE in CARD is not merely “RQ-VAE with unequal codebook sizes.” Its defining operation is the insertion of a codebook-agnostic, per-dimension, learnable, invertible transformation 21 before residual quantization. Because 22 is applied as a pre-quantization layer and only requires closed-form forward and inverse evaluation together with the consistency regularizer 23, CARD describes it as plug-and-play and reports analogous gains when applied beyond RQ-VAE, including R-VQ, PQ, product RQ, and even diffusion-based quantizers (Wei et al., 29 Apr 2026).
Taken together, the two papers position NU-RQ-VAE at the intersection of rate-distortion engineering and distribution-aware quantization. The RQ-VAE substrate provides the coarse-to-fine residual coding and autoregressive sequence-length reduction; CARD adds an explicit mechanism for correcting non-uniform embedding geometry before code assignment. A plausible implication is that future work on NU-RQ-VAE may combine both strands—distribution-shaping transforms and stage-specific allocation—although only the former is instantiated in the CARD results and only the latter is proposed, not validated, in the original RQ-VAE exposition (Lee et al., 2022).