Abstract
Traditional Probabilistic Topic Models (PTMs), such as Latent Dirichlet Allocation (LDA), have long served as the standard for document representation. However, these models often struggle with direct sparsity control, computational complexity due to normalization constraints, and inference efficiency. This paper introduces Sparse Topical Coding (STC), a non-probabilistic framework that treats topic modeling as a hierarchical sparse coding problem. By relaxing normalization requirements and employing $\ell_1$-regularization, STC achieves "true" sparsity, significant speedups in training and inference, and improved classification performance through its supervised variant, MedSTC.
Introduction
Topic modeling aims to discover the underlying thematic structure in large document collections. While PTMs are theoretically robust, they face practical hurdles. First, achieving sparsity—where a document or word is associated with only a few topics—is difficult with Dirichlet priors, which typically produce dense representations. Second, the requirement for normalized probability distributions leads to complex objective functions that are expensive to optimize. Finally, inference in PTMs often relies on slow sampling or variational methods. STC addresses these issues by moving to a non-probabilistic, sparse-coding regime.
The STC Framework
STC represents each document as a collection of word-level codes ($s$) that aggregate into a document-level code ($\theta$). Unlike standard Non-negative Matrix Factorization (NMF) or flat sparse coding, STC’s hierarchical structure allows individual words to exhibit distinct topical meanings while contributing to a coherent document profile.
The model reconstructs word counts using a linear combination of topical bases (unigram distributions) and a log-Poisson loss function tailored for discrete text data. Because the model is not bound by the simplex constraint (where components must sum to one), $\ell_1$-regularization can be applied directly to both word and document codes. This results in representations where irrelevant topics are exactly zero, enhancing both interpretability and downstream task performance. Optimization is performed via an efficient coordinate descent algorithm, providing closed-form updates for the latent codes.
Supervised Learning with MedSTC
The non-probabilistic nature of STC allows for seamless integration with supervised learning objectives. The authors propose MedSTC, which combines the STC reconstruction loss with a max-margin hinge loss, similar to Support Vector Machines (SVMs). This allows the model to learn topical representations that are discriminative for classification tasks, effectively tuning the topics to the labels provided in the training data.
Experimental Evaluation
The authors evaluated STC and MedSTC on the 20 Newsgroups dataset, a benchmark of approximately 18,800 posts across 20 categories.
Sparsity and Interpretability
A key finding is the superior sparsity achieved by STC compared to LDA and other baselines. As shown in the figure below, STC maintains high sparsity ratios even as the number of topics increases, whereas LDA remains relatively dense.
Qualitatively, this sparsity translates to better word-sense disambiguation. For instance, STC can correctly identify whether the word "speed" refers to computer hardware or physical velocity based on the sparse activation of relevant topical bases.
Performance and Efficiency
In classification tasks, MedSTC consistently outperformed supervised LDA (sLDA) and DiscLDA, with the performance gap widening as the topic count ($K$) increased. Furthermore, STC demonstrated an order-of-magnitude speedup in both training and inference. At $K=100$, STC inference was significantly faster than the variational inference required for LDA, making it a viable candidate for large-scale applications.
Conclusion
Sparse Topical Coding offers a compelling alternative to probabilistic topic modeling by leveraging the strengths of sparse coding and hierarchical representation. By providing direct control over sparsity and significantly reducing computational overhead, STC enables more efficient and interpretable analysis of large-scale text data. Future work includes the development of parallel implementations for massive datasets and the exploration of more sophisticated priors for the topical dictionary.
Summary updated