MoVQGAN Architecture: Enhanced VQGAN with MaskGIT
- MoVQGAN-based Architecture is a two-stage generative framework that uses multichannel quantization and spatially conditional normalization to enhance reconstruction fidelity.
- It integrates a VQ-VAE encoder-decoder with a MaskGIT-based Transformer for parallel discrete token prediction, reducing sampling steps dramatically.
- The design mitigates repeated artifacts seen in standard VQGANs and achieves high photorealistic synthesis quality through innovative training protocols.
MoVQGAN (Modulated Vector-Quantized Generative Adversarial Network) defines a two-stage image generation framework that introduces spatially conditional normalization and multichannel quantization for improved reconstruction fidelity and sample diversity. Addressing limitations in standard VQ-based pipelines—namely, repeated-pattern artifacts due to codebook collapse—MoVQGAN enables effective photorealistic image synthesis via a combination of architectural and training protocol innovations. At the prior modeling stage, it leverages Masked Generative Image Transformer (MaskGIT) for highly parallelizable discrete token prediction, accelerating image sampling while maintaining high output quality (Zheng et al., 2022).
1. Pipeline Overview and Core Motivations
MoVQGAN operates in two stages: (i) a quantizer stage using a VQ-VAE-style encoder-decoder for vector-quantized latent representation of images, and (ii) a prior modeling stage using a bidirectional Transformer to generate latent index maps for image synthesis.
Stage 1: The encoder maps to a continuous latent . Multichannel quantization is applied, generating a discrete latent index tensor . The decoder reconstructs the image.
Stage 2: A MaskGIT-based Transformer is trained to model the prior distribution over discrete index tensors. By conditioning on masked versions of , the Transformer predicts latent tokens in parallel, enabling dramatically reduced sampling steps.
Key motivations relative to standard VQGAN include:
- Mitigating repeated “tile” artifacts from codebook index reuse.
- Injection of spatially variant information through Spatially Conditional Normalization (SCN).
- Expanding representational capacity via multichannel quantization (from to possible codes).
- Faster and more flexible generative prior sampling using MaskGIT over standard autoregressive models.
2. Encoder and Multichannel Quantization Methodology
The encoder follows the VQGAN/Taming Transformers structure, employing Gated ReLU activations and GroupNorm (encoder only). The input sequence of convolutions and residual blocks reduces spatial resolution, outputting .
Multichannel Quantization proceeds by splitting the 256-dimensional feature at each spatial location into chunks of 64 dimensions, quantizing each independently against a shared codebook 0. For each chunk 1 at location 2,
3
and 4.
The discrete index tensor 5 encodes the quantized state per spatial location. Multichannel quantization increases the expressive capacity without scaling the codebook size, making 6 compositional codes possible at constant memory and compute.
Codebook updates follow the standard VQ-VAE commitment and codebook loss formulation: 7 with 8.
3. Spatially Conditional Normalization (SCN) and Decoder Advances
A noted problem in standard VQ-based generators is that decoder activations for locations sharing a codebook index become visually repetitive, leading to tiling artifacts. SCN addresses this by injecting per-location modulation signals derived from the quantized latent.
For each decoder block 9 (in the first three blocks), the pre-activation 0 is normalized via GroupNorm: 1 SCN then applies learned per-position affine transforms from up-/downsampled 2: 3 where 4 and 5 are 6 convs mapping 7 to 8 scale and shift parameters.
The decoder otherwise follows the VQGAN upsampling stack, but only the first three blocks substitute GroupNorm with SCN.
4. Prior Modeling via MaskGIT
Conventional transformer priors factorize 9 and require sequential token prediction, with 0 for 1 maps. MaskGIT instead models 2, with 3 masking a random subset 4 of tokens.
Training: At each step, 5 of tokens are randomly masked (with 6), and the transformer minimizes the cross-entropy over masked positions.
Inference: Starting with all locations masked, at each of 7 iterations (e.g., 8), the transformer predicts logits for all masked tokens in parallel, the most confident 9 are selected to fill, and the process is repeated until all positions are filled. This reduces parallel sampling from 1024 to fewer than 12 steps.
5. Losses and Training Protocols
Stage 1 (Quantizer+Decoder):
- Pixelwise reconstruction: 0
- Perceptual (VGG feature) loss: 1
- Adversarial loss: 2
- VQ codebook and commitment losses per 2.3 above
The total loss is: 3 with weights 4, 5, 6.
Stage 2 (MaskGIT Prior):
- Negative log-likelihood on masked tokens: 7
Training utilizes batch sizes of 48 and 64 for stages 1 and 2, respectively; Adam optimizer with 8, and a base learning rate of 9.
6. Experimental Evaluation and Ablation Analysis
Quantitative and sample quality results on FFHQ and ImageNet highlight substantial gains relative to vanilla VQGAN.
| Model/Dataset | PSNR | SSIM | LPIPS | rFID | FID (Stage 2) | IS (Stage 2) |
|---|---|---|---|---|---|---|
| VQGAN/FFHQ | 22.24 | 0.664 | 0.1175 | 4.42 | 11.4 | — |
| MoVQGAN/FFHQ | 26.72 | 0.821 | 0.0585 | 2.26 | 8.78 | — |
| VQGAN/INet | 19.47 | 0.521 | 0.1950 | 6.25 | — | 78.3 |
| MoVQGAN/INet | 22.42 | 0.673 | 0.113 | 1.12 | 7.22 | 130.1 |
| MaskGIT/INet | — | — | — | — | 6.18 | 182.1 |
MoVQGAN eliminates repeating artifacts observed in past models such as standard VQGAN (“grass-tile” effects, as shown in Fig. 3 of (Zheng et al., 2022)). It also exhibits efficient sampling—8 MaskGIT inference steps versus up to 1024 steps for AR baselines.
Ablations:
- Fourier features combined with SCN and multichannel quantization yield the best rFID (2.26) and FID (8.78).
- Increasing codebook size 0 from 1024 to 16,384 produces negligible rFID improvements in MoVQGAN, but has much more impact in vanilla VQGAN; this suggests code capacity in MoVQGAN is not a limiting factor.
- Increasing number of channels 1 improves PSNR but can degrade Stage 2 FID as sampling complexity increases; 2 yields the best trade-off.
7. Architectural and Implementation Details
- Hardware: 4×Tesla V100 GPUs
- Encoder: Input 3, down to 4
- Quantization: Codebook size 5, code dimension 64, 6 channels per spatial location
- Decoder: Up-convolutional stack, three initial blocks with SCN, all blocks otherwise match VQGAN
- Stage 2 Transformer: 24 layers, 16 heads, 7, 8
- MaskGIT: 8 sampling steps (FFHQ), 12 steps (ImageNet), with progressive random masking schedule
The architecture enables high compression rates, improved quality metrics, and practical inference time for high-resolution image synthesis (Zheng et al., 2022).