用自然语言生成可运行的贝叶斯采样器,提升MCMC开发效率与可靠性
AI4BayesCode: From Natural Language Descriptions to Validated Modular Stateful Bayesian Samplers

- 通过模块化设计将模型分解为可复用的采样单元
- 支持从自然语言直接生成验证过的采样代码,覆盖多种复杂模型
- 适合需要快速实现贝叶斯推断的科研人员和开发者
马尔可夫链蒙特卡洛(MCMC)工作流中的编码与计算仍是主要瓶颈,尤其随着采样算法日益复杂,现有概率编程系统在模型支持、可扩展性和组合性方面仍显不足。我们提出AI4BayesCode,一个可扩展的LLM驱动系统,能将自然语言描述的贝叶斯模型自动转化为可运行且经过验证的MCMC采样器。为提高可靠性,AI4BayesCode采用模块化设计,将模型拆分为采样模块并映射至内置采样组件,减少从零实现复杂算法的需求。可靠性进一步通过预生成阶段的模型规范验证和后生成阶段的代码验证来保障。系统还引入一种新型递归状态化的编码范式,使不同贡献者开发的模块可在大型MCMC流程中一致协同。我们构建了基准测试套件评估其采样器生成能力。实验表明,AI4BayesCode仅凭自然语言描述即可实现多种贝叶斯模型。作为开放系统,其能力可随底层AI代理改进和新内置模块的加入持续扩展。软件已开源:https://ai4bayescode.com/
原文摘要 · Abstract (English)
Coding and computation remain major bottlenecks in Markov chain Monte Carlo (MCMC) workflows, especially as modern sampling algorithms have become increasingly complex and existing probabilistic programming systems remain limited in model support, extensibility, and composability. We introduce \textbf{AI4BayesCode}, an extensible LLM-driven system that translates natural-language Bayesian model descriptions into runnable, validated MCMC samplers. To improve reliability, AI4BayesCode adopts a modular design that decomposes models into modular sampling blocks and maps each block to a built-in sampling component, reducing the need to implement complex sampling algorithms from scratch. Reliability is further improved through pre-generation validation of model specifications and post-generation validation of generated sampler code. AI4BayesCode also introduces a novel recursively stateful coding paradigm for MCMC, allowing modular sampling components, potentially developed by different contributors, to be composed coherently within larger MCMC procedures. We develop a benchmark suite to evaluate AI4BayesCode for sampler-generation. Experiments show that AI4BayesCode can implement a wide range of Bayesian models from natural-language descriptions alone. As an open-ended system, its capability can continue to expand with improvements in the underlying AI agent and the addition of new built-in blocks. The software is available at https://ai4bayescode.com/.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。