---
title: 'RFSQ: Robust Residual Finite Scalar Quantization'
url: https://www.emergentmind.com/topics/robust-residual-finite-scalar-quantization-rfsq
type: topic
---

# RFSQ: Robust Residual Finite Scalar Quantization

Robust Residual Finite Scalar Quantization (RFSQ) is a residual quantization framework built on Finite Scalar Quantization (FSQ) that is designed to keep multi-stage scalar quantization effective when a naive residual stack would otherwise suffer from progressively weaker residual signals. In the formulation introduced for neural compression, RFSQ conditions each residual stage with either learnable scaling factors or invertible layer normalization, while preserving the additive residual decomposition $\hat{\mathbf{z}}=\sum_{k=1}^K \mathbf{q}_k$ and end-to-end training with straight-through gradient estimators [2508.15860]. In later speech codec work, AffectCodec realizes a structurally constrained variant, Block-Diagonal RFSQ (BD-RFSQ), in which emotion and acoustic subspaces are quantized through block-diagonal input and output projections, yielding explicit and structurally guaranteed bit allocation together with a flat token interface for downstream speech language models [2605.23373].

## 1. Origins in finite scalar and residual quantization

FSQ was introduced as a simpler, more stable alternative to classical Vector Quantization (VQ). Rather than learning a codebook, FSQ quantizes each dimension independently to a fixed number of levels. For a scalar $z_i$, the per-dimension quantizer is

$$
\mathrm{FSQ}_i(z_i)
=
\mathrm{round}\Bigl(\frac{z_i(L_i-1)}{2}\Bigr)\,\frac{2}{L_i-1},
$$

so that the overall code-rate is $\sum_i \log_2 L_i$ bits [2508.15860].

The central motivation for RFSQ is the residual magnitude decay problem. Residual quantization repeatedly quantizes the error from the previous stage, but under naive residual FSQ the residual after the first step becomes small enough that subsequent FSQ layers receive vanishingly small signals and contribute little refinement. The generic RFSQ framework was proposed to restore effective multi-stage FSQ while retaining the simplicity of scalar quantization, lookup-free operation, and the absence of learned codebook maintenance [2508.15860].

This original notion of robustness is therefore tied to the stability and efficacy of residual FSQ itself rather than to noisy-channel robustness or attribute preservation. That distinction becomes important in later literature, where the same acronym is adapted to different failure modes and application domains.

## 2. Formal definition of the generic RFSQ framework

In the generic formulation, RFSQ takes an input feature $\mathbf{z}\in\mathbb{R}^d$ and maintains residuals $\{\mathbf{r}_k\}_{k=0}^K$ with $\mathbf{r}_0=\mathbf{z}$. The overall quantized representation is the sum of the stagewise outputs,

$$
\hat{\mathbf{z}}=\sum_{k=1}^K \mathbf{q}_k.
$$

At each stage, the residual is conditioned, passed through FSQ, and then subtracted from the running residual so that exact reconstruction across stages is preserved [2508.15860].

Two conditioning strategies define the canonical RFSQ variants. The first uses a learned positive scalar $\alpha_k$ at each stage:

