Introduction
Generating text that is both coherent and creative remains a significant challenge in natural language processing. Traditional decoding strategies often fall into two traps: maximization-based methods, such as beam search, frequently result in repetitive loops, while stochastic methods, like nucleus sampling, often suffer from semantic drift or hallucinations.
Contrastive search was recently introduced to bridge this gap. However, it was initially believed that standard language models (LMs) required an expensive additional training step (SimCTG) to become "isotropic"—meaning their internal word representations are sufficiently distinct. This paper challenges that assumption, demonstrating that most modern LMs are naturally ready for high-quality generation.
The Anisotropy Myth
The core contribution of this research is debunking the belief that most LMs are "anisotropic" (internally cramped). By evaluating a wide range of models, the authors found that the perceived lack of isotropy was largely an artifact of testing smaller, older models like GPT-2 Small and Medium.
As shown in the figure above, models like OPT, GPT-Neo, and larger versions of GPT-2 naturally exhibit high isotropy. This finding implies that the computationally intensive SimCTG training stage is unnecessary for the vast majority of off-the-shelf models available today.
Methodology: How Contrastive Search Works
Contrastive search selects the next token by balancing two competing objectives:
- Model Confidence: The probability of the token according to the language model.
- Degeneration Penalty: A measure of how similar the token's internal representation is to previously generated tokens.
By subtracting the penalty from the confidence, the algorithm forces the model to choose tokens that are likely but distinct from the existing context. The authors prove that in isotropic models, this penalty provides a high-variance "signal" that effectively prevents repetition without sacrificing coherence.
Experimental Setup and Results
The researchers evaluated contrastive search across diverse datasets, including WebText (English generation), WIT (multilingual), HumanEval (code generation), and XSum (summarization).
Key Findings:
- Human-Level Quality: In 12 of 16 languages tested, human evaluators found text generated via contrastive search to be comparable to human-written text.
- Superior Metrics: Contrastive search consistently outperformed nucleus and top-k sampling in diversity and coherence metrics. In specialized tasks like Python code generation, it achieved higher accuracy (Pass@1) than traditional beam search.
- Robustness: Unlike sampling methods, which are highly sensitive to "temperature" hyperparameters, contrastive search remains stable across different settings.
Conclusion and Future Work
This paper proves that contrastive search is a "plug-and-play" solution for modern language models. By leveraging the natural isotropy of larger models, it enables the generation of diverse, non-repetitive, and coherent text without further training. While beam search remains slightly superior for strict tasks like machine translation, contrastive search is now the leading candidate for open-ended generation and knowledge probing.
Summary updated