TL;DR
This paper dives deep into how hyperparameters of different text generation decoding strategies affect output quality. They found that no single strategy is universally best, and optimal choices depend heavily on the task and model, offering practical guidance for researchers and practitioners.
What Problem Does This Paper Address?
Large Language Models (LLMs) don't directly output text; they produce probability distributions over words. The process of converting these probabilities into coherent text, called decoding, is crucial but often overlooked. Different decoding strategies (like beam search or nucleus sampling) have hyperparameters that significantly influence the generated text's coherence, fluency, and diversity. However, the exact impact of these hyperparameters across various LLMs, text domains, and evaluation metrics is not well understood. This leads to practitioners often relying on default settings or generic benchmarks, potentially missing out on optimizing text generation quality for specific applications.
Methods
The authors conducted a large-scale empirical study to understand the impact of decoding hyperparameters. They systematically varied hyperparameters for several common decoding strategies:
- Deterministic: Beam search (varying beam width).
- Stochastic: Sampling with temperature, Top-k sampling, and Top-p (nucleus) sampling (varying temperature, k, and p respectively).
- Contrastive: Contrastive search (varying parameters α and k).
- Hyperparameter-free: Adaptive contrastive search was included for comparison.
They evaluated these strategies across seven different LLMs (GPT2-XL, Mistral 7B v0.1/v0.3, Llama 3.1 8B, Deepseek 7B, Qwen2 7B, and Falcon 2 11B) and three text domains (news, Wikipedia, and stories). Text quality was assessed using a suite of automatic metrics: Diversity, MAUVE, and Coherence, combined into a single metric called QText. Human evaluations were also conducted to validate the automatic metrics.
Datasets
The study utilized three distinct datasets for open-ended text generation:
- News: 2,000 articles from Wikinews.
- Wikipedia: 1,314 examples from the WikiText-103 dataset.
- Stories: 1,947 examples from the Project Gutenberg split of BookCorpus.
Each example consisted of a prompt paired with a human-generated continuation. The authors also generated 2.2 million text continuations in total, which they made publicly available along with their codebase.
Key Insights and Ideas
- No One-Size-Fits-All: The most significant takeaway is that optimal decoding strategies and hyperparameter settings are highly context-dependent. What works best for one model or task might not for another.
- Balance is Key: Strategies that heavily prioritize either coherence or diversity tend to underperform. The best results are achieved when there's a good balance between these two crucial aspects.
- Hyperparameters Matter More Than You Think: The choice of decoding strategy and its hyperparameters can have a more substantial impact on text quality than the LLM's size alone. Smaller, older models can sometimes outperform larger ones with the right decoding configuration.
- Human vs. Auto Metrics: While automatic metrics like QText and MAUVE show moderate correlation with human judgments, they don't perfectly capture human preferences. Diversity, in particular, showed a very weak correlation. This highlights the need for more nuanced evaluation methods.
- Contrastive Search Nuances: Contrastive search performs best with moderate values of its parameters (α and k), striking a balance. Extreme values can lead to either very low diversity or very low coherence.
- Sampling Strategies Need Tuning: Sampling methods (temperature, top-k, top-p) offer good performance but require careful hyperparameter tuning to balance coherence and randomness. Higher temperatures and p values generally lead to better results but still need careful selection.
Key Results
- Adaptive Contrastive Search: This hyperparameter-free method achieved strong overall performance, with diversity and QText scores close to human levels.
- Top-p Sampling: Achieved strong performance at p=0.95, with diversity, MAUVE, and QText scores nearing human benchmarks.
- Sampling with Temperature: Higher temperatures (t=0.9 or 1.0) yielded the best results, approaching human scores for diversity, MAUVE, and QText, with coherence closer to human levels than many other strategies.
- Beam Search: Consistently underperformed human references across all metrics, showing low diversity and coherence.
- Human Evaluation Alignment: Human scores showed a moderate, statistically significant positive correlation with QText and MAUVE, a low but significant correlation with Coherence, and a very weak, non-significant correlation with Diversity.
Limitations and Future Work
- Supervised Fine-Tuning (SFT) Models: The study did not explore the impact of these findings on models that have undergone supervised fine-tuning. Future work could investigate this.
- Multilingual Settings: The analysis was exclusively in English. Generalizability to multilingual settings remains untested, though previous work suggests potential for generalization.
- Metric Biases: The automatic metrics used for evaluation (e.g., coherence using OPT 2.7B, MAUVE using GPT-2 embeddings) might introduce biases. Future research could explore these potential biases.
Summary updated