Introduction
Training machine learning models with discrete random variables—such as selecting a word in machine translation or routing a path in a graph—requires estimating the gradient of an expectation. The gold standard for this task is the REINFORCE algorithm. However, REINFORCE is notorious for high variance, leading to unstable and slow training.
To mitigate this, researchers often use multiple samples. Standard sampling with replacement, however, frequently produces duplicate samples, especially when the model is confident (low entropy). These duplicates waste valuable computational budget. This paper introduces the unordered set estimator, a novel method that samples without replacement and applies Rao-Blackwellization to create an unbiased estimator that significantly reduces variance.
The Unordered Set Estimator
The authors develop a unified framework to tackle the inefficiencies of sampling with replacement. The core methodology relies on several key innovations:
- Rao-Blackwellization: The authors start with a crude estimator based on a single sample and mathematically average it over all possible orderings of a set of unique samples. This statistical technique guarantees a reduction in variance without introducing bias.
- The Leave-One-Out Ratio: To maintain an unbiased estimate while sampling without replacement, the method introduces a weighting factor called the "leave-one-out ratio." This adjusts the contribution of each unique sample based on the probability that it would have been included in the sampled set.
- Built-in Control Variate: The authors derive a baseline directly integrated into the estimator. Unlike many variance-reduction techniques that require additional model evaluations, this built-in baseline is computationally "free."
- Gumbel-Top-k Trick: To efficiently sample without replacement in practice, the method utilizes the Gumbel-Top-k trick, selecting the $k$ most likely items after perturbing the logits with Gumbel noise.
Experimental Setup
The unordered set estimator was evaluated across three distinct scenarios:
- Bernoulli Toy Problem: A synthetic task designed to test estimator behavior across different entropy levels (certainty).
- Categorical Variational Auto-Encoder (VAE): Trained on MNIST, testing both a small latent space ($10^2$ categories) and a massive one ($10^{20}$ categories).
- Travelling Salesman Problem (TSP-20): A structured prediction task where the model outputs a sequence of 20 cities.
Key Findings
The unordered set estimator consistently outperformed existing methods by extracting more information from the same number of model evaluations, effectively treating duplicate samples as "dead weight."
As shown in the variance plots above, the unordered set estimator with a built-in baseline achieves the lowest gradient variance across both high-entropy and low-entropy settings. Many gradient estimators work well in high-entropy (uncertain) environments but fail in low-entropy (certain) ones, or vice versa. The unordered set estimator is uniquely consistent across the entire spectrum.
In the VAE experiments on MNIST, the unordered set estimator achieved the lowest log-variance compared to popular alternatives like RELAX and ARSM. Notably, in the massive latent space ($10^{20}$), it remained significantly more stable than standard REINFORCE. Furthermore, in the TSP-20 task, the estimator outperformed the standard REINFORCE baseline and matched the performance of biased "risk" estimators while remaining mathematically unbiased.
Limitations and Future Work
While highly efficient in terms of model evaluations, calculating the "leave-one-out ratios" introduces a small computational overhead ($O(k)$ or $O(2^k)$ depending on the implementation). For very large sample sizes ($k$), this could become a bottleneck, although the authors provide an efficient numerical integration method to mitigate it.
Additionally, the current method treats structured distributions (like sequences) as "flat" categorical distributions. Future work could explore applying this "without replacement" logic locally within the individual steps of a sequence to further enhance performance in complex structured prediction tasks.
Summary updated