Stochastic memoization is a higher-order construct of probabilistic programming languages that is key in Bayesian nonparametrics, a modular approach that allows us to extend models beyond their parametric limitations and compose them in an elegant and principled manner. Stochastic memoization is simple and useful in practice, but semantically elusive, particularly regarding dataflow transformations. As the naive implementation resorts to the state monad, which is not commutative, it is not clear if stochastic memoization preserves the dataflow property -- i.e., whether we can reorder the lines of a program without changing its semantics, provided the dataflow graph is preserved. In this paper, we give an operational and categorical semantics to stochastic memoization and name generation in the context of a minimal probabilistic programming language, for a restricted class of functions. Our contribution is a first model of stochastic memoization of constant Bernoulli functions with a non-enumerable type, which validates data flow transformations, bridging the gap between traditional probability theory and higher-order probability models. Our model uses a presheaf category and a novel probability monad on it.
翻译:随机记忆化是概率编程语言中的高阶构造,在贝叶斯非参数方法中至关重要——这是一种模块化方法,使我们能够将模型扩展到参数限制之外,并以优雅且原理化的方式组合它们。随机记忆化在实践中简单实用,但在语义上难以捉摸,尤其在数据流变换方面。由于朴素实现采用了非交换的状态单子,因此尚不清楚随机记忆化是否保留数据流性质——即在保持数据流图的前提下,程序代码行的重排是否不会改变其语义。本文针对一个最小概率编程语言中受限函数类别,给出了随机记忆化与名称生成的操作语义和范畴语义。我们的贡献在于首次为具有不可枚举类型的常数伯努利函数的随机记忆化建立了模型,该模型验证了数据流变换,从而弥合了传统概率论与高阶概率模型之间的差距。该模型使用了预层范畴及其上的一种新型概率单子。