Abstract
Standard wisdom suggests that increasing the decoding temperature is the primary lever for enhancing diversity in language model outputs. However, this paper demonstrates that temperature scaling is often a blunt instrument because models trained with standard Negative Log-Likelihood (NLL) prioritize precision (quality) over recall (coverage). We argue that by shifting from NLL to recall-oriented loss functions during training, we can produce models that are inherently more diverse and significantly more responsive to temperature tuning.
Introduction: The Precision-Recall Trade-off
In generative modeling, the performance of a language model (LM) can be characterized by the trade-off between Precision and Recall. Precision measures the quality of generated samples—whether they are plausible and human-like. Recall measures coverage—whether the model captures the full diversity of the target distribution or merely repeats a few "safe" patterns.
Currently, most autoregressive LMs are trained using Negative Log-Likelihood (NLL). NLL is fundamentally a "mode-seeking" objective; it encourages the model to assign high probability to the most likely tokens. While this excels at ensuring high Precision, it often ignores the "long tail" of diverse possibilities, leading to models that lack variety and become "brittle" when pushed beyond their primary modes.
The Failure of Temperature Scaling
When practitioners seek more diverse text at inference time, they typically increase the decoding temperature ($t$). However, this often leads to a "sparsity trap." If a model has not learned the tail of the distribution during training, increasing the temperature does not uncover valid alternative paths; instead, it pushes the model into "illegal" zones of ungrammatical or nonsensical tokens.
As illustrated in the figure above, a mode-seeking distribution ($Q1$) focuses heavily on a single peak, whereas a mass-covering distribution ($Q2$) better approximates the target distribution ($P$) across its entire support. The corresponding Precision-Recall curves show how different training objectives target different points on this trade-off. Specifically, the red curve (representing a more precision-focused model) drops off sharply in recall, whereas the green curve (a recall-oriented model) maintains better coverage across the spectrum.
Methods: Recall-Oriented Training
To address the limitations of NLL, the authors propose three alternative loss frameworks implemented as weighted NLL, where the importance of each training sample is dynamically adjusted:
- TruncR (Truncated Recall): Inspired by "Loss Truncation," which typically ignores high-loss samples to boost quality. TruncR reverses this logic by focusing on samples the model currently underestimates, forcing it to improve its coverage of the long tail.
- c-Div (Conditional Tsallis alpha-Divergence): This generalizes the GOLD (Generation by Off-policy Learning) method. By adjusting the alpha parameter, the objective becomes more "mass-covering," naturally favoring Recall over Precision.
- lambda-PR: A novel, non-proper loss function that allows practitioners to explicitly target a specific point on the Precision-Recall curve during the training process by adjusting the lambda parameter.
Experimental Results
The proposed methods were evaluated across diverse tasks, including creative writing (WritingPrompts), competitive programming (CodeContests), and mathematical problem-solving (MathQA-Python).
Key Findings:
- Enhanced Diversity: On the WritingPrompts dataset, the lambda-PR loss achieved a Recall of 12.6 compared to NLL’s 8.9, while maintaining nearly identical Precision (81.3 vs 81.4).
- Improved Code Generation: In coding tasks, where diversity is crucial for finding a correct solution among many attempts, recall-oriented models significantly outperformed NLL baselines on the
pass@100metric. They generated a wider variety of potential solutions, increasing the probability of passing unit tests. - Temperature Responsiveness: Models trained with c-Div exhibited "healthier" P&R curves. As temperature increased, these models gained Recall without the immediate, catastrophic drop in Precision seen in standard NLL models.
Conclusion
The study concludes that for a model to be effectively tunable via temperature, it must be trained for coverage. A model trained solely for Precision identifies the best path but lacks knowledge of viable alternatives. By incorporating recall-oriented objectives like TruncR or lambda-PR, we can move beyond the limitations of inference-time heuristics and build language models that are fundamentally more expressive, diverse, and robust.
Summary updated