Abstract
Supervisory signals can help topic models discover low-dimensional data representations which are useful for a specific prediction task. We propose a framework for training supervised latent Dirichlet allocation (sLDA) that treats prediction accuracy as a formal constraint. This Prediction-Constrained sLDA (PC-sLDA) forces the model to find topics that are predictive of labels even when the generative signal from the text is dominant or misspecified.
Introduction
Topic models like Latent Dirichlet Allocation (LDA) are widely used to extract interpretable themes from large text corpora. Supervised LDA (sLDA) extends this by incorporating labels to learn task-specific topics. However, sLDA often suffers from an "asymmetry" problem: the high dimensionality of text data (e.g., 1,000 words) overwhelms the sparse supervisory signal (e.g., one label). Consequently, the model prioritizes explaining the text over predicting the label. Furthermore, if the data violates LDA's "bag-of-words" assumptions, the learned topics may become irrelevant to the prediction task.
Methods: Prediction-Constrained Training
To address these issues, we introduce Prediction-Constrained (PC) training. Instead of maximizing the joint likelihood $p(\text{words}, \text{labels})$, we maximize the marginal likelihood of the words $p(\text{words})$ subject to a constraint on the predictive accuracy $p(\text{labels} | \text{words})$.
Using Karush-Kuhn-Tucker (KKT) conditions, we reformulate this as an unconstrained objective weighted by a scalar $\lambda$: $$\mathcal{L} = \log p(\text{words}) + \lambda \log p(\text{labels} | \text{words})$$ The $\lambda$ parameter allows for tuning the balance between data explanation and predictive power.
To ensure tractability, we use a Maximum A Posteriori (MAP) embedding of the topic distribution, calculated via an Exponentiated Gradient algorithm. Since this embedding is differentiable, the entire model can be optimized end-to-end using stochastic gradient descent.
Key Insights
A critical observation is that standard sLDA assumes labels are available during training to help explain words, a condition that does not hold at test time. PC-sLDA explicitly models the "words-to-labels" pipeline used during prediction, making it more robust.
Furthermore, the generative term $p(\text{words})$ allows the model to leverage unlabeled data (semi-supervision), which is particularly effective when labeled data is scarce (e.g., 5-10% of the corpus).
Experimental Results
We evaluated PC-sLDA across synthetic and real-world datasets:
- Toy Bars: PC-sLDA was the only model to successfully ignore prominent bar patterns to identify the specific "signal" pixel required for prediction.
- Text Classification: On Movie and Yelp reviews, PC-sLDA achieved accuracy comparable to high-dimensional Logistic Regression while maintaining topic interpretability. It significantly outperformed other supervised variants like MedLDA and BP-sLDA in low-label regimes.
- Clinical EHR: In predicting antidepressant success from EHR codes, PC-sLDA discovered clinically relevant topics (e.g., "behavioral counseling") that generic models missed.
Conclusion
PC-sLDA provides a robust framework for supervised topic modeling by treating prediction as a constraint. This approach mitigates the swamping effect of large text data and improves performance under model misspecification. Future work includes applying this constraint-based framework to other latent variable models like Variational Autoencoders.
Summary updated