Sequential Neural Posterior and Likelihood Approximation

Samuel Wiqvist, Jes Frellsen, Umberto PicchiniarXiv 2021

Introduction

In many scientific disciplines, researchers rely on generative models to describe complex phenomena, ranging from neural firing patterns to ecological population dynamics. While these models can easily simulate data given a set of parameters, the underlying likelihood function—the probability of observing specific data given those parameters—is often mathematically intractable. This challenge has given rise to the field of Simulation-Based Inference (SBI), or "likelihood-free" inference.

Traditional SBI methods typically fall into two categories: Sequential Neural Posterior Estimation (SNPE) and Sequential Neural Likelihood (SNL). SNPE learns the posterior directly but often requires complex and potentially unstable "correction steps" when training data is drawn from a proposal distribution rather than the prior. Conversely, SNL learns the likelihood function but requires computationally expensive Markov Chain Monte Carlo (MCMC) sampling to recover the posterior, creating a significant bottleneck in high-dimensional or multi-modal spaces. This paper introduces Sequential Neural Posterior and Likelihood Approximation (SNPLA), a hybrid approach designed to combine the accuracy of likelihood-based methods with the sampling speed of posterior-based methods.

Methodology: Joint Learning and Reverse KL

SNPLA’s primary innovation is the joint learning of both the likelihood $p(x|\theta)$ and the posterior $p(\theta|x)$ using two separate normalizing flows. Normalizing flows are neural networks that transform simple probability distributions into complex ones through a series of invertible mappings.

The SNPLA Algorithm

The algorithm operates in iterative rounds:

  1. Likelihood Update: Simulations are generated using parameters sampled from a mixture of the prior and the current posterior estimate. The likelihood flow is then updated using standard maximum likelihood estimation (equivalent to minimizing the forward KL divergence).
  2. Posterior Update: Instead of using MCMC to sample from the learned likelihood, SNPLA updates the posterior flow by minimizing the reverse KL divergence. It treats the product of the learned likelihood and the prior as the target distribution.

Because the learned likelihood is a neural network (a "cheap emulator") rather than a slow physical simulator, SNPLA can perform "simulation-on-the-fly" to train the posterior model rapidly. This bypasses the MCMC bottleneck entirely, allowing for near-instantaneous posterior sampling once training is complete.

Experimental Evaluation

The authors evaluated SNPLA across four benchmark problems designed to test different aspects of inference performance:

  • Multivariate Gaussian (MV-G): A baseline with an analytical solution.
  • Two-Moons (TM): A classic challenge featuring a highly non-Gaussian, crescent-shaped, and bimodal posterior.
  • Lotka-Volterra (LV): A stochastic predator-prey model representing time-series data.
  • Hodgkin-Huxley (HH): A complex 10-parameter model of neuronal electrical activity.
Qualitative comparison of posterior approximations for MV-G and Two-Moons tasks across different methods and simulation budgets.

As shown in Figure 1, SNPLA successfully captures the complex, multi-modal structure of the Two-Moons posterior, often outperforming MCMC-based methods like SNL which can struggle to transition between isolated modes.

Key Results and Performance

Massive Computational Speedup

The most striking result of SNPLA is its sampling efficiency. While MCMC-based SNL requires between 300 and 2,200 seconds to generate 1,000 posterior draws, SNPLA achieves the same task in 0.02 to 0.2 seconds. This represents a four-order-of-magnitude improvement in sampling speed, making it highly suitable for real-time applications or large-scale parameter sweeps.

Wall-Clock Efficiency in Complex Models

In the computationally demanding Hodgkin-Huxley task, SNPLA demonstrated superior wall-clock efficiency. It reached a high-accuracy posterior in just 69 minutes, whereas SNL required 726 minutes to achieve comparable performance.

Convergence of negative log-pdf over run-time for the Hodgkin-Huxley model, highlighting SNPLA's rapid convergence compared to traditional methods.

Accuracy and Robustness

Despite the massive speedup, SNPLA maintains competitive accuracy. In the MV-G and HH tasks, its performance was on par with state-of-the-art methods like SNPE-C. Furthermore, by targeting the joint distribution directly via reverse KL, SNPLA avoids the numerical instabilities sometimes associated with the proposal-correction steps in SNPE.

Conclusion and Future Work

SNPLA demonstrates that the MCMC bottleneck in likelihood-based SBI is optional. By leveraging a learned likelihood as a training target for a posterior flow, researchers can achieve the benefits of likelihood modeling—such as having a high-fidelity emulator—without sacrificing inference speed.

Future research may focus on reducing the algorithm's sensitivity to hyperparameters, such as the decay rate $\lambda$ used for sampling. Additionally, integrating convolutional or recurrent architectures into the likelihood flow could allow SNPLA to handle high-dimensional raw data, such as images or long-form time series, without the need for manually engineered summary statistics.

Summary updated

BibTeX
@misc{wiqvist2021sequential,
  author = {Samuel Wiqvist and Jes Frellsen and Umberto Picchini},
  title = {{Sequential Neural Posterior and Likelihood Approximation}},
  year = {2021},
  eprint = {2102.06522},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2102.06522},
}
Figure