Abstract
Standard language models often fail when the test data comes from a "minority" topic present in the training set (e.g., a model trained mostly on news performs poorly on restaurant reviews). This paper introduces Topic CVaR, a distributionally robust optimization approach that identifies latent topics and ensures the model performs well across all of them, resulting in significant perplexity reductions on out-of-distribution test sets.
Introduction
Language models (LMs) are typically trained on massive, heterogeneous datasets containing diverse sources like Wikipedia, news, and social media. Standard training employs Maximum Likelihood Estimation (MLE), which minimizes the average error across the entire dataset. However, MLE is inherently "greedy," prioritizing performance on the most frequent data types. If a training set is 90% news articles and 10% restaurant reviews, the resulting model will excel at news but perform mediocrely on reviews. This performance degradation occurs because the model does not sufficiently weight minority subpopulations during training.
The authors aim to solve a challenging problem: training a single, general-purpose model that is robust to unknown shifts in topic proportions at test time, without requiring prior knowledge of the target distribution.
Methodology: Topic CVaR
The authors build on Distributionally Robust Optimization (DRO), specifically adapting the Conditional Value at Risk (CVaR) framework. While standard CVaR minimizes loss on the "worst-case" subset of data, applying it directly to language modeling reveals two major flaws:
- Robustness to "Garbage": If a model is robust to any subset of sentences, it may over-optimize for ungrammatical or noisy "junk" sentences, which naturally exhibit the highest loss.
- The Entropy Trap: Inherently harder topics (like complex news) force the model to focus on them even if improvement is impossible, due to the nature of standard log-loss.
To address these, the authors propose Topic CVaR, which introduces two key innovations:
- Topic-Based Uncertainty Sets: Using Latent Dirichlet Allocation (LDA), the training data is clustered into semantic topics. The model is then optimized to perform well on the worst-performing topic rather than individual data points.
- Baselined Loss: This measures performance relative to a topic's inherent difficulty (entropy), preventing the model from obsessing over unpredictable noise and focusing instead on where it can actually improve.
The optimization is implemented as a two-player minimax game: one player (the model) minimizes loss, while the other (the "adversary") identifies and upweights the topics currently suffering the most.
Experimental Results
The approach was evaluated using the Yelp Review Corpus (minority distribution), the One Billion Word Benchmark (majority news distribution), and the TripAdvisor dataset (for near-transfer testing).
Key findings include:
- Perplexity Gains: On a mixture of 10% Yelp and 90% News, Topic CVaR achieved a 5.5 point perplexity reduction on Yelp reviews compared to standard MLE.
- Proximity to Oracle: Topic CVaR's performance was remarkably close to an "Oracle" model that was explicitly told which sentences were reviews during training.
- Generalization: Even when tested on TripAdvisor hotel reviews (a domain shift from the Yelp training data), Topic CVaR provided a 4 point perplexity reduction over MLE.
- Mitigating Negative Transfer: The authors showed that adding news data to a review-based training set can actually increase perplexity on reviews under MLE; Topic CVaR successfully fixes this "negative transfer."
Conclusion
Topic CVaR demonstrates that robustness is most effective when applied to "meaningful" groups. By grouping data into topics and using baselined loss, the model ignores outliers and focuses on coherent domains. While the method relies on effective topic discovery via LDA and requires careful hyperparameter tuning, it offers a promising path toward more reliable and fair language models across diverse data distributions.
Summary updated