MedLDA: A General Framework of Maximum Margin Supervised Topic Models

Jun Zhu, Amr Ahmed, Eric P. XingarXiv 2009 · DOI

Abstract: Supervised topic models utilize document's side information for discovering predictive low dimensional representations of documents. Existing models apply the likelihood-based estimation. In this paper, we present a general framework of max-margin supervised topic models for both continuous and categorical response variables. Our approach, the maximum entropy discrimination latent Dirichlet allocation (MedLDA), utilizes the max-margin principle to train supervised topic models and estimate predictive topic representations that are arguably more suitable for prediction tasks. The general principle of MedLDA can be applied to perform joint max-margin learning and maximum likelihood estimation for arbitrary topic models, directed or undirected, and supervised or unsupervised, when the supervised side information is available. We develop efficient variational methods for posterior inference and parameter estimation, and demonstrate qualitatively and quantitatively the advantages of MedLDA over likelihood-based topic models on movie review and 20 Newsgroups data sets.

1. Introduction

Topic models like Latent Dirichlet Allocation (LDA) are powerful tools for discovering latent themes in large text corpora. However, traditional LDA is unsupervised, meaning it does not incorporate document-level labels or side information during the topic discovery process. While "Supervised LDA" (sLDA) models address this by maximizing the joint likelihood of words and labels, likelihood-based estimation is not always optimal for predictive tasks. A model may excel at explaining statistical word distributions while failing to define sharp decision boundaries between categories.

MedLDA (Maximum Entropy Discrimination Latent Dirichlet Allocation) addresses this by integrating the "max-margin" principle—the core of Support Vector Machines (SVMs)—directly into the LDA framework. By optimizing for predictive power rather than just data likelihood, MedLDA discovers latent topics that are significantly more effective for classification and regression tasks.

2. The MedLDA Framework

The MedLDA framework combines hierarchical Bayesian topic modeling with the Maximum Entropy Discrimination (MED) framework. Unlike two-step approaches that first extract topics and then train a classifier, MedLDA performs joint optimization, learning topic representations and classifier parameters simultaneously.

Graphical model representation of MedLDA.

As shown in Figure 1, the model incorporates a response variable $Y_d$ which depends on the latent topic assignments $Z_{d,n}$. Key technical highlights of the framework include:

  • Max-Margin Integration: Instead of just maximizing likelihood, MedLDA adds a set of "expected margin constraints" to the objective function. This essentially embeds an SVM (for classification) or Support Vector Regression (SVR) model inside the topic discovery process.
  • Joint Optimization: By learning topics and classifier parameters together, the model ensures that the discovered topics are "predictive" by design.
  • Variational EM Algorithm: To handle the complex joint distribution, the authors developed an efficient Variational Expectation-Maximization (EM) algorithm, making the model computationally feasible for large-scale datasets.

3. Experimental Evaluation

The authors evaluated MedLDA on two benchmark datasets:

  1. 20 Newsgroups: A document classification dataset containing approximately 20,000 messages across 20 categories.
  2. Movie Review Dataset: A regression task where the model predicts numerical ratings (e.g., 1 to 5 stars) based on review text.

The framework was compared against standard sLDA, DiscLDA, and a decoupled "LDA + SVM" baseline. Two versions were explored: $MedLDA_{full}$, which uses a supervised base, and $MedLDA_{partial}$, which uses an unsupervised base. The "full" version generally performs better due to the tighter coupling between labels and topics.

4. Results and Discussion

4.1 Predictive Performance

On the 20 Newsgroups dataset, MedLDA consistently outperformed sLDA and DiscLDA. Qualitative analysis using t-SNE visualizations revealed that MedLDA's topic representations formed much tighter, more separable clusters than those generated by unsupervised LDA. In regression tasks on movie reviews, MedLDA achieved higher predictive $R^2$ values than sLDA, particularly when the number of topics was small.

4.2 Computational Efficiency

Interestingly, MedLDA for classification proved to be orders of magnitude faster than sLDA. This efficiency stems from the max-margin approach sidestepping the difficult "normalization factor" calculations required in sLDA's probability estimations. MedLDA performs similarly in speed to a standard LDA+SVM pipeline but with significantly higher accuracy.

5. Conclusion

MedLDA demonstrates that incorporating discriminative objectives into generative topic models can yield superior predictive representations. While the model introduces additional hyperparameters, such as the regularization constant $C$, the gains in accuracy and efficiency are substantial. Future work may involve exploring "collapsed" variational bounds or Gibbs sampling to further improve inference accuracy, as well as extending the framework to structured prediction tasks where multiple related labels are predicted simultaneously.

Summary updated

BibTeX
@misc{zhu2009medlda,
  author = {Jun Zhu and Amr Ahmed and Eric P. Xing},
  title = {{MedLDA: A General Framework of Maximum Margin Supervised Topic Models}},
  year = {2009},
  eprint = {0912.5507},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/0912.5507},
}
Figure