Abstract: Semi-Supervised Variational Autoencoders (SSVAEs) are widely used models for data efficient learning. In this paper, we question the adequacy of the standard design of sequence SSVAEs for the task of text classification as we exhibit two sources of overcomplexity for which we provide simplifications. These simplifications to SSVAEs preserve their theoretical soundness while providing a number of practical advantages in the semi-supervised setup where the result of training is a text classifier. These simplifications are the removal of (i) the Kullback-Liebler divergence from its objective and (ii) the fully unobserved latent variable from its probabilistic model. These changes relieve users from choosing a prior for their latent variables, make the model smaller and faster, and allow for a better flow of information into the latent variables. We compare the simplified versions to standard SSVAEs on 4 text classification tasks. On top of the above-mentioned simplification, experiments show a speed-up of 26%, while keeping equivalent classification scores.
Introduction
In natural language processing (NLP), labeled data is often expensive and time-consuming to produce. Semi-supervised learning aims to mitigate this by leveraging small amounts of labeled data alongside large volumes of unlabeled data. Semi-Supervised Variational Autoencoders (SSVAEs) have become a standard framework for this task, utilizing a generative signal (text reconstruction) to improve the representations learned by the classifier.
However, SSVAEs were originally designed for image generation. When applied to text classification, two primary issues arise. First, autoregressive decoders used in text generation are often too powerful, leading to "posterior collapse" where latent variables are ignored. Second, there is a goal mismatch: classification only requires the encoder, yet the standard design includes complexities that serve the decoder at the expense of the encoder's efficiency.
Methodology: Trimming the Fat
The authors propose two major simplifications to the standard SSVAE framework to make it more suitable for classification tasks:
- Dropping the Unobserved Latent Variable ($z$): Standard SSVAEs use two latent variables: $y$ (the label) and $z$ (an unobserved variable meant to capture style or tone). Since autoregressive decoders are already adept at capturing these nuances, the authors removed $z$ entirely.
- Dropping the KL-Divergence Term: VAEs typically use a KL-divergence term to regularize the latent distribution against a prior (e.g., a standard Gaussian). The authors argue this often hinders effective feature learning. By removing it, the network is free to formulate its own prior based on the data.
Experimental Setup
The approach was evaluated on four diverse text classification benchmarks:
- AG News & DBPedia: Topic classification tasks (4 and 14 classes).
- IMDB & Yelp: Binary sentiment analysis tasks.
Key Results
Equivalent Accuracy and Efficiency
Across all datasets and varying amounts of labeled data (from 1% to 100%), the simplified SSVAEs performed as well as, and often better than, the full models. As shown in the results, removing the KL term and the $z$ variable did not degrade performance; in many cases, it improved scores while providing a significant training speedup of 14% to 26% per iteration.
Better Generalization
In "out-of-domain" tests—where a model is trained on one dataset (e.g., IMDB) and tested on another (e.g., Yelp)—the simplified models frequently outperformed the standard SSVAE. This suggests that the leaner architecture learns more robust and transferable features rather than overfitting to the specific generative noise of the training set.
Conclusion
The findings suggest that for text classification, the "unobserved" components of the VAE are largely unnecessary. By removing these elements, researchers can avoid the headache of choosing priors and benefit from faster, more efficient models without sacrificing accuracy. While these simplified models are less capable of high-quality text generation, they represent a superior choice for the specific goal of semi-supervised classification. Future work may explore if this "less is more" philosophy applies to more complex structured prediction tasks like sequence labeling.
Summary updated