Abstract
Variational autoencoders (VAEs) are powerful tools for learning latent representations of data used in a wide range of applications. In practice, VAEs usually require multiple training rounds to choose the amount of information the latent variable should retain. This trade-off between the reconstruction error (distortion) and the KL divergence (rate) is typically parameterized by a hyperparameter $\beta$. In this paper, we introduce Multi-Rate VAE (MR-VAE), a computationally efficient framework for learning optimal parameters corresponding to various $\beta$ in a single training run. The key idea is to explicitly formulate a response function that maps $\beta$ to the optimal parameters using hypernetworks. MR-VAEs construct a compact response hypernetwork where the pre-activations are conditionally gated based on $\beta$. We justify the proposed architecture by analyzing linear VAEs and showing that it can represent response functions exactly for linear VAEs. With the learned hypernetwork, MR-VAEs can construct the rate-distortion curve without additional training and can be deployed with significantly less hyperparameter tuning. Empirically, our approach is competitive and often exceeds the performance of multiple $\beta$-VAEs training with minimal computation and memory overheads.
Introduction
In the world of Variational Autoencoders (VAEs), practitioners face a fundamental trade-off between Distortion (reconstruction quality) and Rate (latent space compression). This balance is typically controlled by a hyperparameter $\beta$. Finding the optimal $\beta$ for a specific application—the "sweet spot" on the rate-distortion (RD) curve—traditionally requires a tedious and computationally expensive search. Researchers often train dozens of separate models with different $\beta$ values to plot the Pareto frontier, a process that is time-consuming and resource-intensive.
Methodology: Learning the Response Function
The core innovation of Multi-Rate VAE (MR-VAE) is treating the VAE parameters not as fixed weights, but as continuous functions of $\beta$.
Response Functions and Hypernetworks
Instead of learning static weights $\theta$ and $\phi$, MR-VAE learns "response functions" $\theta(\beta)$ and $\phi(\beta)$ that output optimal weights for any given $\beta$. To implement these functions efficiently, the authors utilize a compact hypernetwork architecture. Rather than generating every weight from scratch, which would lead to a massive parameter explosion, they employ a pre-activation gating mechanism.
For each layer in the base VAE, the hypernetwork takes $\log \beta$, applies an affine transformation, and produces a scaling factor that modulates the layer's pre-activations. This allows the model to adapt its internal representations dynamically based on the desired rate-distortion trade-off.
Theoretical Grounding
The authors provide a theoretical justification for this architecture by analyzing Linear VAEs. They prove that using sigmoid activations for the encoder and a specialized square-root-ReLU activation for the decoder allows this specific gating architecture to exactly represent the analytical optimal response functions for the linear case.
Training and Evaluation
During training, MR-VAE does not optimize for a single $\beta$. Instead, it samples a random $\beta$ from a predefined range (e.g., 0.01 to 10) for every mini-batch. This forces the model to learn to be optimal across the entire range simultaneously. Once trained, a practitioner can traverse the entire RD curve instantly at inference time by simply sliding the $\beta$ value.
MR-VAE was evaluated across a diverse set of benchmarks, including:
- Image Reconstruction: MNIST, Omniglot, CIFAR-10, SVHN, and CelebA.
- Text Generation: The Yahoo dataset using autoregressive LSTM VAEs.
- Complex Architectures: Standard CNNs, ResNets, and high-performance Hierarchical VAEs (NVAE).
Key Results and Efficiency
MR-VAE demonstrates remarkable efficiency, adding only about a 5% increase in parameters and training time compared to a single standard VAE run. Despite this minimal overhead, it effectively replaces the need for 10 or more separate training runs required to map an RD curve.
Key findings from the experiments include:
- Competitive Performance: MR-VAE produces RD curves that are competitive with, and often superior to, those generated by multiple individual $\beta$-VAEs.
- Resistance to Posterior Collapse: MR-VAE is more resistant to "dead" latent units. Because the model must solve the task for both low and high $\beta$ simultaneously, the shared structure helps maintain active units even at higher $\beta$ levels where standard VAEs often collapse.
- Smooth Transitions: Because weights are generated from a continuous function, latent representations change smoothly as $\beta$ varies, allowing for fine-grained control over reconstruction detail.
Conclusion
Multi-Rate VAE offers a "train once" solution to the rate-distortion trade-off problem. By leveraging hypernetworks and pre-activation gating, it provides a computationally efficient way to access the full Pareto frontier of a VAE in a single training session. This approach not only saves significant compute time but also provides more robust models that are less prone to posterior collapse.
Summary updated