Mixed neural posterior estimation for simulators with discrete and continuous parameters

TL;DR

Extends neural posterior estimation (NPE) to support mixed discrete and continuous parameters using a factorized inference network with autoregressive classification and generative models.

cs.LG 🔴 Advanced 2026-05-13 58 views
Jan Boelts Cornelius Schröder Jonas Beck Jakob H. Macke Michael Deistler Daniel Gedon
Bayesian inference simulators deep learning mixed parameters neural networks

Key Findings

Methodology

This paper introduces Mixed Neural Posterior Estimation (MNPE), which decomposes the posterior into discrete and continuous parts. Discrete parameters are modeled via a masked autoregressive density estimator (MADE), while continuous parameters are handled by normalizing flows or diffusion models conditioned on discrete states and data. The joint training maximizes a combined negative log-likelihood, enabling end-to-end learning. Calibration tools combining simulation-based calibration (SBC) for continuous and expected calibration error (ECE) for discrete parameters are proposed. Validation on Gaussian, queueing, and neuroscience simulators demonstrates high accuracy and calibration, outperforming traditional methods.

Key Results

  • In a tractable Gaussian example, MNPE accurately recovered the analytical posterior, with C2ST scores near 0.5 at 1000 samples, indicating indistinguishability from the true distribution.
  • On a queueing simulator with known likelihood, MNPE matched MCMC results closely after 100,000 simulations, with well-calibrated continuous posteriors and reliable discrete class probabilities.
  • Applied to a Hodgkin-Huxley neural model, MNPE jointly inferred ion channel types and conductances, achieving low MSE and good calibration, demonstrating applicability to complex biological systems.

Significance

This work addresses the critical limitation of existing NPE methods that only support pure continuous parameters, enabling efficient inference in models with mixed discrete-continuous spaces. It significantly broadens the scope of simulation-based inference, facilitating applications in neuroscience, systems biology, and engineering where such parameter structures are common. The approach’s end-to-end training and calibration diagnostics ensure reliable, scalable, and interpretable posterior estimates, advancing the field toward more complex, realistic models.

Technical Contribution

The core technical innovation lies in the factorization of the joint posterior into discrete and continuous components, modeled respectively by MADE and generative models, trained jointly. This avoids complex sampling or embedding strategies used in prior work. The calibration framework combining SBC and ECE offers a comprehensive assessment of posterior quality. The method’s flexibility allows integration with various generative models, supporting scalable, high-dimensional inference with mixed parameters.

Novelty

This is the first systematic framework explicitly designed for mixed discrete and continuous parameters in neural posterior estimation, combining factorized modeling with calibration diagnostics. Unlike prior approaches embedding discrete variables into continuous spaces or relying on MCMC, MNPE provides a unified, scalable, and end-to-end trainable solution, filling a significant gap in simulation-based inference.

Limitations

  • Handling extremely high-dimensional discrete spaces or a very large number of classes may challenge the current network architectures, requiring further optimization.
  • Calibration accuracy depends on sample size; limited data may lead to biased estimates, especially for rare classes.
  • Validation primarily on simulated data; real-world applications may face domain shift and model mismatch issues that need addressing.

Future Work

Future directions include developing more scalable network architectures for high-cardinality discrete spaces, integrating active learning to optimize simulation budgets, and extending the framework to dynamic or temporal models. Additionally, exploring transfer learning and domain adaptation could improve robustness across different simulators and real data scenarios.

AI Executive Summary

Neural posterior estimation (NPE) has revolutionized simulation-based inference by enabling rapid, amortized Bayesian inference without explicit likelihood calculations. However, traditional NPE methods are limited to continuous parameters, restricting their application in many scientific models that involve both discrete states and continuous variables. This paper introduces Mixed Neural Posterior Estimation (MNPE), a novel framework that factorizes the joint posterior into discrete and continuous components, modeled respectively by a masked autoregressive classifier (MADE) and flexible generative models such as normalizing flows or diffusion models. By training these components jointly on simulation data, MNPE achieves accurate, scalable inference for complex models with mixed parameters.

The core idea is to handle the discrete parameters via a classification network that outputs class probabilities, while the continuous parameters are modeled conditioned on the discrete states and data. This factorization simplifies the high-dimensional, hybrid inference problem into manageable sub-tasks, each optimized with suitable loss functions. To ensure the reliability of the posterior estimates, the authors propose a hybrid calibration framework that combines simulation-based calibration (SBC) for continuous parameters with expected calibration error (ECE) for discrete classes. This comprehensive approach provides both visual and quantitative diagnostics, ensuring the inferred posteriors are well-calibrated.

