# simulationbased_inference_with_quantile_regression__40e35c04.pdf Simulation-Based Inference with Quantile Regression He Jia (贾赫) 1 We present Neural Quantile Estimation (NQE), a novel Simulation-Based Inference (SBI) method based on conditional quantile regression. NQE autoregressively learns individual one dimensional quantiles for each posterior dimension, conditioned on the data and previous posterior dimensions. Posterior samples are obtained by interpolating the predicted quantiles using monotonic cubic Hermite spline, with specific treatment for the tail behavior and multi-modal distributions. We introduce an alternative definition for the Bayesian credible region using the local Cumulative Density Function (CDF), offering substantially faster evaluation than the traditional Highest Posterior Density Region (HPDR). In case of limited simulation budget and/or known model misspecification, a post-processing calibration step can be integrated into NQE to ensure the unbiasedness of the posterior estimation with negligible additional computational cost. We demonstrate that NQE achieves state-of-the-art performance on a variety of benchmark problems. 1. Introduction Given the likelihood p(x|θ) of a stochastic forward model and observation data x, Bayes theorem postulates that the underlying model parameters θ follow the posterior distribution p(θ|x) p(x|θ)p(θ), where p(θ) represents the prior. In many applications, however, we are restricted to simulating the data x p(x|θ), while the precise closed form of p(x|θ) remains unavailable. Simulation-Based Inference (SBI), also known as Likelihood-Free Inference (LFI) or Implicit Likelihood Inference (ILI), conducts Bayesian inference directly from these simulations, circumventing the need to explicitly formulate a tractable likelihood function. Early research in this field primarily consists of Approxi- 1Department of Astrophysical Sciences, Princeton University, USA. Correspondence to: He Jia . Proceedings of the 41 st International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024. Copyright 2024 by the author(s). mate Bayesian Computation (ABC) variants, which employ a distance metric in the data space and approximate true posterior samples using realizations whose simulated data are close enough to the observation (e.g. Tavar e et al., 1997; Pritchard et al., 1999; Beaumont et al., 2002; 2009). However, these methods are prone to the curse of dimensionality and prove inadequate for higher-dimensional applications. In recent years, a series of neural-network-based SBI methods have been proposed, which can be broadly categorized into three groups. Neural Likelihood Estimation (NLE, Papamakarios et al., 2019b; Lueckmann et al., 2019) fits the likelihood using a neural density estimator, typically based on Normalizing Flows. The posterior is then evaluated by multiplying the likelihood with the prior, and posterior samples can be drawn using Markov Chain Monte Carlo (MCMC). Neural Posterior Estimation (NPE, Papamakarios & Murray, 2016; Lueckmann et al., 2017; Greenberg et al., 2019) uses neural density estimators to approximate the posterior, thereby enabling direct posterior sample draws without running MCMC. Neural Ratio Estimation (NRE, Hermans et al., 2020) employs classifiers to estimate density ratios, commonly selected as the likelihood-to-evidence ratio. Indeed, Durkan et al. (2020) demonstrates that NRE can be unified with specific types of NPE under a general contrastive learning framework. Each method has its sequential counterpart, namely SNLE, SNPE, and SNRE, respectively. Whereas standard NLE, NPE, and NRE allocate new simulations based on the prior, allowing them to be applied to any observation data (i.e., they are amortized), their sequential counterparts allocate new simulations based on the inference results from previous iterations and must be trained specifically for each observation. These neural-network-based methods typically surpass traditional ABC methods in terms of inference accuracy under given simulation budgets. See Cranmer et al. (2020) for a review and Lueckmann et al. (2021) for a comprehensive benchmark of prevalent SBI methods. Quantile Regression (QR), as introduced by Koenker & Bassett Jr (1978), estimates the conditional quantiles of the response variable over varying predictor variables. Many Machine Learning (ML) algorithms can be extended to quantile regression by simply transitioning to a weighted L1 loss (e.g. Meinshausen & Ridgeway, 2006; Rodrigues & Pereira, 2020; Tang et al., 2022). In this paper, we introduce Neural Simulation-Based Inference with Quantile Regression Quantile Estimation (NQE), a new family of SBI methods supplementing the existing NPE, NRE and NLE approaches. NQE successively estimates the one dimensional quantiles of each dimension of θ, conditioned on the data x and previous θ dimensions. We interpolate the discrete quantiles with monotonic cubic Hermite splines, adopting specific treatments to account for the tail behavior and potential multimodality of the distribution. Posterior samples can then be drawn by successively applying inverse transform sampling for each dimension of θ. We also develop a postprocessing calibration strategy, leading to guaranteed unbiased posterior estimation as long as one provides enough ( 103) simulations to accurately calculate the empirical coverage. To the best of our knowledge, this constitutes the first demonstration that QR-based SBI methods can attain state-of-the-art performance, matching or surpassing the benchmarks set by existing methods. The structure of this paper is as follows: In Section 2, we introduce the methodology of NQE, along with a alternative definition for Bayesian credible regions and a postprocessing calibration scheme to ensure the unbiasedness of the inference results. In Section 3, we demonstrate that NQE attains state-of-the-art performance across a variety of benchmark problems, together with a realistic application to high dimensional cosmology data. Subsequently, in Section 4, we discuss related works in the literature and potential avenues for future research. The results in this paper can be reproduced with the publicly available NQE package 1 based on pytorch (Paszke et al., 2019). 2. Methodology 2.1. Quantile Estimation And Interpolation The cornerstone of most contemporary SBI methods is some form of conditional density estimator, which is used to approximate the likelihood, the posterior, or the likelihoodto-evidence ratio. Essentially, every generative model can function as a density estimator. While Generative Adversarial Networks (Goodfellow et al., 2020) and more recently Diffusion Models (Dhariwal & Nichol, 2021) have shown remarkable success in generating high-quality images and videos, the SBI realm is primarily governed by Normalizing Flows (NF, e.g. Rezende & Mohamed, 2015; Papamakarios et al., 2019a), which offer superior inductive bias for the probabilistic distributions with up to dozens of dimensions frequently encountered in SBI tasks. Our proposed NQE method can also be viewed as a density estimator, as it reconstructs the posterior distribution autoregressively from its 1-dim conditional quantiles. In a typical SBI setup, one first samples the model parameters θ from the prior p(θ), and then runs the forward sim- 1https://github.com/h3jia/nqe. x optional embedding MLP with shortcuts + Credibility Level Biased Truth autoregressively for each ? (i) post-processing calibration Figure 1. (Top) Network architecture of our NQE method, which autoregressively learns 1-dim conditional quantiles for each posterior dimension. The estimated quantiles are then interpolated to reconstruct the full distribution. (Bottom) A post-processing calibration step can be employed to ensure the unbiasedness of NQE inference results. ulations to generate the corresponding observations x. For simplicity, let us start with the scenario of 1-dim θ. Given a dataset {θ, x} and a neural network Fϕ(x) parameterized by ϕ, one can estimate the median (mean) of θ conditioned on x by minimizing the L1 (L2) loss 2 between θ and Fϕ(x). As a straightforward generalization, one can estimate the τ-th quantile of θ conditioned on x by minimizing the following weighted L1 loss, Lτ[θ, Fϕ(x)] (τ 1) X θ