Optimal approximate sampling from discrete probability distributions
Feras A. Saad, Cameron E. Freer, Martin C. Rinard, Vikash K. Mansinghka
Abstract
This paper addresses a fundamental problem in random variate generation: given access to a random source that emits a stream of independent fair bits, what is the most accurate and entropy-efficient algorithm for sampling from a discrete probability distribution (p 1 , . . . , p n ), where the probabilities of the output distribution ( p1 , . . . , pn ) of the sampling algorithm must be specified using at most k bits of precision? We present a theoretical framework for formulating this problem and provide new techniques for finding sampling algorithms that are optimal both statistically (in the sense of sampling accuracy) and information-theoretically (in the sense of entropy consumption). We leverage these results to build a system that, for a broad family of measures of statistical accuracy, delivers a sampling algorithm whose expected entropy usage is minimal among those that induce the same distribution (i.e., is "entropy-optimal") and whose output distribution ( p1 , . . . , pn ) is a closest approximation to the target distribution (p 1 , . . . , p n ) among all entropy-optimal sampling algorithms that operate within the specified k-bit precision. This optimal approximate sampler is also a closer approximation than any (possibly entropy-suboptimal) sampler that consumes a bounded amount of entropy with the specified precision, a class which includes floating-point implementations of inversion sampling and related methods found in many software libraries. We evaluate the accuracy, entropy consumption, precision requirements, and wall-clock runtime of our optimal approximate sampling algorithms on a broad set of distributions, demonstrating the ways that they are superior to existing approximate samplers and establishing that they often consume significantly fewer resources than are needed by exact samplers.
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.
4 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Random Variate Generation with Formal Guarantees cites Formally Verified Samplers from Probabilistic Programs with Loops and Conditioning
- Efficient Online Random Sampling via Randomness Recycling cites Random Variate Generation with Formal Guarantees
Cited by top-tier papers4
- Fast Exact Leverage Score Sampling from Khatri-Rao Products with Applications to Tensor DecompositionVivek Bharadwaj, Osman Asif Malik, Riley Murray, Laura Grigori et al.NeurIPS 2023 · 14 citations
- Formally Verified Samplers from Probabilistic Programs with Loops and ConditioningAlexander Bagnall, Gordon Stewart, Anindya BanerjeePLDI 2023 · 5 citations
- Random Variate Generation with Formal GuaranteesFeras A. Saad, Wonyeol LeePLDI 2025
- Efficient Online Random Sampling via Randomness RecyclingThomas L. Draper, Feras A. SaadSODA 2026
Related papers
- Energy-Efficient Random Variate Generation via Compressed Lookup TablesJohann Ukrow, Anna Kazachkova, Nicolas Alder, Sven Köhler et al.ICLR 2026
- Instance-Optimality in I/O-Efficient Sampling and Sequential EstimationShyam Narayanan, Václav Rozhon, Jakub Tetek, Mikkel ThorupFOCS 2024
- TURF: Two-Factor, Universal, Robust, Fast Distribution Learning AlgorithmYi Hao, Ayush Jain, Alon Orlitsky, Vaishakh RavindrakumarICML 2022
- No Time to Hash: On Super-Efficient Entropy AccumulationYevgeniy Dodis, Siyao Guo, Noah Stephens-Davidowitz, Zhiye XieCRYPTO 2021 · 7 citations
- Efficient Approximate Algorithms for Empirical Entropy and Mutual InformationXingguang Chen, Sibo WangSIGMOD 2021 · 9 citations