Extensive experiments validate the effectiveness of MNPE across multiple scenarios. In a Gaussian toy problem with analytical solutions, MNPE accurately recovers the true posterior, with C2ST scores near chance. In a queueing system with known likelihood, MNPE matches MCMC results after 100,000 simulations, demonstrating both accuracy and calibration. In a complex Hodgkin-Huxley neural model, MNPE successfully infers ion channel types and conductances, outperforming baseline methods in both accuracy and calibration metrics.

This work significantly advances the field of simulation-based inference, enabling efficient, end-to-end learning in models with mixed parameters. Its flexibility and robustness open new avenues in neuroscience, systems biology, and engineering, where such complex models are prevalent. Future research will focus on scaling to higher-dimensional discrete spaces, improving calibration in low-data regimes, and extending to dynamic, time-dependent models, promising a new era of intelligent, automated scientific inference.

Deep Analysis

Background

近年来,模拟器基础的贝叶斯推断逐渐成为科学研究的核心工具。早期方法如MCMC、变分推断在连续参数空间表现优异,但面对离散参数或高维空间时效率低下。神经后验估计(NPE)通过训练神经网络实现端到端的推断,极大简化了流程,已在天体物理、神经科学等领域应用。尽管如此,现有NPE多局限于纯连续参数,难以处理实际模型中的混合参数空间。近期,Diffusion SBI尝试将离散参数嵌入连续空间或用模型索引表示,但仍存在表示复杂性与效率问题。混合MCMC虽能处理离散连续参数,但调参繁琐,难以实现大规模快速推断。本文在此背景下,提出支持混合参数的MNPE,旨在解决这一瓶颈。

Core Problem

科学模型中的参数空间常包含离散类别(如状态、类型)与连续变量(如速率、强度),传统NPE难以直接建模此类空间。现有方法多采用嵌入或扩散技术,或依赖繁琐的采样器,导致推断效率低、校准困难。如何在保持端到端训练优势的同时,有效表达混合参数的后验分布,成为亟待解决的难题。此外,缺乏系统的校准工具,难以评估推断质量,限制了方法的实际应用。

Innovation

本研究的核心创新在于:1)引入因子化模型,将后验分解为离散与连续两个部分,简化高维复杂空间的表达;2)利用掩码自回归分类器(MADE)高效建模离散参数的类别分布,支持多类别、多参数的灵活组合;3)结合正则流或扩散模型进行连续参数的条件建模,实现端到端训练,避免繁琐调参;4)提出结合模拟校准(SBC)与分类校准(ECE)的混合校验工具,系统评估后验质量。这些创新使MNPE在保持高效性的同时,显著提升了推断的准确性与可靠性。

Methodology

  • �� 采样:从混合先验中采样参数θ = (θd, θc),运行模拟器获得数据x。
  • �� 后验因子化:将后验p(θ|x)分解为p(θd|x)与p(θc|θd,x)。
  • �� 离散参数建模:使用MADE网络输出类别概率,处理类别数任意。
  • �� 连续参数建模:利用正则流或扩散模型,条件于θd与x,训练联合网络。
  • �� 损失函数:最大化联合负对数似然,分离连续与离散部分的损失。
  • �� 校准:结合模拟校准(SBC)与分类校准(ECE)评估推断质量。
  • �� 训练:端到端优化网络参数,支持多参数、多类别。
  • �� 评估:在高斯模拟器、排队系统及神经元模型上验证性能,包括准确性与校准指标。

Experiments

在高斯模拟器中,验证MNPE能准确复现分析解,C2ST得分接近0.5。排队模拟器中,MNPE与MCMC结果高度一致,训练样本达10万次后,后验校准良好。神经元模型中,MNPE成功推断复杂参数,表现出低MSE与良好校准。每个场景都采用不同的指标(C2ST、rank统计、ECE)进行性能评估,验证了模型的泛化能力与校准效果。超参数通过交叉验证优化,确保模型稳定性。

Results

MNPE在高斯模拟器中,准确复现分析后验,C2ST得分在1000样本时接近随机(0.5);在排队模拟器中,训练10万次后,后验与MCMC高度一致,连续参数rank统计均匀,离散参数校准良好;在神经元模拟器中,MNPE成功识别离子通道类型与参数,MSE低,校准指标优异。这些结果表明,MNPE能在不同复杂度场景中实现高效、准确的混合参数推断。

Applications

