
Figure 1:
APT vs
TSNPE.
Top: Prior
(gray) and true pos-
terior (black). APT
matches true posterior
within the prior bounds
but ‘leaks’ into region
without prior support.
TSNPE (ours) matches
true posterior.
A subset of neural network-based methods, known as neural posterior
estimation (NPE) [Papamakarios and Murray, 2016, Lueckmann et al.,
2017, Greenberg et al., 2019], train a neural density estimator on simulated
data such that the density estimator directly approximates the posterior.
Unlike other methods, NPE does not require any further Markov-chain
Monte-Carlo (MCMC) or variational inference (VI) steps. As it provides
an amortized approximation of the posterior, which can be used to quickly
evaluate and sample the approximate posterior for any observation, NPE
allows the application in time-critical and high-throughput inference scenar-
ios [Gonçalves et al., 2020, Radev et al., 2020, Dax et al., 2021], and fast
application of diagnostic methods which require posterior samples for many
different observations [Cook et al., 2006, Talts et al., 2018]. In addition,
unlike methods targeting the likelihood (e.g., neural likelihood estimation,
NLE [Papamakarios et al., 2019, Lueckmann et al., 2019]), NPE can learn
summary statistics from data and it can use equivariances in the simulations
to improve the quality of inference [Dax et al., 2021, 2022].
If inference is performed for a particular observation
xo
, sampling effi-
ciency of NPE can be improved with sequential training schemes: Instead
of drawing parameters from the prior distribution, they are drawn adaptively
from a proposal (e.g., a posterior estimate obtained with NPE) in order to
optimize the posterior accuracy for a particular
xo
. These procedures are
called Sequential Neural Posterior Estimation (SNPE) [Papamakarios and
Murray, 2016, Lueckmann et al., 2017, Greenberg et al., 2019] and have
been reported to be more simulation-efficient than training the neural net-
work only on parameters sampled from the prior, across a set of benchmark
tasks [Lueckmann et al., 2021].
Despite the potential to improve simulation-efficiency, two limitations have impeded a more
widespread adoption of SNPE by practitioners: First, the sequential scheme of SNPE can be unstable.
SNPE requires a modification of the loss function compared to NPE, which suffers from issues that
can limit its effectiveness on (or even prevent their application to) complex problems (see Sec. 2).
Second, several commonly used diagnostic tools for SBI [Talts et al., 2018, Miller et al., 2021,
Hermans et al., 2021] rely on performing inference across multiple observations. In SNPE (in contrast
to NPE), this requires generating new simulations and network retraining for each observation, which
often prohibits the use of such diagnostic tools [Lueckmann et al., 2021, Hermans et al., 2021].
Here, we introduce Truncated Sequential Neural Posterior Estimation (TSNPE) to overcome these
limitations. TSNPE follows the SNPE formalism, but uses a proposal which is a truncated version
of the prior: TSNPE draws simulations from the prior, but rejects them before simulation if they
lie outside of the support of the approximate posterior. Thus, the proposal is (within its support)
proportional to the prior, which allows us to train the neural network with maximum-likelihood in
every round and, therefore, sidesteps the instabilities (and hence ‘hassle’) of previous SNPE methods.
Our use of truncated proposals is strongly inspired by Blum and François [2010] and Miller et al.
[2020, 2021], who proposed truncated proposals respectively for regression-adjustment approaches
in ABC and for neural ratio estimation (see Discussion). Unlike methods based on likelihood(-ratio)-
estimation [Miller et al., 2021, Hermans et al., 2021], TSNPE allows direct sampling and density
evaluation of the approximate posterior, and thus permits computing expected coverage of the full
posterior quickly (without MCMC) and at every iteration of the algorithm, thus allowing to diagnose
failures of the method even for high-dimensional parameter spaces (we term this ‘simulation-based
coverage calibration’ (SBCC), given its close connection with simulation-based calibration, SBC,
Cook et al. [2006], Talts et al. [2018]).
We show that TSNPE is as efficient as the SNPE method ‘Automatic Posterior Transformation’ (APT,
Greenberg et al. [2019]) on several established benchmark problems (Sec. 4.1). We then demonstrate
that for two challenging neuroscience problems, TSNPE—but not APT—can robustly identify the
posterior distributions (Sec. 4.2).
2