Abstract
We extend Stochastic Gradient Variational Bayes to perform posterior inference for the weights of Stick-Breaking processes. This development allows us to define a Stick-Breaking Variational Autoencoder (SB-VAE), a Bayesian nonparametric version of the variational autoencoder that has a latent representation with stochastic dimensionality. We experimentally demonstrate that the SB-VAE, and a semi-supervised variant, learn highly discriminative latent representations that often outperform the Gaussian VAE's.
Introduction
Standard Variational Autoencoders (VAEs) typically utilize a fixed-size Gaussian vector for their latent representation. This design choice requires practitioners to manually tune the number of latent dimensions, often through a tedious process of trial and error. While Bayesian Nonparametrics (BNP) offer models that can adaptively grow in complexity with more data—specifically through Stick-Breaking Processes—integrating these into the VAE framework has historically been challenging.
The primary obstacle is the "reparameterization trick" (Stochastic Gradient Variational Bayes) required for backpropagation through random variables. This trick necessitates a differentiable mapping from a base noise distribution to the target distribution. The Beta distribution, central to stick-breaking processes, lacks a simple, differentiable reparameterization for its shape parameters, hindering its integration into deep learning architectures.
Methods
To overcome the limitations of the Beta distribution, we employ the Kumaraswamy distribution as a differentiable surrogate.
The Kumaraswamy Reparameterization
The Kumaraswamy distribution closely approximates the Beta distribution but features a closed-form inverse Cumulative Distribution Function (CDF). This allows for a straightforward reparameterization: $$x = (1 - u^{1/b})^{1/a}$$ where $u \sim \text{Uniform}(0, 1)$. This enables the use of standard gradient-based optimization.
SB-VAE Architecture
In the SB-VAE, the inference network outputs parameters ($a, b$) for a sequence of Kumaraswamy fractions ($v_k$). These fractions are then used to construct "stick segments" ($\pi_k$) via the standard stick-breaking construction: $$\pi_k = v_k \prod_{j<k}(1-v_j)$$ The resulting latent representation $\pi$ has a stochastic dimensionality. Although implemented with a maximum truncation $K$, the stick-breaking prior encourages the model to utilize only the necessary number of dimensions, effectively performing automatic model selection.
Experimental Setup
We evaluated the SB-VAE on several image benchmarks:
- Frey Faces: A dataset of face images with varying expressions.
- MNIST: The standard handwritten digit dataset.
- MNIST+rot: A variant incorporating rotated digits to test adaptive dimensionality.
- SVHN: Real-world cropped house numbers for semi-supervised evaluation.
Results and Discussion
Our experiments reveal several key advantages of the SB-VAE over traditional Gaussian VAEs.
Discriminative Latent Spaces
While Gaussian VAEs may achieve slightly better reconstruction likelihoods, the SB-VAE learns a significantly more organized latent space. Classes in the SB-VAE latent space exhibit higher cohesion and separation. For instance, using a k-Nearest Neighbor (kNN) classifier on the latent space of MNIST, the SB-VAE achieved a test error of ~8.65%, compared to ~20.96% for the Gaussian VAE.
Adaptive Capacity and Sparsity
The stick-breaking process naturally orders latent variables by importance, acting as a "soft" nested dropout. On the MNIST+rot dataset, the model successfully adapted its capacity, using an average of 28.7 stick breaks compared to 27.4 for standard MNIST. Furthermore, SB-VAEs achieve sparsity by setting latent variables to zero rather than pruning decoder weights, which prevents "component collapsing" and keeps decoder capacity available.
Semi-Supervised Learning
In semi-supervised settings (the "M2" model), the SB-VAE (SB-DGM) demonstrated superior robustness. On SVHN with only 1% labels, the SB-DGM achieved a 61.37% error rate, outperforming the Gaussian version (69.58%) and a standard kNN (76.64%).
Conclusion
The SB-VAE successfully integrates Bayesian nonparametric priors into the VAE framework. While optimization can be slightly slower due to the recursive coupling of gradients, the model offers significant benefits in terms of automatic dimensionality selection and the learning of highly discriminative latent representations. Future work will explore full Dirichlet processes and more dynamic, adaptive neural architectures.
Summary updated