Source-linked AI summary
Fast likelihood-free cosmology with neural density estimators and active learning
Justin Alsing, Tom Charnock, Stephen Feeney, Benjamin Wandelt
TL;DR
Cosmological likelihood-free inference needs high-fidelity posteriors despite expensive simulations. The paper combines neural density estimators, active learning, and data compression in DELFI, achieving high-fidelity inference with O(10^3) simulations for typical tasks and offering a fast alternative to MCMC when likelihoods are known.
Problem
Cosmological likelihood-free inference needs high-fidelity posterior inference while using a feasibly small number of expensive forward simulations.
Method
The paper uses DELFI with neural density estimators, active learning, data compression, and the pydelfi implementation to learn data distributions from simulations.
Results
O(10^3) forward simulations can yield high-fidelity posteriors for typical approximately six-parameter cosmological tasks, while DELFI can outperform MCMC in speed for known likelihoods.
Takeaways & Limitations
pydelfi supports likelihood-free analyses of complex cosmological data using generative models that include physical and observational effects.
Takeaways & Limitations
Deep-network compression can learn simulation features that do not describe the data well, so it should be used cautiously with very high-fidelity simulators.
Abstract
from arXiv · showhide
Likelihood-free inference provides a framework for performing rigorous Bayesian inference using only forward simulations, properly accounting for all physical and observational effects that can be successfully included in the simulations. The key challenge for likelihood-free applications in cosmology, where simulation is typically expensive, is developing methods that can achieve high-fidelity posterior inference with as few simulations as possible. Density-estimation likelihood-free inference (DELFI) methods turn inference into a density estimation task on a set of simulated data-parameter pairs, and give orders of magnitude improvements over traditional Approximate Bayesian Computation approaches to likelihood-free inference. In this paper we use neural density estimators (NDEs) to learn the likelihood function from a set of simulated datasets, with active learning to adaptively acquire simulations in the most relevant regions of parameter space on-the-fly. We demonstrate the approach on a number of cosmological case studies, showing that for typical problems high-fidelity posterior inference can be achieved with just $\mathcal{O}(10^3)$ simulations or fewer. In addition to enabling efficient simulation-based inference, for simple problems where the form of the likelihood is known, DELFI offers a fast alternative to MCMC sampling, giving orders of magnitude speed-up in some cases. Finally, we introduce \textsc{pydelfi} -- a flexible public implementation of DELFI with NDEs and active learning -- available at \url{https://github.com/justinalsing/pydelfi}.
1 INTRODUCTION
Likelihood-free inference enables Bayesian analysis using forward simulations, but cosmology requires high-fidelity posteriors from feasibly few simulations. DELFI with neural density estimators and active learning addresses this challenge and supports the pydelfi implementation.
- Likelihood-free inference uses forward simulations to account for physical and observational effects included in the generative model.
- The central cosmological challenge is achieving high-fidelity posterior inference from a feasibly small number of expensive forward simulations.
- DELFI trains flexible density estimators on simulated data-parameter pairs and can require orders-of-magnitude fewer simulations than traditional ABC methods.
- This paper introduces pydelfi, using neural density estimators and active learning to acquire simulations adaptively in relevant parameter regions.
- The paper presents a review of neural density estimators, active simulation acquisition, data compression, and the pydelfi implementation.
2 DENSITY ESTIMATION LIKELIHOOD-FREE INFERENCE
This section reviews DELFI with neural density estimators and active learning, while the broader methodology also includes data compression and its implementation in pydelfi.
- The paper reviews DELFI using neural density estimators and adaptive acquisition of simulations with active learning.
2.1 DELFI, three ways
DELFI converts inference into density estimation from simulated parameter-data pairs, with three density-modeling choices and a workflow that learns the data distribution conditional on parameters. Neural density estimators, active learning, and data compression address model flexibility, simulation allocation, and dimensionality.
- 2.1 DELFI, three ways: DELFI can model the joint density p(θ, t), the posterior conditional p(θ|t), or the sampling distribution p(t|θ).
- 2.1 DELFI, three ways: Learning p(t|θ) permits flexible simulation acquisition because the conditional sampling distribution does not depend on how simulation parameters were selected.
- 2.1 DELFI, three ways: For compressed, informative summaries, the sampling distribution may be simpler than the posterior or joint distribution, often allowing modest Gaussian-mixture models.
- 2.1 DELFI, three ways: The DELFI workflow runs simulations, fits p(t|θ; w), and evaluates the learned conditional density at observed data to obtain the likelihood.
- 2.1 DELFI, three ways: Efficient DELFI must choose a conditional-density parameterization, acquire simulations in relevant parameter regions, and compress high-dimensional data into informative summaries.
- 2.1 DELFI, three ways: The paper uses neural density estimators and network ensembles, active learning for on-the-fly simulation acquisition, and data-compression schemes to reduce density-estimation dimensionality.
2.2 Neural density estimators
Neural density estimators provide flexible conditional models for simulated summaries given parameters, including mixture density networks and masked autoregressive flows. Training uses simulated pairs and negative log-likelihood objectives, with regularization and ensembles helping control fitting issues.
- 2.2 Neural density estimators: Neural density estimators model p(t|θ; w) with neural networks trained on simulated data-parameter pairs.
- Mixture density networks: Mixture density networks represent p(t|θ) with mixture components whose weights, means, and covariances are neural-network functions of θ.
- Mixture density networks: A single Gaussian mixture component gives a Gaussian likelihood, while additional components provide a more flexible density estimator.
- Masked autoregressive flows: Autoregressive estimators factorize densities into one-dimensional conditionals whose parameters are neural-network functions of preceding summaries and θ.
- Masked autoregressive flows: MAFs stack MADEs, reordering the factorization between layers to address order sensitivity and restrictive simple-conditionals assumptions.
- Training neural density estimators: The estimators are trained by minimizing negative log-likelihood on simulated pairs, with early stopping, dropout, ensembles, or Bayesian networks available for regularization.
2.3 Bayesian networks, deep ensembles and stacked density estimators
Neural density estimator ensembles and Bayesian networks improve robustness when simulations and training data are limited, while also providing uncertainty estimates useful for active learning.
- Small training sets make individual neural density estimators vulnerable to local minima and difficult architecture choices, creating a complexity-versus-overfitting trade-off.
- NDE ensembles combine networks with varied architectures and initializations into stacked density estimators weighted by relative likelihoods or cross-validation scores.
- Ensembles improve robustness to small training sets and architecture choice while estimating uncertainty in the learned likelihood surface for active learning.
- Bayesian networks infer a posterior over network weights, yielding expectation values and principled output uncertainties while helping guard against over-fitting.
- Bayesian networks offer interpretable prior-based regularization, whereas ensembles are typically simpler and cheaper to optimize in practice.
2.4 Adaptive acquisition of simulations with active learning
Active learning targets simulations in relevant, initially unknown parameter-space regions. Sequential proposal-based and deterministic acquisition approaches both adapt simulations during training, with broadly similar reported performance.
- Active learning lets neural density estimators choose simulator parameters on-the-fly to seek high-fidelity inference with fewer simulations.
- Sequential Neural Likelihood: Sequential Neural Likelihood runs simulation batches from proposals based on the current posterior approximation and retrains the density estimators after each batch.
- Sequential Neural Likelihood: The optimal proposal density remains an open question; using the geometric mean of prior and posterior better samples distribution tails and may improve robust convergence.
- Bayesian optimization: Bayesian-optimization acquisition selects parameters maximizing A(θ), which trades off posterior relevance against uncertainty in the learned density surface.
- Bayesian optimization: Despite expectations that deterministic acquisition would be more optimal, Bayesian optimization and SNL showed broadly similar performance in reported DELFI experiments.
2.5 Global versus local emulators
Active learning is suited to inference for data already observed, whereas global emulators support repeated analyses of newly arriving data from the same generating process.
- Local emulators: For data observed before analysis, active learning selectively simulates relevant parameter-space regions to learn p(dobs|θ).
- Global emulators: For repeated independent data realizations, a pre-trained global emulator learns p(d|θ) across the prior volume and enables rapid inference as events arrive.
3 DATA COMPRESSION
Data compression reduces the dimensionality of likelihood-free inference while aiming to retain parameter information, but its usefulness and safety depend on simulation cost, nuisance treatment, and simulator fidelity.
- Whether compression is needed depends on data-vector size relative to the feasible simulation budget required to learn summaries across relevant parameter space.
- Score compression: Score compression reduces N data to p summaries while preserving Fisher information when the likelihood is known and the expansion point is appropriate.
- Nuisance-hardened compression: Nuisance-hardened summaries use Fisher-matrix projection to become insensitive by design to nuisance parameters, while nuisance parameters must still vary in simulations.
- Nuisance-hardened compression: Nuisance projection makes inference complexity depend on the number of interesting parameters, typically relatively small in cosmological applications.
- Deep-network compression: Deep networks can compress complex data into parameter estimators, while IMNNs maximize retained Fisher information through simulation-trained nonlinear summaries.
- Deep-network compression: IMNN compression can require simulations near fiducial parameters, Gaussianize summaries, and permit simpler conditional density estimators requiring fewer simulations to converge.
- Considerations: Raw-data deep compression may learn summaries beyond standard estimators but risks learning simulation-specific features, so it is advised only for very high-fidelity simulators.
4 PYDELFI: A PUBLIC CODE FOR DENSITY ESTIMATION LIKELIHOOD-FREE INFERENCE
pydelfi is a public implementation of DELFI using neural density estimators and active learning. It supports configurable simulation, compression, training, and acquisition workflows for learning likelihoods efficiently.
- pydelfi provides a flexible public implementation of density-estimation likelihood-free inference with neural density estimators and active learning.
- Users configure an ensemble of MDNs, MAFs, or both, then supply simulator and optional compressor functions for generating training pairs.
- pydelfi learns the likelihood from observed data using sequential neural likelihood or Bayesian optimization active learning.
- Simulations can be run in parallel batches, with user control over simulations per round, number of rounds, and network training.
- The learned likelihood stacks early-stopped NDEs weighted by relative cross-validation losses, while ensembles help mitigate over-fitting.
- Fisher pre-training initializes NDEs with a Gaussian approximation having covariance F^-1 before full simulations refine the learned density.
5 CASE STUDY I (VALIDATION): JLA SUPERNOVAE ANALYSIS
The JLA validation applies DELFI to a known Gaussian supernova likelihood, enabling direct comparison with exact-likelihood inference. DELFI converges with roughly 1,000 simulations and agrees closely with MCMC.
- 5.1 JLA data and model: The JLA sample contains 740 type Ia supernovae with apparent magnitudes, redshifts, colors, and stretch parameters.
- 5.1 JLA data and model: The validation assumes flat wCDM cosmology, Gaussian data, fixed covariance, and score compression of the Gaussian likelihood.
- 5.5 Implementation: The DELFI implementation uses SNL, six NDEs, Fisher pre-training, and simulation batches of 250.
- 5.6 Results: O(10^3) simulations achieve convergence, compared with 20,000 simulations for the same problem using the earlier method.
- 5.6 Results: After 1,000 simulations, the DELFI posterior is in excellent agreement with a long-run MCMC chain.
- 5.7 Discussion: For known-likelihood problems, DELFI offers an accurate alternative to MCMC with orders-of-magnitude speed-up for typical approximately six-parameter problems.
6 CASE STUDY II: TOMOGRAPHIC COSMIC SHEAR PSEUDO-CℓANALYSIS
This case study applies DELFI to Euclid-like tomographic cosmic-shear data compressed into pseudo-Cℓ summaries, recovering cosmological parameters with about 1000 simulations. The likelihood-free analysis accommodates masked, noisy maps through forward simulation and can extend to more complex data models.
- Cosmic-shear inference is challenging because nonlinear physics, baryonic feedback, intrinsic alignments, measurement systematics, blending, and masking complicate accurate likelihood construction.
- Tomographic shear data and model: The simulations generate Gaussian tomographic shear maps, add anisotropic shape noise, apply an Euclid-like mask, and compute tomographic pseudo-Cℓ auto- and cross-band powers.
- Data compression: The noisy, masked maps are compressed first into tomographic pseudo-Cℓ band powers and then into approximately Gaussian summaries using score-like compression.
- Tomographic shear data and model: No deconvolution of the mask or subtraction of noise bias is required because these effects are incorporated directly into the forward simulations.
- Results: O(10^3) forward simulations achieve convergence, and after 1000 simulations the DELFI posterior is in excellent agreement with a long-run MCMC posterior.
- Discussion: The analysis targets compressed cosmological-parameter posteriors and can extend forward modelling to catalog- or image-level data, although compression may lose information.
7 CASE STUDY III: IONIZING BACKGROUND FROM HIGH-Z LYMAN-α FORESTS
This case study uses DELFI with hydrodynamical simulations to infer the ionization rate from noisy high-redshift Lyα forest segments. The input ionization rate is well recovered, with ensemble convergence after only O(10^2) simulations.
- Motivation: At z ∼6, Lyα transmission spikes probe the ionization rate and thermal state of the IGM, but the observed-flux likelihood is intractable.
- Data and simulations: The study forward-models Lyα transmission with Sherwood hydrodynamical simulations to infer ΓHI from observed z ∼6 forest segments.
- Scope and limitations: This demonstration fixes the thermal state and history, neglects large-scale ΓHI fluctuations, and uses Lyα alone.
- Data and simulations: The mock pipeline generates skewers through a 40Mpc/h hydrodynamical box, computes transmission including peculiar motions and thermal broadening, and adds Gaussian flux noise.
- Data compression: Flux data are compressed into fifty percentiles and then into a single ΓHI summary using an Information Maximizing Neural Network.
- Results: The DELFI ensemble converges after only O(10^2) simulations, and the input ionization rate is well recovered.
8 CONCLUSIONS AND DISCUSSION
DELFI with neural density estimators and active learning provides efficient likelihood-free cosmological inference, achieving high-fidelity posteriors with relatively few simulations and emulating sampling distributions without restrictive likelihood assumptions. The paper introduces pydelfi and highlights applications ranging from complex generative models to fast inference when likelihoods are known.
- Efficiency: O(10^3) forward simulations can yield high-fidelity posteriors for typical approximately 6-parameter inference tasks when combined with massive data compression.The expected performance may be preserved with additional nuisance parameters through nuisance-parameter-hardened data compression.
- Implementation: pydelfi implements DELFI with neural density estimators, active learning, and data compression as a general-purpose public framework.The implementation includes tutorials and documentation and is intended for likelihood-free analyses of complex cosmological datasets.
- Known-likelihood inference: O(10^3) simulations can provide rapid convergence for typical simple problems, where pydelfi may be faster and more accurate for given resources than MCMC sampling.For known likelihoods, choosing neural density estimators matching the likelihood form can further minimize simulations needed for convergence.
- Case study: O(10^2) simulations were sufficient for extremely fast convergence in the low-dimensional ionizing-background inference case, with the input HI ionization rate well recovered.The posterior shown was obtained after 300 simulations.
- Relation to emulation: DELFI emulates the sampling distribution of summary statistics as a function of parameters, combining expectation emulation and inference without restrictive or ad hoc likelihood assumptions.This extends beyond emulating only the expectation value and using an estimated covariance matrix in a Gaussian likelihood analysis.
- Practical implications: Likelihood-free analysis shifts key cosmological-analysis effort toward constructing faithful forward models and, when needed, data compression, while making assumptions explicit in the forward model.Traditional intermediate estimators, approximate likelihoods, and accurate covariance matrices no longer enter the critical path, although they may remain relevant for compression.