paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Random Variate Generation with Formal Guarantees

具有形式化保证的随机变量生成
PLDI 9(PLDI)2025匹配度 5/10 · 论文涉及有限精度浮点数值程序、概率编程与程序合成,兼具形式化保证和工程实现,与用户的浮点程序分析和概率/贝叶斯程序分析有交叉;但不涉及LLM/Agent或AI与PL的交叉,非核心研究方向。引用 0 inbox
Feras A. Saad, Wonyeol Lee
crossref: 2026-09-10

AI 速览

一句话:提出从有限精度 CDF 数值程序自动合成精确随机变量生成器的方法,兼具形式化保证与熵最优性。

随机变量生成是现代编程语言的基础操作,但传统库基于理想化 Real-RAM 模型,假设可访问均匀实数并做无限精度运算;物理计算机只能读取随机比特并用有限精度算术,导致实际分布未知甚至与目标任意偏离。本文提出具有形式化保证的方法:先用定义累积分布函数(CDF)的有限精度数值程序指定目标分布,再据此生成精确随机变量。作者给出通用全自动合成方法,可为浮点、定点、posit 等二进制格式的数值 CDF 构造精确生成器,保证与 CDF 同精度、不溢出且避免任意精度算术;核心是达到 Knuth-Yao 熵率信息论最优的生成器类的时空最优实现。作者用 C 实现库并在连续与离散分布上评估,运行时间与 GSL 相当,精度与熵效率更高。

问题
传统随机变量生成库基于 Real-RAM 理想模型,在有限精度物理计算机上缺乏理论保证,实际分布可能与目标分布任意偏离。
方法
将目标分布指定为定义 CDF 的有限精度数值程序,并自动合成精确生成器;利用 Knuth-Yao 熵率最优生成器类的时空最优实现。
评估
在 C 中实现库,在多种连续与离散分布上评估,与 GNU Scientific Library 比较运行时间,并考察精度、熵效率与自动化。
原文摘要(Abstract)

Generating random variates is a fundamental operation in diverse areas of computer science and is supported in almost all modern programming languages. Traditional software libraries for random variate generation are grounded in the idealized “Real-RAM” model of computation, where algorithms are assumed to be able to access uniformly distributed real numbers from the unit interval and compute with infinite-precision real arithmetic. These assumptions are unrealistic, as any software implementation of a Real-RAM algorithm on a physical computer can instead access a stream of individual random bits and computes with finite-precision arithmetic. As a result, existing libraries have few theoretical guarantees in practice. For example, the actual distribution of a random variate generator is generally unknown, intractable to quantify, and arbitrarily different from the desired distribution; causing runtime errors, unexpected behavior, and inconsistent APIs. This article introduces a new approach to principled and practical random variate generation with formal guarantees. The key idea is to first specify the desired probability distribution in terms of a finite-precision numerical program that defines its cumulative distribution function (CDF), and then generate exact random variates according to this CDF. We present a universal and fully automated method to synthesize exact random variate generators given any numerical CDF implemented in any binary number format, such as floating-point, fixed-point, and posits. The method is guaranteed to operate with the same precision used to specify the CDF, does not overflow, avoids expensive arbitrary-precision arithmetic, and exposes a consistent API. The method rests on a novel space-time optimal implementation for the class of generators that attain the information-theoretically optimal Knuth and Yao entropy rate, consuming the least possible number of input random bits per output variate. We develop a random variate generation library using our method in C and evaluate it on a diverse set of “continuous” and “discrete” distributions, showing competitive runtime with the state-of-the-art GNU Scientific Library while delivering higher accuracy, entropy efficiency, and automation.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot3095,
  title = {Random Variate Generation with Formal Guarantees},
  author = {Feras A. Saad and Wonyeol Lee},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {PLDI},
  year = {2025},
  doi = {10.1145/3729251}
}