Waste Not, Want Not; Recycled Gumbel Noise Improves Consistency in Natural Language Generation

Damien de Mijolla, Hannan Saddiq, Kim Moore

Abstract

Large Language Models (LLMs) often produce inconsistent responses to semantically equivalent prompts due to the stochastic nature of decoding. We present Gumbel Consistency Sampling with Recycling (GCSwR), a novel decoding algorithm that enhances response consistency by "recycling" Gumbel noise across sequences. GCSwR increases semantic similarity by up to 10% without altering marginal distributions or increasing computational overhead.

Introduction

Large Language Models (LLMs) are notoriously fickle. Because they are trained to model a vast space of possible continuations, they rely on stochastic sampling to generate diverse and engaging text. However, this randomness is a double-edged sword: the same model might give wildly different—or even contradictory—answers to two prompts that mean the same thing (e.g., "How do I fix a headache?" vs. "What's the best way to treat head pain?").

While developers often use fixed random seeds to ensure identical inputs produce identical outputs, this doesn't help when the input is slightly reworded. Standard "greedy decoding" provides consistency but often results in repetitive, low-quality text. The challenge is to maintain the high-quality "flavor" of probabilistic sampling while ensuring the model doesn't drift into inconsistent territory due to minor prompt variations.

Methodology: Gumbel Consistency Sampling with Recycling (GCSwR)

The authors propose a novel approach based on the Gumbel reparameterization trick, a standard method for sampling from categorical distributions.

Gumbel Consistency Sampling (GCS)

Instead of drawing new random noise for every prompt, the system uses a shared "latent variable" (a Gumbel noise vector). If two prompts result in similar probability distributions for the next token, using the same noise vector makes it highly likely they will pick the exact same token. This aligns the joint probabilities of the responses while preserving the marginal probabilities of each individual response.

Comparison of independent and correlated sampling for semantically similar prompts.

Recycling (The "wR" in GCSwR)

Simply reusing the same noise at every step in a sequence breaks the mathematical requirements for independent sampling, which can degrade text quality. The authors introduced a "recycling" rule (Theorem 4.2). After a token is chosen, the Gumbel noise vector is mathematically transformed (recycled) in a way that preserves the model's original probability distribution while maintaining a high correlation between different generation runs.

Distributional Ensembling

As a complementary step, the researchers use a separate model to rephrase the user's prompt multiple times. They then ensemble the resulting probability distributions using a geometric mean (minimizing forward-KL divergence) before sampling. This reduces the influence of "semantically irrelevant" prompt variations.

Experimental Setup

The researchers evaluated GCSwR across several benchmarks using models like Llama-3 (8B), Mistral-7B, and Llama-2 (7B):

  • Alpaca: 300 questions rephrased by GPT-4o-mini to test semantic similarity.
  • Code-Alpaca: A subset of 20 coding questions used to measure stylistic consistency (e.g., choice of programming language or commenting style).
  • Aleatoric-List: A synthetic dataset of 20 questions (e.g., "List five European capitals") designed to test stylistic choices like bullet points vs. numerical lists.

Key Results

The primary finding is that GCSwR significantly improves consistency without sacrificing output quality.

  • Semantic Boost: GCSwR combined with ensembling outperformed standard independent sampling by up to 10% in semantic similarity benchmarks.
  • Stylistic Alignment: On the Code-Alpaca dataset, the model became significantly more consistent in its formatting. The probability of consistent stylistic choices increased by roughly 10-15%.
  • Performance across Temperatures: Unlike simply lowering the temperature, which can "dull" reasoning, GCSwR maintains consistency even at higher temperatures where creativity is preserved.
Mean semantic consistency across different models and temperatures with and without Gumbel sampling.
  • Zero Overhead: The algorithm is computationally inexpensive. It requires no additional training and adds negligible latency to the inference process, making it a "drop-in" replacement for standard samplers.

Discussion and Future Work

While GCSwR improves consistency, it inherently reduces diversity. This is ideal for utility-focused tasks like customer support or coding assistance but may be less desirable for creative writing. Future work could explore varying noise "locally" based on specific prompt segments to allow for finer control. Additionally, treating Gumbel noise as a learnable parameter could help build stronger, more consistent safety guards for AI models.

Summary updated

BibTeX
@inproceedings{mijolla2025waste,
  author = {Damien de Mijolla and Hannan Saddiq and Kim Moore},
  title = {{Waste Not, Want Not; Recycled Gumbel Noise Improves Consistency in Natural Language Generation}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-long.292},
}
Figure