Lune

ICLR2021Top-tier venue

Mirostat: a Neural Text decoding Algorithm that directly controls perplexity

Sourya Basu, Govardana Sachitanandam Ramachandran, Nitish Shirish Keskar, Lav R. Varshney

Abstract

Neural text decoding is important for generating high-quality texts using language models. To generate high-quality text, popular decoding algorithms like top-k, top-p (nucleus), and temperature-based sampling truncate or distort the unreliable low probability tail of the language model. Though these methods generate high-quality text after parameter tuning, they are ad hoc. Not much is known about the control they provide over the statistics of the output, which is important since recent reports show text quality is highest for a specific range of likelihoods. Here, first we provide a theoretical analysis of perplexity in top-k, top-p, and temperature sampling, finding that cross-entropy behaves approximately linearly as a function of p in top-p sampling whereas it is a nonlinear function of k in top-k sampling, under Zipfian statistics. We use this analysis to design a feedback-based adaptive top-k text decoding algorithm called mirostat that generates text (of any length) with a predetermined value of perplexity, and thereby high-quality text without any tuning. Experiments show that for low values of k and p in top-k and top-p sampling, perplexity drops significantly with generated text length, which is also correlated with excessive repetitions in the text (the boredom trap). On the other hand, for large values of k and p, we find that perplexity increases with generated text length, which is correlated with incoherence in the text (confusion trap). Mirostat avoids both traps: experiments show that cross-entropy has a near-linear relation with repetition in generated text. This relation is almost independent of the sampling method but slightly dependent on the model used. Hence, for a given language model, control over perplexity also gives control over repetitions. Experiments with human raters for fluency, coherence, and quality further verify our findings.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

27 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Plug and Play Language Models: A Simple Approach to Controlled Text Generation cites The Curious Case of Neural Text Degeneration
  • Automatic Detection of Generated Text is Easiest when Humans are Fooled cites The Curious Case of Neural Text Degeneration
  • Neural Text Generation With Unlikelihood Training cites The Curious Case of Neural Text Degeneration
  • The Curious Case of Neural Text Degeneration cites Neural Text Generation With Unlikelihood Training
  • Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text Generation cites Neural Text Generation With Unlikelihood Training
  • Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text Generation cites Language Models are Few-Shot Learners
  • Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text Generation cites The Curious Case of Neural Text Degeneration
  • Language Models are Few-Shot Learners cites Automatic Detection of Generated Text is Easiest when Humans are Fooled
  • Language Models are Few-Shot Learners cites The Curious Case of Neural Text Degeneration
  • Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads cites Language Models are Few-Shot Learners
  • Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads cites The Curious Case of Neural Text Degeneration
  • A Contrastive Framework for Neural Text Generation cites Neural Text Generation With Unlikelihood Training
  • A Contrastive Framework for Neural Text Generation cites Language Models are Few-Shot Learners
  • A Contrastive Framework for Neural Text Generation cites The Curious Case of Neural Text Degeneration
  • Do Language Models Plagiarize? cites Automatic Detection of Generated Text is Easiest when Humans are Fooled
  • Do Language Models Plagiarize? cites The Curious Case of Neural Text Degeneration
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers27

  1. Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding HeadsTianle Cai, Yuhong Li, Zhengyang Geng, Hongwu Peng et al.ICML 2024 · 669 citations
  2. A Contrastive Framework for Neural Text GenerationYixuan Su, Tian Lan, Yan Wang, Dani Yogatama et al.NeurIPS 2022 · 349 citations
  3. Scalable Best-of-N Selection for Large Language Models via Self-CertaintyZhewei Kang, Xuandong Zhao, Dawn SongNeurIPS 2025 · 211 citations
  4. Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text GenerationJin Xu, Xiaojiang Liu, Jianhao Yan, Deng Cai et al.NeurIPS 2022 · 135 citations
  5. Do Language Models Plagiarize?Jooyoung Lee, Thai Le, Jinghui Chen, Dongwon LeeWWW 2023 · 109 citations

Builds on5

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
  3. Plug and Play Language Models: A Simple Approach to Controlled Text GenerationSumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung et al.ICLR 2020 · 1,166 citations
  4. Neural Text Generation With Unlikelihood TrainingSean Welleck, Ilia Kulikov, Stephen Roller, Emily Dinan et al.ICLR 2020 · 683 citations
  5. Automatic Detection of Generated Text is Easiest when Humans are FooledDaphne Ippolito, Daniel Duckworth, Chris Callison-Burch, Douglas EckACL 2020 · 21 citations

Related papers

  1. Truncation Sampling as Language Model DesmoothingJohn Hewitt, Christopher D. Manning, Percy LiangEMNLP Findings 2022 · 26 citations
  2. Turning Up the Heat: Min-p Sampling for Creative and Coherent LLM OutputsNguyen Nhat Minh, Andrew Baker, Clement Neo, Allen G. Roush et al.ICLR 2025
  3. Min-k Sampling: Decoupling Truncation from Temperature Scaling via Relative Logit DynamicsYuanhao Ding, Meimingwei Li, Esteban Garces Arias, Matthias Aßenmacher et al.ACL 2026 · 4 citations
  4. On the Efficacy of Sampling AdaptersClara Meister, Tiago Pimentel, Luca Malagutti, Ethan Wilcox et al.ACL 2023 · 3 citations
  5. How Decoding Strategies Affect the Verifiability of Generated TextLuca Massarelli, Fabio Petroni, Aleksandra Piktus, Myle Ott et al.EMNLP Findings 2020 · 39 citations
Dusk over the sea between two cliffs drawn in fine vertical lines