Introduction
Variational Autoencoders (VAEs) are powerful tools for learning latent representations for text generation. However, when paired with Recurrent Neural Networks (RNNs), they frequently suffer from posterior collapse (KL vanishing). In this state, the decoder ignores the latent variables, relying solely on its internal language modeling capacity, which leads to repetitive and generic outputs. Researchers have introduced Timestep-Wise Regularisation VAE (TWR-VAE), a simple architectural modification that enforces KL regularisation at every step of the RNN encoder to mitigate this issue.
Methods: Timestep-Wise Regularisation
The core innovation of TWR-VAE is the application of KL regularisation throughout the encoding process rather than just at the final hidden state.
In a standard RNN-based VAE, only the final hidden state $h^T$ is used to parameterize the latent distribution. TWR-VAE instead imposes KL regularisation on latent variables derived at every single timestep of the encoder. The total KL loss is calculated as the average of these timestep-wise divergences. The authors explored three variants for passing information to the decoder:
- TWR-VAE (Standard): Only the latent variable from the final timestep is passed to the decoder.
- TWR-VAE$_{mean}$: Latent variables sampled at every timestep are averaged.
- TWR-VAE$_{sum}$: Latent variables from all timesteps are summed.
This "plug-and-play" approach prevents the decoder from "giving up" on latent variables early in training by forcing the encoder to remain close to the prior throughout the sequence.
Experimental Results
The model was evaluated on language modelling (PTB, Yelp15, Yahoo) and dialogue response generation (Switchboard, Dailydialog).
As shown in the results table, TWR-VAE significantly outperforms strong baselines like BN-VAE and Cyc-VAE. On the PTB dataset, it achieved a Negative Log-Likelihood (NLL) of 86.6 and a Perplexity (PPL) of 40.9, a substantial improvement over BN-VAE's 100.2 NLL and 96.9 PPL. Beyond metrics, qualitative analysis showed that TWR-VAE creates a smoother latent space, allowing for grammatically and semantically logical interpolation between sentences. In dialogue tasks, the model demonstrated higher diversity in generated responses, effectively avoiding "dull" generic outputs.
Conclusion and Future Work
TWR-VAE provides a robust solution to posterior collapse without requiring complex scheduling like KL annealing. While currently focused on RNN architectures, the success of timestep-wise regularisation suggests it could be a valuable technique for any sequential latent variable model. Future work may explore its application to Transformer-based architectures and other generative tasks like style transfer.
Summary updated