Neural Likelihood Estimation and Sequential Neural Likelihood
Summary
Neural likelihood estimation (NLE) fits a conditional density estimator , in the SNL paper a conditional Masked Autoregressive Flow, to simulated pairs, then runs ordinary MCMC on the surrogate posterior . It is synthetic likelihood with the Gaussian replaced by a flow and the per- refit replaced by one network shared across all . Sequential Neural Likelihood (SNL) adds rounds in which new parameters are proposed from the current posterior estimate. Its key theoretical selling point over SNPE: the proposal does not bias a likelihood estimator, so no importance correction is needed.
Overview
Papamakarios, Sterratt & Murray (2019) start from the defect of sequential posterior estimation. Because parameters are drawn from a proposal rather than the prior, a posterior network “will approximate instead of ”, so “an adjustment of either the learned posterior or the proposed samples must be made to account for sampling from the ‘wrong’ prior” (Sec. 2). SNPE-A’s analytic adjustment can produce negative variances; SNPE-B’s importance weights can have high variance.
SNL “avoids the bias introduced by the proposal, by opting to learn a model of the likelihood instead of the posterior.” The price is that the result is not a posterior but an unnormalized one, and an MCMC step is required on top.
Main Content
The proposal does not bias the likelihood estimate (SNL, Sec. 3, p. 3) ^thm-no-proposal-bias
Let , , and . For large , maximizing is approximately maximizing
This is maximized when the KL is zero on the support of , i.e. when for all with . Hence “as long as we do not exclude parts of the parameter space, the way we propose parameters does not bias learning the likelihood asymptotically. Unlike when learning the posterior, no adjustment is necessary.”
In finite samples the proposal is not irrelevant; it “controls where will be most accurate.” That is the lever SNL pulls: put the training data where the posterior mass is.
Sequential Neural Likelihood (Algorithm 1) ^alg-snl
Input: observed data , estimator , rounds , simulations per round .
- Set and .
- For :
- for : sample with MCMC, simulate , add to ;
- (re-)train on all of and set .
- Return .
After rounds the effective proposal is the mixture . Unlike SNPE, which trains only on the latest round, SNL “trains on all simulations obtained up to each round”, which is legitimate precisely because of the theorem above.
Single-round NLE is the case: train once on prior simulations, then MCMC. The SNL paper calls it “Neural Likelihood (NL)” and uses it as a control “to assess the benefit of SNL’s guiding strategy”; Lueckmann et al. (2021) rename the pair NLE / SNLE.
The estimator: conditional MAF
The likelihood surrogate is a conditional Masked Autoregressive Flow: is the image of under autoregressive bijections , each “implemented by a Masked Autoencoder for Distribution Estimation conditioned on ” with a lower-triangular Jacobian, so
See Normalizing Flows as Conditional Density Estimators. MAF is fast to evaluate (one pass) and slow to sample, exactly the asymmetry that suits a likelihood evaluated inside an MCMC loop.
Recommended defaults (Sec. 5.1). 5 autoregressive layers, each with two hidden layers of 50 tanh units, batch normalization between layers, Adam with minibatch 100 and learning rate , 1000 simulations per round with 5% held out, early stopping after 20 epochs without validation improvement. “These settings were held constant and performed robustly across all experiments.”
The MCMC step. Axis-aligned slice sampling; the chain “persists across rounds” and is burned in for 200 iterations at the start of each round. For higher-dimensional they point to Hamiltonian Monte Carlo, which is available because is differentiable in . Lueckmann et al. (2021, finding 6) later found that “single chains initialized by sampling from the prior with axis-aligned slice sampling … frequently got stuck in single modes” and that transforming parameters to be unbounded mattered; they used 100 chains. The MCMC step is a real source of error, not a formality.
Relationship to synthetic likelihood
The paper classifies Wood’s synthetic likelihood as the direct predecessor: it “estimates the mean and covariance matrix of a batch of data sampled at a given , and then approximates ”, typically “as an inner loop in the context of an MCMC sampler.” Two differences define NLE:
- Shape. A flow is not restricted to Gaussian summaries, so the central-limit argument behind carefully chosen statistics is no longer needed for validity (though good summaries still help).
- Sharing across . Synthetic likelihood spends a fresh batch of simulations at every MCMC state and “requires new simulations for every MCMC step, thus requiring orders of magnitude more simulations” (Lueckmann et al. 2021). NLE interpolates across with one network; the simulator is never called inside the sampler. Gaussian-process surrogate ABC (Meeds & Welling) is the intermediate step, modelling as functions of .
Diagnostics unique to a likelihood surrogate
- Simulation-based calibration on 200 prior draws with 9 near-independent posterior samples each (Sec. 5.2); see Benchmarking and Diagnosing SBI (SBC, Coverage, C2ST).
- Median distance between data simulated at posterior draws and , per round, to judge convergence and “determine the minimum number of rounds.”
- Likelihood goodness-of-fit. Because is a generative model of data, one can simulate points from and from at a fixed and compute their Maximum Mean Discrepancy. “This kind of diagnostic is not possible with methods that approximate the posterior or the likelihood ratio.”
Limits
“SNL relies on estimating the density of the data, which is a hard problem in high dimensions” (Sec. 6). With raw time series or images as , modelling is harder than modelling , which is why NPE and NRE, which can absorb an embedding network, are usually preferred for high-dimensional outputs, and why NLE still leans on summary statistics.
Examples
SLCP: a simple likelihood with a complex posterior (Sec. 5.2). with a uniform prior; is four 2-D points drawn from whose mean and covariance are nonlinear (squared) functions of . The likelihood is a plain Gaussian, yet the posterior “has four symmetric modes (due to squaring), and vertical cut-offs (due to the uniform prior).” The authors’ lesson: “approximating the likelihood can be simpler than approximating the posterior.” Measured by MMD to the true posterior, SNL gave the best accuracy for a given number of simulations; SNPE-A “fails in the second round due to the variance of the proposal becoming negative”, SNPE-B “experiences high variability”, and “SMC-ABC and SL require orders of magnitude more simulations than the sequential neural methods.”
Real simulators. On Lotka-Volterra (4 parameters, 9 features) SNL and SNPE-A performed best; SBC under a broad prior showed SNL “is sometimes over-confident”, traced to prior draws whose populations die out or explode, and calibration was reasonable under a prior restricted to oscillating regimes. On a Hodgkin-Huxley neuron (12 parameters, 18 features) “SNL outperforms all other methods” and the goodness-of-fit curve showed the flow had not fully converged, a cue to run more rounds.
# SNL skeleton
D, post = [], prior
for r in range(R):
theta = post.sample(N) # MCMC on q(x_o | theta) p(theta); prior in round 1
D += [(t, simulate(t)) for t in theta]
fit_flow(q, D) # maximise sum log q(x | theta) over ALL rounds
post = MCMCPosterior(lambda t: q.log_prob(x_o, context=t) + prior.log_prob(t))Connections
- Neural Simulation-Based Inference - Overview - NLE is the “amortized likelihood” panel of the Cranmer et al. taxonomy.
- Synthetic Likelihood - Overview, Synthetic Likelihood Construction, Nicholson’s Blowfly Application - the Gaussian ancestor; SNL uses the same ecological style of benchmark.
- Neural Posterior Estimation (NPE) - the method SNL was designed to fix.
- Neural Ratio Estimation - “mirrors SNL” in plugging a surrogate into MCMC, but learns a ratio with a classifier.
- Implicit Likelihood Estimator - the same learned , used there to estimate expected information gain for implicit models.
- MCMC Basics and HMC and Stan in Practice - the samplers that finish the job.
- Simulation-Based Estimation - Overview - simulated maximum likelihood is the frequentist use of an estimated likelihood; a trained can be maximized as well as sampled.
See Also
- Amortized vs Sequential Inference - what the rounds buy and what they cost.
- Approximate Bayesian Computation for ABMs - the SMC-ABC baseline in the experiments.
- Method of Simulated Moments and Indirect Inference - alternatives when only a point estimate is needed.
- Simulation-Based and Amortized Inference - workflow-level context.