$$
(\mathbf{q}_k',\_)=\mathrm{FSQ}_k(\alpha_k\,\mathbf{r}_{k-1}),\quad
\mathbf{q}_k=\frac{\mathbf{q}_k'}{\alpha_k},\quad
\mathbf{r}_k=\mathbf{r}_{k-1}-\mathbf{q}_k.
$$

The second uses invertible LayerNorm. In that variant, the residual is normalized by a per-channel affine LayerNorm, quantized, and then mapped back through the inverse transform using the stored statistics, after which the residual is updated. The paper emphasizes that because the normalization statistics are stored, the LayerNorm transform is perfectly invertible [2508.15860].

The corresponding pipeline is straightforward. Starting from $r=z$ and $q_{\mathrm{total}}=0$, each stage applies one of the conditioning strategies, performs an FSQ step, updates $r=r-q_k$, and accumulates $q_{\mathrm{total}}+=q_k$. Each FSQ call also emits discrete indices for entropy coding. The training loss is applied through a shared decoder with straight-through estimators, and no extra regularization on $\alpha_k$ or the LayerNorm parameters is required [2508.15860].

A practical implication is that RFSQ can be inserted into an autoencoder by replacing a single quantizer with a $K$-stage residual FSQ module, adding conditioning before each FSQ stage, and summing the outputs. In the generic image-compression setting, this replacement does not require extra losses or codebook maintenance.

## 3. Empirical profile in neural compression

The initial RFSQ study evaluates the method on ImageNet 1K with images resized to $128\times128$ and normalized to $[0,1]$. The encoder uses three convolutional layers with channels $3\to128\to256\to256$ and output $32\times32\times256$, while the decoder is a symmetric transposed-convolution network that upsamples back to $128\times128\times3$. All methods are compared at the same code rate of $12.0$ bits and total codebook size $4\,096$ [2508.15860].

Optimization is also fixed across methods: Adam with $\beta_1=0.9,\beta_2=0.999$, weight decay $5\times10^{-5}$, initial learning rate $8\times10^{-4}$ with linear decay to zero, warmup over $1\%$ of steps, batch size $2\,048$, training for $50$ epochs, and gradient clipping at $1.0$. The reconstruction objective is

$$
\mathcal{L}
=
\lambda_1\|\mathbf{x}-\hat{\mathbf{x}}\|_1
+
\lambda_p\,\mathrm{LPIPS}(\mathbf{x},\hat{\mathbf{x}}),
\quad
\lambda_1=\lambda_p=1.0.
$$

Under these conditions, the best-performing reported variant is RFSQ-4$\times$1024-LayerNorm, which achieves $L_1=0.102$, perceptual loss $=0.100$, and $\mathrm{PSNR}=22.9$ dB, compared with FSQ at $L_1=0.143$, perceptual loss $=0.182$, and $\mathrm{PSNR}=20.3$ dB [2508.15860].

| Method | $L_1$ / Perceptual | PSNR (dB) |
|---|---:|---:|
| FSQ | 0.143 / 0.182 | 20.3 |
| LFQ | 0.241 / 0.361 | 16.0 |
| VQ-EMA | 0.355 / 0.489 | 12.7 |
| RFSQ-4×1024-LayerNorm | 0.102 / 0.100 | 22.9 |
| RFSQ-4×1024-Scale | 0.103 / 0.101 | 22.9 |
| RFSQ-4×1024-None | 0.113 / 0.121 | 22.2 |

Relative to FSQ, RFSQ-4$\times$1024-LayerNorm yields a $28.7\%$ reduction in $L_1$ error and a $45.1\%$ improvement in perceptual loss. The ablation results further report that LayerNorm adds approximately $4.2\%$ relative $L_1$ gain, $6.8\%$ perceptual gain, and $+1.9$ dB PSNR over vanilla RFSQ, while scaling adds approximately $3.8\%$ $L_1$ gain and $4.1\%$ perceptual gain. Even the “None” variant, which uses pure residual FSQ without explicit conditioning, outperforms single-stage FSQ, supporting the claim that hierarchical decomposition is useful even before the additional conditioning mechanisms are introduced [2508.15860].

The paper also reports faster convergence, more stable training curves, and that four-stage architectures uniformly outperform two-stage ones, with $15$–$17\%$ extra $L_1$ reduction. These observations place RFSQ within a broader line of work that treats residual quantization not merely as a rate-allocation device but as a hierarchical approximation scheme whose later stages require active conditioning to remain useful.

## 4. Block-Diagonal RFSQ in AffectCodec

AffectCodec adapts residual FSQ to an emotion-preserving neural speech codec by imposing structural separation between emotion and acoustic subspaces. Let $U\in\mathbb{R}^d$ be the concatenated codec latent and set $r_0=U$. BD-RFSQ runs $K$ stages, and at stage $k$ it applies a block-diagonal input projection, affine normalization and scalar quantization, inverse-affine transformation, a block-diagonal back-projection, and residual subtraction:

$$
z_k=\pi_{\mathrm{in}}^{(k)}(r_{k-1}),
$$

with

$$
\pi_{\mathrm{in}}^{(k)}
=
\begin{bmatrix}
\pi_{\mathrm{in},e}^{(k)} & 0 \\
0 & \pi_{\mathrm{in},a}^{(k)}
\end{bmatrix},
$$

followed by

$$
s_k=\mathrm{softplus}(\ell_k)+\epsilon,\qquad b_k\in\mathbb{R}^f,
$$

$$
\tilde z_k=s_k\odot (z_k-b_k),\qquad
(\hat{\tilde z_k},I_k)=\mathrm{FSQ}(\tilde z_k),
$$

$$
\hat z_k=\hat{\tilde z_k}\oslash s_k+b_k,\qquad
\hat u_k=\pi_{\mathrm{out}}^{(k)}(\hat z_k),\qquad
r_k=r_{k-1}-\hat u_k,
$$

and the final quantized latent is

$$
\hat U=\sum_{k=1}^K \hat u_k.
$$

At inference, one may truncate $K\to K'$ stages to operate at lower bitrate [2605.23373].

The defining architectural constraint is the block-diagonal structure of the projections. Emotion and acoustic latents are first projected into partitions $U_e=\phi_e(E)\in\mathbb{R}^{d_e}$ and $U_a=\phi_a(A_f)\in\mathbb{R}^{d_a}$ with $d_e+d_a=d$. Each $\pi_{\mathrm{in}}^{(k)}$ and $\pi_{\mathrm{out}}^{(k)}$ is implemented as a $1\times1$ convolution with weight matrix

$$
\begin{bmatrix}
W_e & 0 \\
0 & W_a
\end{bmatrix},
$$

so that emotion dimensions only read and write emotion channels and acoustic dimensions only read and write acoustic channels. The paper states that this enforces the invariant in Proposition B.1: no cross-stream “leakage” can occur inside the quantizer [2605.23373].

A second defining property is explicit bit allocation. Each stage uses $f=f_e+f_a=3+6=9$ scalar FSQ dimensions with level counts

$$
L=[2,2,2,4,4,4,4,4,4].
$$

The per-stage codebook size is therefore

$$
C=\prod_{j=1}^9 L_j = 2^3\cdot 4^6 = 2^{15},
$$

and each stage emits a $15$-bit index, decomposed as $3$ bits for emotion and $12$ bits for acoustics. At a frame rate of $50$ Hz, $K'$ active stages yield bitrate $=15\cdot K'\cdot 50$ bps, so $K'=(2,4,8)$ corresponds to $(1.5,3.0,6.0)$ kbps. The paper emphasizes that this reserves a fixed $20\%$ of bits for emotion at every stage, in contrast to standard RVQ or FSQ codecs where bit allocation emerges implicitly from the loss weighting [2605.23373].

## 5. Training objectives, rate control, and affect preservation

In AffectCodec, BD-RFSQ is embedded in an end-to-end pipeline that first computes acoustic features $A=E_{\mathrm{ac}}(x)$ and frozen emotion features $E=E_{\mathrm{em}}(\mathrm{emo2vec}(x))$, then applies Coarse-granularity Emotion Modulation (CEM), projects the acoustic and emotion branches into $U_a$ and $U_e$, concatenates $U=[U_e;U_a]$, runs the $K$-stage BD-RFSQ forward pass, emits the token sequence $\{I_k\}$, and decodes both the acoustic reconstruction $\hat x$ and the emotion slice $\hat E$ [2605.23373].

The CEM module uses a global emotion embedding $e_g=\mathrm{AttnPool}(E)$ and FiLM on the acoustic pathway:

$$
A_f=\gamma\odot A+\beta
$$

with $\gamma=g(e_g)$ and $\beta=h(e_g)$. The paper describes this as multi-granularity conditioning that augments frame-level emotion signals in the dual-path front end [2605.23373].

The overall optimization objective is

$$
L = L_{\mathrm{rec}} + \alpha\,L_{\mathrm{cm}} + \beta\,L_{\mathrm{emo}} + \lambda\,L_{\mathrm{cycle}} + \delta\,L_{\mathrm{mr}}.
$$

Here $L_{\mathrm{rec}}$ consists of multi-scale mel $L_2$, time-domain $L_1$, and multi-scale STFT adversarial plus feature-matching losses; $L_{\mathrm{cm}}$ is the commitment loss $\|\mathrm{stopgrad}(z)-\hat z\|_2^2$; $L_{\mathrm{emo}}$ is an $L_2$ loss between the reserved emotion partition decoded back into emotion2vec space and the frozen teacher features; $L_{\mathrm{cycle}}$ is a cosine distance between emotion2vec embeddings of the original and reconstructed waveform; and the multi-rate loss is

$$
L_{\mathrm{mr}}
=
\sum_{m\in S_{\mathrm{mr}}}
w_m\bigl[
L_{\mathrm{mel}}(\hat x_m,x)+\eta\,L_{\mathrm{cycle}}(\hat x_m,x)
\bigr],
\qquad
S_{\mathrm{mr}}=\{2,4,8\}.
$$

This loss supervises intermediate quantization depths so as to ensure emotion and acoustic quality at low $K'$ [2605.23373].

The empirical motivation for this design is low-bitrate emotion preservation. On IEMOCAP at $1.5$ kbps, Emotion Degradation Rate (EDR) improves from $17.05\%$ for DAC (RVQ) and $9.09\%$ for X-Codec to $5.27\%$ for BD-RFSQ. Across IEMOCAP, CREMA-D, and ESD at $1.5/3.0/6.0$ kbps, BD-RFSQ achieves the lowest Macro-EDR in $7/9$ conditions and the second-best result in the remaining two conditions. The paper also reports that valence/arousal/dominance MSE corroborates the categorical EDR drops [2605.23373].

The ablation results isolate the contributions of the main components at $1.5$ kbps on IEMOCAP. Replacing BD-RFSQ with RVQ changes MEDR from $5.27\%$ to $14.44\%$; removing multi-rate training yields MEDR $8.37\%$; and removing CEM yields MEDR $6.94\%$. The paper interprets these results as showing that block-diagonal quantization, multi-rate supervision, and multi-granularity emotion conditioning each contribute to robustness at low bitrates [2605.23373].

## 6. Terminological scope and relation to other robustness claims

The term “robust” in RFSQ is not uniform across the surrounding literature. In the original neural compression paper, robustness refers to overcoming residual magnitude decay in multi-stage FSQ through conditioning mechanisms that keep later residual stages effective [2508.15860]. In AffectCodec, the structurally constrained BD-RFSQ variant is robust in the sense of preserving emotion-relevant information under low-bitrate compression by guaranteeing stream-aware partitioning and preventing cross-stream leakage [2605.23373].

A distinct line of work on FSQ-based neural audio codecs studies transmission robustness. In NeuCodec, FSQ is described as naturally redundant and locally smooth because adjacent quantization levels differ by only $2/(n_i-1)$ in embedding space, and the paper reports that FSQ codecs degrade gracefully under a binary-symmetric channel while RVQ codecs collapse for $p\gtrsim0.01$; specifically, NeuCodec’s STOI remains $>0.8$ up to $p=0.1$, and intelligibility persists even at $p=0.2$ [2509.09550]. That paper also includes a final section titled “Toward a Robust-Residual FSQ (RFSQ) framework,” but it explicitly presents residual FSQ quantization, Gray-coded indices, a channel-aware training loss, parity or ECC bits, and an “error-corrector” network as possible modifications and loss terms, with preliminary experiments left for future work rather than as an implemented benchmarked method [2509.09550].

This suggests that RFSQ should be treated as a family of residual-FSQ designs rather than as a single canonical architecture. One instantiation is the generic conditioning framework for neural compression; another is the block-diagonal, attribute-aware realization in AffectCodec; and a third is an outlined but not yet established direction toward channel-aware residual FSQ. A common misconception is therefore to read all uses of “RFSQ” as interchangeable. The published record instead distinguishes between residual-conditioning robustness, structurally protected attribute preservation, and prospective noisy-channel hardening.

## 7. Significance and open directions

Within neural compression, RFSQ occupies a specific position between single-stage FSQ and more elaborate codebook-based residual quantizers. The generic framework preserves FSQ’s advantages—no learnable codebook, stable training, fewer hyperparameters, and lookup-free quantization—while making residual refinement practical through lightweight conditioning [2508.15860]. In speech coding, BD-RFSQ extends that logic by turning bit allocation from an implicit optimization outcome into an explicit architectural constraint, while maintaining a flat token interface that is compatible with downstream speech language models [2605.23373].

The two most developed formulations also point to complementary design principles. The first is residual conditioning: later quantization stages require normalization or scaling if they are to operate on non-degenerate signals. The second is structural partitioning: when a codec latent carries multiple attribute types, quantization can be organized so that specific dimensions are reserved for specific information streams. AffectCodec’s results suggest that structurally protected quantization is an effective principle for preserving emotion-relevant information and may provide a general route toward attribute-aware neural speech compression [2605.23373].

The open directions already articulated in the literature are narrowly specified. One is the extension of residual FSQ toward explicit noisy-channel training, including Gray coding, parity or ECC bits, and a reconstruction loss under random bit flips [2509.09550]. Another is broader deployment of block-diagonal residual quantizers in settings where a latent has multiple semantically distinct partitions, such as emotion and acoustics. A plausible implication is that future RFSQ research will continue to separate the questions of how to stabilize residual scalar quantization, how to allocate bits across structured subspaces, and how to harden discrete representations against transmission errors, even when those questions are discussed under a shared acronym.

Source: https://www.emergentmind.com/topics/robust-residual-finite-scalar-quantization-rfsq