NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Improving Open-Ended Text Generation via Adaptive Decoding

Wenhong Zhu, Hongkun Hao, Zhiwei He, Yiming Ai, Rui Wang

Introduction

Large Language Models (LLMs) have revolutionized text generation, yet they still struggle with a fundamental trade-off in open-ended tasks like storytelling. Standard decoding methods often fall into two traps: deterministic methods (like greedy search) frequently lead to repetitive, "boring" loops, while stochastic methods (like top-p or top-k sampling) can introduce low-probability, nonsensical tokens, resulting in incoherent hallucinations.

The core of this problem lies in the fixed nature of current decoding thresholds. In reality, the number of logical next words changes at every step; sometimes only one word makes sense, while at other times, dozens are viable. This paper introduces Adaptive Decoding, a method that dynamically adjusts the candidate token set based on an entropy-driven confidence metric.

Methods: The Mechanics of Confidence

Adaptive Decoding treats the selection of a candidate set as a process of increasing confidence. Rather than using a fixed cumulative probability, the algorithm evaluates how much each additional token contributes to the model's certainty about the next step.

  1. Confidence Metric ($Conf$): The authors define confidence using a min-max scaling of entropy, measuring how much the model has narrowed down the possibilities.
  2. Token Rationality: The algorithm sorts tokens by probability and adds them to the candidate set one by one. A token is included only if its contribution to the system's confidence—the "incremental gain" ($\Delta Conf$)—exceeds a pre-set threshold $\epsilon$.
  3. Dynamic Truncation: This approach allows the candidate set to shrink when the model is certain (a "sharp" distribution) and expand when the context is ambiguous (a "flat" distribution), ensuring that only "rational" choices are considered.
Conceptual diagram of token rationality and confidence-based selection, showing how the candidate set expands or contracts based on incremental confidence gains.

Key Insights: The "Head Shape" of Distributions

A critical observation made by the researchers is that the primary difference in LLM predictions across various models is the shape of the "head" of the probability distribution. A flattened head indicates many valid choices, whereas a sharp head indicates a single dominant path. Adaptive decoding is the first method to explicitly scale the candidate set based on this head shape, moving away from arbitrary heuristics toward a principled, information-theoretic approach.

Comparison of token probability distributions across various LLMs, highlighting how different models exhibit unique 'head' shapes that necessitate adaptive decoding.

Evaluation and Results

The researchers evaluated Adaptive Decoding across diverse benchmarks, including WritingPrompts, WikiText-103, and MT-Bench. The results demonstrate a significant improvement over traditional sampling methods:

  • Human Preference: In blind tests on WikiText-103, humans preferred adaptive decoding over top-k and top-p. Remarkably, 45% of the time, participants found it difficult to distinguish between human-written text and text generated via adaptive decoding.
  • Coherence and Diversity: On the WritingPrompts dataset, the method achieved a MAUVE score of 25.18 (using GPT2-XL), outperforming top-p (21.20) and top-k (22.28). This indicates a superior balance between diversity and coherence.
  • Reasoning Capabilities: Beyond creative writing, adaptive decoding improved performance on mathematical reasoning tasks (GSM8K). By avoiding repetitive traps and sycophancy, the model stayed on a more logical path than it did with greedy decoding.
  • Chat Performance: For Llama2-7B-chat, the method improved the mean MT-Bench score from 6.26 to 6.43 compared to standard top-p sampling.

Conclusion and Future Work

Adaptive Decoding offers a robust solution to the "Goldilocks" problem of text generation. By grounding the decoding process in entropy reduction, it allows LLMs to be creative when necessary and precise when required. While the method introduces a slight computational overhead due to the need for sorting and iterative calculations, its performance gains in coherence and human-like quality are substantial. Future research may extend this entropy-based approach to multimodal generation, such as image and video synthesis.

Summary updated

BibTeX
@inproceedings{zhu2024improving,
  author = {Wenhong Zhu and Hongkun Hao and Zhiwei He and Yiming Ai and Rui Wang},
  title = {{Improving Open-Ended Text Generation via Adaptive Decoding}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=aXD94eATtT},
}
Figure