Abstract
Generative language models are usually pretrained on large text corpus via predicting the next token (i.e., sub-word/word/phrase) given the previous ones. Recent works have demonstrated the impressive performance of large generative language models on downstream tasks. However, existing generative language models generally neglect an inherent challenge in text corpus during training, i.e., the imbalance between frequent tokens and infrequent ones. It can lead a language model to be dominated by common and easy-to-learn tokens, thereby overlooking the infrequent and difficult-to-learn ones. To alleviate that, we propose a MiLe Loss function for mitigating the bias of learning difficulties with tokens. During training, it can dynamically assess the learning difficulty of a to-be-learned token, according to the information entropy of the corresponding predicted probability distribution over the vocabulary. Then it scales the training loss adaptively, trying to lead the model to focus more on the difficult-to-learn tokens. On the Pile dataset, we train generative language models at different scales of 468M, 1.2B, and 6.7B parameters. Experiments reveal that models incorporating the proposed MiLe Loss can gain consistent performance improvement on downstream benchmarks.
Introduction: The Problem of Token Imbalance
Language is inherently imbalanced. According to Zipf’s Law, a tiny fraction of words (like "the," "is," or "a") make up the vast majority of any text. For example, in the famous Brown Corpus, just 135 unique tokens cover 50% of the entire dataset.
When we train Large Language Models (LLMs) using standard Cross-Entropy loss, the model spends most of its "energy" learning these frequent, easy-to-predict tokens. Consequently, it often fails to adequately learn infrequent tokens that carry more information but appear less often. While "Focal Loss" (a popular technique from computer vision) tries to fix this by weighting "hard" examples more heavily, it often fails in language modeling because language is "multi-label" in nature. If a model sees "I like playing...", multiple tokens like "basketball," "football," or "golf" are all valid continuations.
Focal Loss might unfairly penalize a model for being uncertain among several correct choices, misidentifying a nuanced situation as a "learning difficulty." This necessitates a more sophisticated approach to identifying truly difficult tokens.
Methodology: MiLe Loss
The authors propose MiLe Loss (Entropy-Weighted Loss) to address this imbalance. Instead of looking only at the probability of the single "ground truth" token, MiLe Loss evaluates the information entropy of the model's entire predicted probability distribution.
- The Logic: If the model’s prediction is "focused" on a few tokens (low entropy), the model is confident, and the token is likely "easy." If the prediction is spread out or uniform (high entropy), the model is uncertain, signaling a "difficult" learning point.
- The Mechanism: MiLe Loss applies a dynamic scaling factor based on this entropy. When entropy is high, the loss is scaled up, forcing the model to pay more attention. When entropy is low, the weight is reduced.
- The Advantage: This approach naturally handles cases with multiple valid next tokens. If several tokens are plausible, the entropy will be high, and the model will continue to refine its understanding of that context without being penalized for not picking the specific word in the training set.
Experimental Setup
The researchers conducted extensive experiments to prove MiLe Loss works at scale:
- Training: They trained models of three sizes (468M, 1.2B, and 6.7B parameters) on The Pile, a massive 825GB dataset of English text across 22 domains.
- Evaluation: They tested the models on a battery of standard benchmarks including Common Sense Reasoning (BoolQ, HellaSwag, PIQA, etc.), Closed-Book QA (TriviaQA, WebQuestions), and General Knowledge (MMLU).
Key Results
MiLe Loss consistently outperformed both standard Cross-Entropy and Focal Loss across almost all tests and model sizes.
- Performance Gains: On the 6.7B parameter model, MiLe Loss achieved a 3.55% improvement over standard loss on TriviaQA (0-shot) and outperformed Focal Loss by 4.17%.
- Perplexity Analysis: A fine-grained analysis showed that MiLe Loss significantly reduced the perplexity (PPL) for medium and difficult tokens, while keeping performance on easy tokens stable.
- Scaling Benefits: The advantages of MiLe Loss became even more pronounced as the models were trained on more tokens (increasing from 100B to 200B tokens), suggesting it scales well with longer training runs.
Conclusion and Future Work
MiLe Loss improves performance simply by changing how the model learns from existing data, rather than requiring larger datasets or more parameters. The core insight is that the model's internal uncertainty (entropy) is a more reliable indicator of learning difficulty than just the probability of the target word.
One primary risk identified is sensitivity to noise. In massive datasets like The Pile, some sequences are just "noise" or "garbage." These will naturally produce high entropy because they are nonsensical. Currently, MiLe Loss might accidentally over-weight these low-quality samples. Future research will focus on distinguishing between "difficult but informative" tokens and "noisy/useless" data to ensure the model doesn't waste its capacity on outliers.
Summary updated