该方法适用于神经科学、系统生物学、工程设计等领域中的复杂模拟器,支持同时推断离散状态与连续参数,提升模型理解与优化效率。未来可结合主动学习与迁移学习,扩展到动态与时间序列模型,推动自动化科学推断的发展。

Limitations & Outlook

当前模型在类别数极多或连续参数维度极高时,训练可能面临性能瓶颈。校准指标在样本有限时偏离理想,需引入更鲁棒的校准技术。实际应用中,模型泛化能力仍需在多场景中验证,未来需优化网络结构与训练策略以应对更复杂的模型需求。

Plain Language Accessible to non-experts

想象你在一家工厂里,工厂有很多不同的机器(代表参数),有些机器的类型是固定的(离散参数),有些机器的速度可以调节(连续参数)。你需要根据工厂的生产线情况,判断每台机器的类型和速度。传统的方法就像用一个简单的工具,只能判断机器的速度,不能区分机器类型。现在,这个新方法就像配备了两套工具:一套专门识别机器类型(分类器),另一套用来调节速度(生成模型)。它们一起工作,能同时告诉你每台机器的类型和速度,而且还能确保这些判断是准确可靠的。这样一来,工厂管理就变得更智能、更高效了。这个方法让科学家们可以更快、更准确地理解复杂模型中的各种参数,特别是那些既有类别又有连续数值的参数组合,就像工厂里不同的机器一样复杂。

ELI14 Explained like you're 14

想象你在玩一个超级复杂的游戏,你需要猜出对手的策略(参数),这个策略有两部分:一种是对手用的角色类型(比如战士、法师),这是个类别(离散参数);另一部分是他们的攻击力或魔法值(连续参数)。以前的方法就像只猜攻击力,忽略了角色类型,结果很难猜准。现在,有了这个新方法,就像你有两个特别的助手:一个专门识别角色类型(用分类器),另一个帮你估算攻击力(用生成模型)。他们一起工作,既能告诉你对手的角色,也能估算他们的攻击力,而且还确保你的猜测是靠谱的。这样一来,你就能更快赢得游戏啦!科学家们用类似的方法,帮电脑更聪明地理解那些既有类别又有连续数值的参数,比如神经细胞的类型和它们的电流强度,帮助研究更深入、更准确。

Glossary

Neural Posterior Estimation (NPE) (神经后验估计)

一种利用神经网络直接学习参数后验分布的方法,无需显式计算似然函数,支持端到端训练。

本文扩展了NPE以支持混合参数空间。

Masked Autoregressive Density Estimator (MADE) (掩码自回归密度估计器)

一种利用掩码机制实现自回归建模的神经网络,用于高效估计多类别离散参数的条件概率。

用于建模离散参数的类别分布。

Normalizing Flow (正则流)

一种可逆变换,将复杂分布映射到简单分布,实现高效密度估计与采样。

用于连续参数的条件建模。

Simulation-Based Calibration (SBC) (模拟校准)

一种评估贝叶斯后验校准的技术,通过模拟数据检验后验概率的频率匹配。

用于连续参数的校准评估。

Expected Calibration Error (ECE) (期望校准误差)

衡量分类模型概率预测与实际频率偏差的指标,用于离散参数的校准。

用于离散参数的校准评估。

Open Questions Unanswered questions from this research

  • 1 如何在极高类别数的离散参数空间中保持模型效率?目前的网络结构在类别数极多时可能性能下降,需探索更高效的编码与训练策略。
  • 2 在实际复杂系统中,模型的泛化能力和校准稳定性仍需验证,尤其是在真实数据与模拟数据差异较大的情况下。

Abstract

Neural Posterior Estimation (NPE) enables rapid parameter inference for complex simulators with intractable likelihoods. NPE trains an inference network to estimate a probability density over parameters given data, typically assumed to be \emph{continuous}. However, many scientific models involve parameter spaces that are \emph{mixed}, that is, they contain both discrete and continuous dimensions. We address this limitation by extending NPE to mixed parameter spaces through an inference network that jointly handles discrete and continuous parameters. The inference network factorizes the joint posterior into discrete and continuous components, combining an autoregressive classifier for the discrete parameters with a generative model for the continuous parameters, trained jointly under a single simulation-based objective. In addition, we propose a diagnostic tool to assess the calibration of the mixed posterior approximation. Across tractable toy examples and real-world scientific simulators, our joint inference approach yields accurate and calibrated posteriors. The inference framework is available in the \texttt{sbi} Python package.

cs.LG