Abstract
Variational Autoencoders (VAEs) are powerful generative models, yet they frequently encounter "latent variable collapse" when applied to text modeling with Recurrent Neural Network (RNN) decoders. In such cases, the model ignores the latent code, leading to a vanishing KL divergence. We introduce Holistic Regularisation VAE (HR-VAE), a novel architecture that addresses this by regularizing every hidden state of the RNN encoder against a standard normal prior. Our approach ensures training stability and high-quality text generation without the need for complex hyperparameter tuning or KL-annealing.
Introduction
The integration of VAEs with RNNs for text generation is hindered by the phenomenon of latent variable collapse. When the decoder is sufficiently expressive (e.g., an LSTM), it often learns to ignore the latent vector $z$ and relies solely on its own internal language modeling capabilities to predict the next word. Mathematically, the KL divergence term in the Evidence Lower Bound (ELBO) objective drops to zero, rendering the latent space uninformative. While previous solutions like KL-annealing or alternative distributions (e.g., von Mises-Fisher) exist, they often require delicate engineering and lack general stability.
Holistic Regularisation
The core contribution of this work is the Holistic Regularisation approach. Unlike standard VAEs that typically derive the latent variable only from the final hidden state of the encoder, HR-VAE treats the entire encoding sequence as a source of regularisation.
In HR-VAE, at each time step $t$ in the input sequence, the encoder's hidden state $h_t$ and cell state $c_t$ are concatenated to estimate the parameters ($\mu_t, \sigma^2_t$) of a latent distribution. The total KL divergence is then calculated as the average across all time steps. This continuous regularisation forces the model to maintain an informative latent space throughout the encoding process, preventing the decoder from finding shortcuts that bypass the latent code. Notably, this architecture allows for a simple 1:1 weighting between reconstruction and KL loss, eliminating the need for complex annealing schedules.
Experimental Evaluation
We evaluated HR-VAE on two standard public benchmarks:
- Penn Treebank (PTB): Over 40,000 sentences from Wall Street Journal articles.
- E2E Text Generation Corpus: Over 50,000 sentences consisting of restaurant reviews.
Performance was measured using Perplexity (PPL) and Negative Log-Likelihood (NLL). We also tested the model in "inputless" decoding settings—a rigorous test where the decoder does not receive ground-truth tokens during generation, forcing it to rely entirely on the latent variable $z$.
Results and Training Stability
HR-VAE demonstrated significant improvements over strong baselines, including VAE-CNN and vMF-VAE. On the PTB dataset, HR-VAE achieved a PPL of 43, a substantial reduction from the 119 achieved by a base VAE-LSTM. In inputless settings on the E2E corpus, HR-VAE reached an NLL of 38, significantly better than the vMF-VAE baseline (NLL 61).
A key advantage of HR-VAE is its training stability. As shown in the loss curves, HR-VAE maintains a healthy, non-zero KL loss that stabilizes quickly. This stability translates to higher qualitative quality; reconstructed sentences are more grammatically correct and semantically faithful to the original input. Baselines often produced repetitive or ungrammatical phrases (e.g., "city city area"), whereas HR-VAE remained robust even in challenging generation tasks.
Conclusion
HR-VAE provides a simple yet effective solution to the problem of latent variable collapse in text-based VAEs. By regularizing the entire encoding process, the model achieves superior performance and training stability without the need for complex heuristics. While future work could explore computational overhead and scalability to very long documents, HR-VAE represents a significant step toward more reliable generative models for natural language.
Summary updated