[Paper Review] Stochastic Beams and Where to Find Them: The Gumbel-Top-k Trick for Sampling Sequences Without Replacement
This paper introduces Stochastic Beam Search, a novel method that uses the Gumbel-Top-k trick to sample sequences without replacement from factorized sequence models. By stochastically perturbing log-probabilities and applying top-k selection, it enables exact, diverse sampling with only linear model evaluations in k and sequence length, outperforming standard sampling and beam search in diversity and variance reduction for translation and estimator tasks.
The well-known Gumbel-Max trick for sampling from a categorical distribution can be extended to sample $k$ elements without replacement. We show how to implicitly apply this 'Gumbel-Top-$k$' trick on a factorized distribution over sequences, allowing to draw exact samples without replacement using a Stochastic Beam Search. Even for exponentially large domains, the number of model evaluations grows only linear in $k$ and the maximum sampled sequence length. The algorithm creates a theoretical connection between sampling and (deterministic) beam search and can be used as a principled intermediate alternative. In a translation task, the proposed method compares favourably against alternatives to obtain diverse yet good quality translations. We show that sequences sampled without replacement can be used to construct low-variance estimators for expected sentence-level BLEU score and model entropy.
Motivation & Objective
- To address the limitations of standard sampling (duplicates in low-entropy distributions) and deterministic beam search (lack of diversity and no probabilistic interpretation) in sequence modeling.
- To develop a principled method for sampling sequences without replacement that maintains high-quality, diverse outputs.
- To enable low-variance statistical estimators for model metrics like BLEU score and entropy using representative samples.
- To bridge the gap between sampling and beam search by giving beam search a probabilistic interpretation through stochastic perturbation.
Proposed method
- Applies the Gumbel-Top-k trick to factorized sequence models by adding independent Gumbel noise to log-probabilities of next-token distributions.
- Performs beam search on the perturbed log-probabilities, selecting the top-k sequences at each step based on the sum of perturbed scores.
- Uses the property that the argmax of perturbed log-probabilities yields a sample from the categorical distribution (Gumbel-Max trick), extended to top-k for sampling without replacement.
- Implements a top-down sampling strategy that avoids instantiating the full exponential sequence space, maintaining efficiency.
- Leverages the independence of max and argmax in Gumbel processes to ensure valid sampling without replacement.
- Constructs estimators for sentence-level BLEU and model entropy using the sampled sequences, achieving lower variance than Monte Carlo sampling.
Experimental results
Research questions
- RQ1Can the Gumbel-Top-k trick be applied implicitly to factorized sequence models to sample without replacement while avoiding full enumeration of the sequence space?
- RQ2Can Stochastic Beam Search produce diverse, high-quality sequences comparable to sampling and more varied than deterministic beam search?
- RQ3Does Stochastic Beam Search yield lower-variance estimators for model metrics like BLEU score and entropy compared to Monte Carlo sampling?
- RQ4Can the method be used as a principled alternative to both sampling and beam search in sequence modeling tasks?
Key findings
- Stochastic Beam Search successfully generates diverse, non-redundant sequences from neural machine translation models, outperforming standard sampling in diversity metrics.
- The method achieves significantly lower variance in expected BLEU score and model entropy estimators compared to Monte Carlo sampling, especially at low temperature settings (T < 0.5).
- For T = 0.5, the normalized SBS estimator has similar variance to Monte Carlo, but with better sample quality and lower computational cost per sample.
- The algorithm scales linearly with k and sequence length, avoiding the exponential cost of enumerating all sequences.
- The approach provides a theoretical and practical bridge between sampling and beam search, combining the diversity of sampling with the efficiency and quality of beam search.
- The method is implementable as a drop-in replacement for beam search, requiring only perturbation of log-probabilities before the standard beam search procedure.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.