Manuscript Offprint
arXiv:2609.07833Neural Posterior Estimation for Tomographic Weak Lensing Mass Mapping
ABSTRACT
Weak gravitational lensing shear and convergence trace the distribution of baryonic and dark matter across space, making them a powerful probe of cosmic structure. Inferring shear and convergence from images is a challenging inverse problem. The prevailing approach to this task estimates shear from weighted averages of galaxy ellipticities, calibrates these estimates to account for systematic biases, and transforms them to reconstruct convergence, a multistage procedure that requires substantial computational resources and meticulous handling of statistical uncertainties. As an alternative, we propose a probabilistic approach to field-level weak lensing inference in which we train a deep neural network to directly map a multiband image to a variational distribution over the underlying tomographic shear and convergence fields. This neural posterior estimation (NPE) procedure implicitly marginalizes over nuisance variables in the cosmological forward model and does not require evaluating the likelihood function. It is also amortized, so it enables rapid posterior inference for astronomical surveys once the neural network is trained. When evaluated on synthetic images from the LSST-DESC DC2 Simulated Sky Survey, NPE produces well-calibrated variational distributions for shear and convergence that are consistent with the ground truth. We describe how maps sampled from these variational distributions could be used in a subsequent simulation-based inference procedure to approximate the posterior distribution over cosmological parameters.
Keywords: Observational cosmology (1146) — Weak gravitational lensing (1797) — Astronomy image processing (2306) — Convolutional neural networks (1938) — Astrostatistics techniques (1886) — Bayesian statistics (1900)
1. INTRODUCTION
Light from distant galaxies is deflected by matter along the telescope's line of sight, which modifies their observed shapes and brightnesses in astronomical images. This phenomenon is known as weak gravitational lensing. Weak lensing is characterized by shear, which describes anisotropic distortion, and convergence, which describes isotropic magnification. These quantities trace the projected distribution of matter across space, making weak lensing a powerful probe of the Universe's large-scale structure (M. Bartelmann & P. Schneider 2001; M. Kilbinger 2015; S. Dodelson 2017; J. Prat & D. Bacon 2026).
The next generation of astronomical surveys, including the Rubin Observatory's Legacy Survey of Space and Time (LSST) (Ž. Ivezić et al. 2019), the Euclid Space
Telescope (R. Laureijs et al. 2011), and the Nancy Grace Roman Space Telescope (O. Dore et al. 2019), will image billions of galaxies across thousands of square degrees of the night sky. These Stage IV surveys offer an opportunity to constrain cosmological parameters with unprecedented precision based on measurements of weak gravitational lensing (R. Mandelbaum et al. 2018). To take full advantage of the opportunity, shear and convergence estimation algorithms must efficiently process petabytes of image data, limit information loss, and quantify the uncertainty of their estimates.
Current approaches to weak lensing inference follow a multistage pipeline. First, images are processed to perform object detection, deblending, and measurement. Next, shear is estimated from galaxy ellipticities, typically using self-calibrating methods that estimate the
WHITE ET AL.
shear response through artificial shearing (Metadetection; E. S. Sheldon et al. (2023)) or analytical modeling (AnaCal; X. Li et al. (2024)). Convergence is then reconstructed from shear estimates, either through direct inversion methods (N. Kaiser & G. Squires 1993) or probabilistic reconstruction techniques (M. D. Schneider et al. 2017; N. Jeffrey et al. 2021; B. Remy et al. 2023; J. J. Whitney et al. 2025; Leterme, H. et al. 2026). Finally, cosmological parameters are inferred from summary statistics of the shear and convergence fields, such as two-point correlation functions (T. M. Abbott et al. 2022; J. Prat et al. 2023) or higher-order statistics (M. Gatti et al. 2022; N. Jeffrey et al. 2024; T. L. Makinen et al. 2025).
Each stage of this pipeline requires careful propagation of statistical uncertainties, and information about the underlying shear and convergence fields is typically lost when images are compressed, first to galaxy catalogs and then to summary statistics. Recent work has shown that field-level inference, which uses the full convergence maps rather than summary statistics, can yield tighter constraints on cosmological parameters (D. Sharma et al. 2024; Lanzieri, Denise et al. 2025; S. S. Boruah & E. Rozo 2024; P. Fiedorowicz et al. 2022; A. J. Zhou et al. 2024).
Several works have explored Bayesian inference of shear and convergence from images (L. Miller et al. 2007; G. M. Bernstein & R. Armstrong 2014; M. D. Schneider et al. 2015; G. M. Bernstein et al. 2016; A. Heavens et al. 2018; G. Congedo et al. 2024; G. Sallaberry et al. 2025). Many of these works posit a forward model of lensed galaxy fields and use Markov chain Monte Carlo to generate posterior samples under this model. This approach requires repeated evaluation of a likelihood function over all latent variables in the forward model, including the intrinsic properties of the imaged galaxies and the parameters of spatially varying backgrounds and point spread functions. While these methods provide principled uncertainty quantification, the computational cost of repeated likelihood evaluation makes their application to modern surveys challenging.
As an alternative, we propose to infer shear and convergence maps from multiband coadded images using neural posterior estimation (NPE), a type of simulation-based inference. This procedure involves training a neural network to map an image to a variational distribution over lensing maps for several redshift bins. NPE is amortized — once the neural network has been trained, it can estimate shear and convergence in a single forward pass.
Our approach differs from existing methods in several respects. The network maps images directly to the
underlying lensing fields without first compressing the image pixels into galaxy catalogs. Additionally, NPE is likelihood-free, unlike MCMC-based methods. Finally, NPE targets the posterior distribution over tomographic lensing maps, unlike neural-network-based point estimators of shear (M. Tewes et al. 2019; D. Ribli et al. 2019; Z. Zhang et al. 2024).
In this work, we investigate the feasibility of NPE as a field-level weak lensing inference method by applying it to the LSST Dark Energy Science Collaboration's DC2 Simulated Sky Survey (B. Abolfathi et al. 2021a,b). The DC2 lensing maps, object catalogs, and coadded images can be viewed as samples from an implicit probabilistic model (Section 2). We formulate the NPE objective and describe our choice of variational family and neural network architecture (Section 3). We train the network on images covering a contiguous DC2 subregion (Section 4) and evaluate its accuracy and calibration on a different subregion (Section 5).
In NPE, the network is trained exclusively on simulated images; we discuss strategies for mitigating potential simulator misspecification, which would enable the trained network to be applied to real astronomical surveys (Section 6). Additionally, we outline how conditional flow matching could be used to fit more flexible posterior approximations. Finally, we describe how mass maps sampled from our fitted variational distributions could be passed to a subsequent neural simulation-based inference procedure that approximates the posterior distribution over CDM model parameters. When connected, the two procedures would constitute an end-to-end probabilistic pipeline from images to cosmological parameters.
2.1. Coadded images and lensing maps
The galaxies imaged in DC2 are from cosmoDC2, a synthetic extragalactic catalog (D. Korytov et al. 2019). To construct cosmoDC2, a base catalog of unlensed galaxies is formed from the outputs of the Outer Rim N-body simulation (K. Heitmann et al. 2019) and the UniverseMachine catalog (P. Behroozi et al. 2019). Next, the galaxies are lensed based on shear and convergence maps. These maps are created by projecting particles onto discrete redshift shells from the Outer Rim light-cone, mapping the surface density of each shell, and tracing photon paths through the shells. The shear and convergence values applied to each galaxy are determined by interpolating these maps to the galaxy's redshift and sky coordinates. Finally, the catalog is augmented with additional properties after matching the lensed galaxies to those from the Galacticus library (A. J. Benson 2012). Figure A1 displays the distributions of several properties for a random sample of cosmoDC2 galaxies.
Given the cosmoDC2 catalog (along with separate catalogs of Milky Way stars and Type Ia supernovae), the imSim software package simulates raw 4000×4000-pixel images in six optical bands (ugrizy), which together cover 300 square degrees of the sky. Objects are rendered in the images using the GalSim package (B. T. Rowe et al. 2015). The imSim package mimics both the LSST observing cadence and the sensor and readout effects of the LSST Camera (B. Abolfathi et al. 2021a).
The LSST Data Release Production (DRP) pipeline processes the raw images by performing tasks such as instrument signature removal, background estimation, and source detection and deblending. Once the images are processed and characterized, the DRP pipeline calibrates them against a reference catalog to produce calibrated exposures. Then, coadded images (i.e., “coadds”) are generated by resampling the calibrated exposures on a common grid defined by tracts and patches. Each tract comprises 7×7 patches, and each patch comprises 4100×4100 pixels. The pixel scale is 0.2 arcseconds.
Two tracts of coadds are generated for DC2. These coadds cover approximately five square degrees of the sky, a small fraction of the coverage of the raw images. Despite this, we analyze the coadds instead of the raw images, as is standard in weak lensing analyses (R. Armstrong et al. 2024). In doing so, we leverage the coadds' high signal-to-noise ratio and avoid the need to combine inferences from overlapping raw images.
A single patch-level coadd is too large to store in memory during network training, so we partition each one into four 6×2048×2048-pixel coadds. There are 392 of these in total; we display one in the left panel of Figure 1. All mentions of coadds or images in the remainder of this paper refer to these 6×2048×2048-pixel objects, unless otherwise specified.
While these images are the inputs to the neural network in our neural posterior estimation procedure, training the network also requires the Outer Rim lensing maps described above. To the best of our knowledge, these maps were not published. However, it is possible to approximate them using the per-galaxy shear and convergence values reported in cosmoDC2.
Figure 1 demonstrates this approximation procedure for a single image. The center panel displays the shear and convergence at the positions of a random sample of galaxies whose centroids lie within the image boundary. Each galaxy is assigned to one of redshift bins defined by the intervals (0.007, 0.763), (0.763, 1.120), (1.120, 1.593), (1.593, 3.123). The bin thresholds are the minimum, first quartile, median, third quartile, and maximum redshift among galaxies detected by the LSST Science Pipelines (B. Abolfathi et al. 2021a).
For each redshift bin, we compute the mean shear and convergence in -pixel “tiles” defined on the same coordinate space as the image. The tile side length must be a divisor of the image dimension (2048, in our case). It should be chosen in tandem with the redshift bin count such that (i) shear and convergence are each approximately uniform within each tile and (ii) the galaxy count per tile is large enough to ensure that sampling noise in the shear and convergence averages is small.
This spatial binning procedure produces tomographic shear and convergence maps of size , where . In this work, we use redshift bins and a tile side length of , so . The right panel of Figure 1 displays these maps. We denote the tomographic convergence map for a single image as
where and index the bins and tiles, respectively. We use the same notation for the shear maps and .
2.2. An implicit probabilistic model
The lensing maps, stellar and galactic catalogs, and coadds described in Section 2.1 can be viewed as a single sample from a probabilistic generative model specified implicitly by the DC2 simulator. Let denote the tomographic shear and convergence maps underlying a single image. Thus, has dimension
WHITE ET AL.

Figure 1. Left: A 2048×2048-pixel DC2 image formed using the g, r, and i optical bands. Center: Shear and convergence of cosmoDC2 galaxies whose centroids lie within the image boundary. Each galaxy is assigned to one of four redshift bins defined by the intervals (0.007, 0.763), (0.763, 1.120), (1.120, 1.593), (1.593, 3.123). Right: Tomographic shear () and convergence () maps constructed by averaging each quantity over 256×256-pixel tiles within each redshift bin.
. Given the fiducial DC2 cosmology and the hyperparameters of the Outer Rim simulation, these maps are generated stochastically according to an implicit prior .
Let denote all other latent variables encoded in the image, including the properties of the imaged light sources and the characteristics of the spatially varying background, point spread function (PSF), and pixel-level noise. The latter characteristics could alternatively be viewed as fixed inputs to the forward model. The shear and convergence maps do not affect the background, PSF, or image noise, but they do alter the intrinsic shape and flux of each galaxy whose centroid falls within the image boundary. Thus, the latent variables can be viewed as samples from an implicit prior that reflects this dependence. Since each image depicts thousands of light sources, the dimension of is on the order of thousands, if not tens of thousands.
Let denote the image generated from and according to the forward model . This forward model encompasses both the simulation of raw exposures using the GalSim and imSim packages and the calibration and coaddition of these raw exposures by the LSST Data Release Production pipeline.
The left panel of Figure 2 illustrates how the joint distribution factorizes as . Any latent quantities excluded from this panel, such as the intrinsic shape and flux of each galaxy, are implicitly absorbed by . The DC2 lensing maps, catalogs, and coadds are generated through repeated calls to this gen-
erative model, as illustrated by the replicated arrows in Figure 2.
3. NEURAL POSTERIOR ESTIMATION
Given an image , we aim to infer the posterior distribution over tomographic shear and convergence maps. This distribution, which is a marginal of the joint posterior , can be expressed as
One approach to inferring is to sample from using Markov chain Monte Carlo and discard the sampled nuisance variables. However, this procedure requires the repeated evaluation of the likelihood , which is computationally demanding since , and are all high-dimensional. Also, for highly realistic simulations like DC2, writing in closed form may not be feasible.
3.1. An amortized, likelihood-free objective
To circumvent the computational challenges described above, we approximate with a variational distribution parametrized by a vector . We discuss our choice of , which defines a family of variational distributions, in Section 3.2.
We fit using neural posterior estimation (NPE), a type of amortized variational inference. In NPE, instead

Figure 2. Our inference framework. Lensing maps , non-lensing variables , and images are generated by the DC2 simulator (Section 2.1), which can be viewed as an implicit generative model (Section 2.2). Given the images, a neural network approximates the posterior distribution over lensing maps via neural posterior estimation (Section 3.1). The network is trained to map each image to the parameters of a distribution belonging to a spatially factorized variational family (Section 3.2). Our network is a deep residual network with weights (Section 3.3).
of optimizing the variational parameters separately for each image , we train a neural network to map any to a corresponding — i.e., , where the function is a neural network with weights . Thus, the computational cost of solving this inference problem is amortized across pairs sampled from the DC2 generative model. The weights are selected to minimize
the expected forward Kullback-Leibler divergence of the true marginal posterior from the variational distribution. Substituting the definition of the KL divergence into Equation 3 yields the simplified objective
where is a constant with respect to . The expectation is taken with respect to pairs obtained by sampling from and discarding the non-lensing variables .
We use stochastic gradient descent to obtain the neural network weights that minimize Equation 4. This involves computing Monte Carlo approximations of the gradient
using batches of pairs sampled from . The weights are iteratively updated based on these approximate gradients. We use a batch size of one, as we found that at most one image can be held in memory along with the network weights.
The NPE loss function is convenient for three reasons. First, it is likelihood-free, as it does not require evalu-
ating . Second, while it requires sampling from the generative model, it otherwise marginalizes over these nuisance variables, as they do not appear in the integrand. Finally, it enables statistically consistent estimation of , provided that the variational family is sufficiently flexible (D. T. Frazier et al. 2024).
3.2. A spatially factorized variational family
In this work, we evaluate the performance of NPE for a family of variational distributions that factorize over redshift bins, tiles, and the three lensing variables. Variational families with this structure are often called mean-field families (C. Zhang et al. 2019). The results presented in Section 5 establish a baseline for future work that will posit a more flexible variational family.
We define a family comprising variational distributions of the form
where the products are taken over redshift bins and tiles, respectively. For each bin and tile , we model , , and as independent Gaussian random variables. While in Equation 6 we index each of these variational factors by to avoid notational clutter, each factor is actually parametrized by a subset of comprising one mean parameter and one variance parameter. The entire vector is formed by flattening an array of size , whose final two dimensions represent the number of lensing variables and the
WHITE ET AL.
number of Gaussian distribution parameters per lensing variable, respectively.
While this mean-field variational family models , , and as independent (conditional on the image), we expect these variables to exhibit non-zero auto- and cross-correlation in the exact posterior. Later, we will propose a more flexible class of variational distributions (Section 6.2) from which spatially dependent shear and convergence maps can be sampled, summarized, and used to constrain cosmological parameters (Section 6.3).
Although its dependence structure does not match that of the exact posterior, our variational family nevertheless provides a valuable approximation of it. For one thing, maps sampled from the fitted variational distributions can still exhibit non-zero auto- or cross-correlation at large scales, even though shear and convergence are modeled as independent at the tile level. The neural network's receptive field spans many tiles, so the per-tile means it predicts can carry spatial structure inherited from the underlying maps. Additionally, the consistent marginalization property of the NPE objective guarantees that the variational factors , , and that minimize Equation 4 coincide exactly with , , and , provided that the per-tile distributional form (Gaussian, in this work) is sufficiently expressive (L. Ambrogioni et al. 2019). Therefore, we expect credible intervals formed using the fitted variational factors to be well-calibrated, and we expect the means of these variational factors to be informative point estimates for shear and convergence in each tile.
Since shear and convergence are derived from the same underlying gravitational potential, one could alternatively parametrize the variational family in terms of just one of these quantities, or in terms of the lensing potential itself. Either alternative would enforce the physical relationship between shear and convergence by construction, but would require additional steps to recover both shear and convergence maps. In the former case, one would need to apply the Kaiser-Squires inversion to samples from the fitted variational distribution (N. Kaiser & G. Squires 1993), while in the latter case, one would need to differentiate samples of the lensing potential. These steps could introduce additional sources
of error (e.g., boundary effects from Kaiser-Squires inversion, inflated posterior variance from differentiating the lensing potential), though we have not investigated them empirically.
3.3. Network architecture
Our neural network is a residual network (ResNet) of comparable depth to ResNet-34 (K. He et al. 2016). It consists of several residual blocks that progressively downsample the spatial resolution of the input from to while simultaneously expanding and compressing the channel depth. The residual blocks are preceded by a preprocessing block and succeeded by a pointwise convolutional layer that maps the final hidden channels to variational parameters .
We refined this architecture through a systematic ablation procedure. Starting from a basic ResNet, we iteratively modified the maximum channel depth, number of residual blocks, type of weight normalization, and choice of activation function. Our final architecture, which we selected based on validation loss, has a maximum channel depth of 1024 and 14 residual blocks that utilize group normalization and the SiLU activation function. We illustrate this architecture in Figure B1.
While images are the primary input to the network, we provide the point spread function (PSF) parameters as additional inputs using the approach proposed by A. Patel et al. (2025). The DC2 catalog reports four PSF parameters for each object: three adaptive second moments and the full width at half maximum. For each image, we compute the median of each PSF parameter across all objects measured by the LSST Science Pipelines, and provide these medians to the network as feature maps concatenated with the image. Our ablation study revealed that explicitly providing these PSF feature maps yields only a marginal improvement in the network's average validation loss. This corroborates the insight from A. Patel et al. (2025) that exposing the network to images with different PSFs is nearly as beneficial as explicitly supplying the fiducial PSF parameters.
4. TRAINING AND EVALUATION
4.1. Training the neural network
We train the network on 313 DC2 images and use an additional 39 images for validation. In Section 5, we evaluate the accuracy and calibration of the posteriors inferred by the trained network for the remaining 40 images. To minimize information leakage between the three stages of inference, the training, validation, and test sets are spatially disjoint, with each covering a contiguous region.
To investigate whether the marginal posteriors of , , and are skewed, heavy-tailed, or multimodal (and thus poorly approximated by a Gaussian distribution) for any bins or tiles , we also tried approximating them with a nonparametric variational distribution proposed by D. McNamara et al. (2026). The fitted densities resembled a Gaussian for most tiles.
Training takes approximately 16 hours on one NVIDIA A40 GPU. We augment the training set on the fly by applying random 90-degree rotations and vertical flips. The former transformation maps for each bin and tile , while the latter maps . We apply a random combination of these transformations to each training batch, updating the fiducial shear and convergence accordingly before computing the loss.
4.2. Evaluating probabilistic shear and convergence inference
While there are standard summary statistics and metrics for assessing point estimates produced by deterministic shear and convergence estimators, procedures for evaluating probabilistic weak lensing inference are less established. We adopt a few strategies from the probabilistic mass mapping literature (M. D. Schneider et al. 2017; B. Remy et al. 2023; S. S. Boruah & E. Rozo 2024; S. S. Boruah et al. 2024).
First, for each image in the test set, we plot the mean and several samples from the variational distribution . Since the images in our test set cover a contiguous region, we also arrange the posterior maps by right ascension (RA) and declination (DEC). This is equivalent to visualizing the mean and samples from , our approximation of the joint posterior over the region spanned by the test images.
Second, we evaluate the accuracy of the posterior mean shear (denoted ) and convergence () maps as point estimates for , and , respectively. For each redshift bin, we compute the root mean squared error (RMSE) and Pearson correlation coefficient () between the posterior mean and the ground truth across the tiles in the test images. For convergence in bin , the RMSE is
and the Pearson correlation coefficient is
where denotes the sample covariance of the input vectors and denotes the sample variance. The same definitions apply for the two shear components.
However, distilling the variational distribution to a point estimate is reductive. The metrics above offer no
insight into the calibration of the variational distribution, which is an important property if maps sampled from it are to be used for downstream cosmological inference.
To assess calibration, we construct marginal highest-density credible intervals based on for the shear and convergence in each tile of each redshift bin. We create calibration plots by plotting the intervals against the corresponding ground truth values. After forming credible intervals for several coverage levels, we compute the proportion of intervals that cover the ground truth for each level. If the marginals of are well-calibrated approximations of the corresponding marginals of , then the empirical coverage should be close to the nominal coverage for each level.
Finally, we investigate the extent to which the inferred maps recover the spatial structure of the underlying lensing fields. For convergence, we compare tomographic auto- and cross-power spectra computed using posterior samples to those computed using the actual DC2 maps. For each redshift bin, we also compute the cross-correlation coefficient between the actual DC2 maps and those sampled from the variational distribution. This enables us to identify the scales at which the inferred maps accurately reconstruct the truth.
5. RESULTS
5.1. Posterior mass maps
Figure 3 compares the actual tomographic convergence map for the test set to the posterior mean and samples inferred with NPE. Figure A2 provides a similar comparison for the two shear components.
The posterior mean convergence map identifies most of the overdensities (i.e., high-convergence regions) and underdensities (i.e., low-convergence regions) present in the actual map. It also correctly identifies that the overdensities and underdensities tend to be larger in absolute value at higher redshifts. In these two ways, the posterior mean map reflects the spatial autocorrelation of convergence. Figure A3 confirms this quantitatively: the cross-correlation between the inferred and actual convergence maps remains high across a range of multipoles in all four redshift bins, decreasing at higher . The tomographic auto- and cross-spectra of posterior samples track those of the ground truth at low multipoles but diverge at higher multipoles (Figure A4).
The posterior mean map provides a smooth approximation of the actual convergence map within each -tile region corresponding to a single DC2 image. However, there are spatial discontinuities at many boundaries where we stitched together maps for adjacent im-
WHITE ET AL.

Figure 3. Actual tomographic convergence map for the 0.6 deg test set versus the posterior mean and samples from , the variational distribution for convergence across the test images. The horizontal and vertical axes are right ascension (RA) and declination (DEC), respectively.
ages. The number of boundaries could be reduced by training the network on larger images (e.g., -pixel patches), but doing so is challenging in practice without substantial computing resources.
Figure A5 plots the posterior standard deviations inferred with NPE for the same region. This figure reveals another boundary effect: the standard deviations are systematically larger for the peripheral tiles of each -tile map. As a result, gridlines form when these maps are aligned by RA and DEC. This is a natural consequence of the truncation of the network's receptive field for the peripheral tiles. For the interior tiles, the network's inferences are implicitly conditioned on the ellipticities of galaxies in all surrounding directions. For the peripheral tiles, the network has less context, as it cannot “see” galaxies in at least one direction.
5.2. Accuracy of posterior means
Table 1 reports the RMSE and Pearson correlation coefficient of the posterior means , , and for each redshift bin. These metrics are similar in each bin for and , which suggests that our neural network is not rotationally biased.
For all three lensing variables, the RMSE is smallest for the lowest redshift bin and largest for the highest redshift bin. This is consistent with the positive relationship between redshift and amplitude identified in the previous section. The Pearson correlation coefficients are also smallest in the low redshift bins. This suggests that the network struggles to distinguish the weak lensing signal from the shape noise of low-redshift galaxies, even though it can achieve a small RMSE in
| RMSE | Pearson r | ||
|---|---|---|---|
| Bin 1 | 0.25 | ||
| 0.29 | |||
| 0.62 | |||
| Bin 2 | 0.31 | ||
| 0.38 | |||
| 0.71 | |||
| Bin 3 | 0.37 | ||
| 0.40 | |||
| 0.74 | |||
| Bin 4 | 0.34 | ||
| 0.37 | |||
| 0.69 |
Table 1. Root mean squared error (RMSE) and Pearson correlation coefficient of the posterior mean shear (, ) and convergence () maps inferred with neural posterior estimation. For each redshift bin, the two metrics are computed using all 2,560 test set tiles (Equations 7 and 8).
this setting by inferring that shear and convergence are close to zero.
In each redshift bin, the Pearson correlation coefficient is larger for convergence than for shear, and it is similar for the two shear components. The same trends hold for Spearman and Kendall correlation coefficients, so we elect not to include these rank-based metrics in the table.
5.3. Posterior calibration
The left panel of Figure 4 is a calibration plot that compares the actual shear and convergence for a random sample of test set tiles to 90% marginal credible intervals formed using . We represent the intervals as vertical line segments and color them based on whether they cover the ground truth (i.e., intersect the 45-degree line). Approximately 90% of the intervals cover the ground truth for each lensing variable in each redshift bin.
The credible intervals do not adhere perfectly to the 45-degree line, as they would if the posterior median shear and convergence (i.e., the centers of the intervals) coincided exactly with the actual shear and convergence in each tile. However, the intervals generally slope upward, consistent with the Pearson correlation coefficients reported in the previous section.
Within each redshift bin, the interval widths are approximately uniform across the range of actual shear and convergence values. However, the intervals are much wider for the higher redshift bins. This is consistent with the posterior standard deviation maps in Figure A5.
We repeat the above process of constructing credible intervals and computing empirical coverage for nominal coverage levels ranging from 0.05 to 0.95. The right panel of Figure 4 reveals that the empirical coverage is close to the nominal coverage for each lensing variable in each redshift bin, which suggests that the marginal variational distributions inferred with NPE are well-calibrated. Across all twelve subplots, the empirical coverages are slightly larger than the nominal coverages for most levels — i.e., the credible intervals tend to be too wide. This tendency is typical of methods that minimize the forward Kullback-Leibler divergence and is generally considered preferable to the opposite case, where credible intervals are systematically too narrow.
6. DISCUSSION
To our knowledge, this work is the first to investigate the capabilities of NPE as a field-level weak lensing inference method. Our results are promising: when evaluated on a held-out subregion of the DC2 Simulated Sky Survey, NPE infers well-calibrated variational distributions over shear and convergence maps in four redshift bins. For all lensing variables in all bins, the means of the variational distributions are positively correlated with the ground truth across the test set, and marginal credible intervals formed using the variational quantiles cover the ground truth at approximately nominal rates.
6.1. Remedies for simulator misspecification
Our assessment of NPE did not address the possibility of distribution shift between the training and evaluation images — nor did it need to, since both sets of images were generated by the DC2 simulator in our experiments. In a more practical scenario, the network would be trained on simulated images and applied to real images for which the underlying lensing maps are unknown. If there are discrepancies between the simulator's implicit generative model and reality in this setting, NPE's posterior approximations could be systematically biased or miscalibrated (J. Hermans et al. 2022). In the context of DC2, this misspecification could occur at any stage of the generative model illustrated in the left panel of Figure 2.
A better understanding of the sensitivity of our NPE procedure to various types of simulator misspecification will be necessary before we can reliably deploy it on Stage IV surveys. Several recent works have proposed strategies to mitigate simulator misspecification (R. P. Kelly et al. 2025). These strategies typically involve penalizing discrepancies between simulated and real observations (D. Huang et al. 2023; M. Gloeckler et al. 2023; P. Swierc et al. 2024; A. Mishra et al. 2025; L. Elsemüller
WHITE ET AL.

Figure 4. Left: 90% credible intervals for shear and convergence, constructed independently for a random sample of 500 test set tiles using the 0.05 and 0.95 quantiles of the variational distribution. Right: Nominal and empirical coverage of credible intervals for shear and convergence. For this panel, credible intervals were constructed independently for all 2,560 test set tiles.
et al. 2025), correcting such discrepancies using a calibration set of real observations (A. Wehenkel et al. 2024; O. Senouf et al. 2025), or relating simulated and real observations with an explicit error model (D. Ward et al. 2022; M. O'Callaghan et al. 2025).
6.2. A more flexible variational family
We evaluated NPE only for a particular mean-field Gaussian variational family. The marginal variational factors of this family were well-calibrated, and maps sampled from the fitted variational distribution recovered the long-range spatial dependencies of the underlying shear and convergence fields. However, because our variational family factorizes across tiles, redshift bins, and lensing variables, the posterior mass maps did not exhibit auto- or cross-correlation at the tile level.
A natural next step is therefore to replace the mean-field family with a more expressive parametrization. Conditional flow matching could be used to fit a more flexible variational family that captures the auto- and cross-correlation of shear and convergence in the exact posterior (Y. Lipman et al. 2022; J. Wildberger et al. 2023).
Maps sampled using a trained flow would provide a smooth approximation of the shear and convergence fields within -tile regions, assuming the same map resolution used in this work. However, the boundary effects observed in Figure 3 and Figure A5 would persist.
A potential remedy for these boundary effects would be to use an autoregressive tiling scheme similar to that proposed by J. Regier (2026).
6.3. A path to posterior inference of cosmological parameters
The ultimate objective of weak lensing analyses is to constrain cosmological parameters, typically those from the CDM model or one of its variants. Training NPE to directly map survey-scale images to cosmological parameters would be computationally prohibitive, as it would require simulating massive synthetic sky surveys for each plausible combination of cosmological parameters. A more tractable alternative is to decompose the problem hierarchically.
Let denote cosmological parameters of interest, and let denote the convergence map for a region of interest , which could be the survey footprint or a large contiguous subregion of it. This overloads our earlier notation, where referred to a single map for a single image .
Under this formulation, the posterior distribution over cosmological parameters can be written as
(9) where the approximation reflects the assumption that the convergence field captures most of the cosmological information encoded in the images. Although this conditional independence is not exact, it is a reasonable approximation when comprises parameters primarily constrained by weak lensing — namely, and . This perspective aligns with the standard practice of treating convergence maps (or summary statistics derived from them) as approximately sufficient statistics for cosmological parameter inference.
Approximating via this decomposition requires two subroutines. The first infers using the NPE procedure described in this work, but with a variational family flexible enough to capture the spatial autocorrelation of in the exact posterior (Section 6.2). The second infers using NPE or another neural simulation-based inference algorithm trained on pairs generated by a high-fidelity simulator (Zeghal, Justine et al. 2025). Given the networks trained in these subroutines, one could approximate
via ancestral sampling, by first drawing convergence maps from and then passing them through the second-stage network to obtain samples from . Credible regions for the parameters could then be constructed from these samples.
This decomposition would enable end-to-end probabilistic weak lensing inference at the scale of Stage IV astronomical surveys. The present work establishes the feasibility of the images-to-maps stage of this pipeline and proposes the extensions required for it to produce trustworthy inferences on real survey data.
ACKNOWLEDGMENTS
This material is based on work supported by the National Science Foundation under Grant No. 2209720 and the U.S. Department of Energy, Office of Science,
Office of High Energy Physics under Award Number DE-SC0023714. The authors thank Steve Fan and Tahseen Youmus for helpful discussions about this work and for their contributions to the blissWL codebase.
This paper has undergone internal review in the LSST Dark Energy Science Collaboration. The internal reviewers were Supranta Boruah, Alan Heavens, and Benjamin Remy. The authors thank Pat Burchat for helpful comments during the collaboration-wide review period.
The DESC acknowledges ongoing support from the Institut National de Physique Nucléaire et de Physique des Particules in France; the Science & Technology Facilities Council in the United Kingdom; and the Department of Energy and the LSST Discovery Alliance in the United States. DESC uses resources of the IN2P3 Computing Center (CC-IN2P3-Lyon/Villeurbanne - France) funded by the Centre National de la Recherche Scientifique; the National Energy Research Scientific Computing Center, a DOE Office of Science User Facility supported by the Office of Science of the U.S. Department of Energy under Contract No. DE-AC02-05CH11231; STFC DiRAC HPC Facilities, funded by UK BEIS National E-infrastructure capital grants; and the UK particle physics grid, supported by the GridPP Collaboration. This work was performed in part under DOE Contract DE-AC02-76SF00515.
AUTHOR CONTRIBUTIONS
TW, SC, and JR extended the blissWL software package to infer DC2 mass maps with NPE. TW trained and evaluated the neural network and created the figures. CA and JR supervised the project. TW, CA, and JR wrote the text of this manuscript.
DATA AVAILABILITY
Our implementation of NPE is publicly available at https://github.com/prob-ml/blissWL. Code for reproducing the tables and figures in this paper can be found in the images_to_maps/dc2 folder.
REFERENCES
Abbott, T. M., Aguena, M., Alarcon, A., et al. 2022, Physical Review D, 105, 023520, doi: 10.1103/PhysRevD.105.023520
Abolfathi, B., Armstrong, R., Awan, H., et al. 2021a, arXiv:2101.04855, doi: 10.48550/arXiv.2101.04855
Abolfathi, B., Alonso, D., Armstrong, R., et al. 2021b, The Astrophysical Journal Supplement Series, 253, 31, doi: 10.3847/1538-4365/abd62c
Ambrogioni, L., Güçlü, U., Berezutskaya, J., et al. 2019, in The 22nd International Conference on Artificial Intelligence and Statistics, PMLR, 777–786, doi: 10.48550/arXiv.1805.11542
Armstrong, R., Sheldon, E., Huff, E., et al. 2024, arXiv:2407.01771, doi: 10.48550/arXiv.2407.01771
Bartelmann, M., & Schneider, P. 2001, Physics Reports, 340, 291, doi: 10.1016/S0370-1573(00)00082-X
WHITE ET AL.
Behroozi, P., Wechsler, R. H., Hearin, A. P., & Conroy, C. 2019, Monthly Notices of the Royal Astronomical Society, 488, 3143, doi: 10.1093/mnras/stz1182
Benson, A. J. 2012, New Astronomy, 17, 175, doi: 10.1016/j.newast.2011.07.004
Bernstein, G. M., & Armstrong, R. 2014, Monthly Notices of the Royal Astronomical Society, 438, 1880, doi: 10.1093/mnras/stt2326
Bernstein, G. M., Armstrong, R., Krawiec, C., & March, M. C. 2016, Monthly Notices of the Royal Astronomical Society, 459, 4467, doi: 10.1093/mnras/stw879
Boruah, S. S., Fiedorowicz, P., & Rozo, E. 2024, Physical Review D, 110, 023524, doi: 10.1103/PhysRevD.110.023524
Boruah, S. S., & Rozo, E. 2024, Monthly Notices of the Royal Astronomical Society: Letters, 527, L162, doi: 10.1093/mnrasl/slad160
Congedo, G., Miller, L., Taylor, A., et al. 2024, Astronomy & Astrophysics, 691, A319, doi: 10.1051/0004-6361/202450617
Dodelson, S. 2017, Gravitational Lensing (Cambridge University Press), doi: 10.1017/9781316424254
Dore, O., Hirata, C., Wang, Y., et al. 2019, arXiv:1904.01174, doi: 10.48550/arXiv.1904.01174
Duan, Y., Li, X., Avestruz, C., Regier, J., & LSST Dark Energy Science Collaboration. 2026, The Astronomical Journal, 171, 112, doi: 10.3847/1538-3881/ae30df
Elsemüller, L., Pratz, V., von Krause, M., et al. 2025, arXiv preprint arXiv:2502.04949, doi: 10.48550/arXiv.2502.04949
Fiedorowicz, P., Rozo, E., Boruah, S. S., Chang, C., & Gatti, M. 2022, Monthly Notices of the Royal Astronomical Society, 512, 73, doi: 10.1093/mnras/stac468
Frazier, D. T., Kelly, R., Drovandi, C., & Warne, D. J. 2024, arXiv:2411.12068, doi: 10.48550/arXiv.2411.12068
Gatti, M., Jain, B., Chang, C., et al. 2022, Physical Review D, 106, 083509, doi: 10.1103/PhysRevD.106.083509
Gloeckler, M., Deistler, M., & Macke, J. H. 2023, in Proceedings of Machine Learning Research, Vol. 202, Proceedings of the 40th International Conference on Machine Learning (PMLR), 11493–11524. https://proceedings.mlr.press/v202/gloeckler23a.html
Guy, L. P., Bechtol, K., Bellm, E., et al. 2026, Rubin Observatory Plans for an Early Science Program, https://rtn-011.lsst.io
He, K., Zhang, X., Ren, S., & Sun, J. 2016, in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 770–778, doi: 10.48550/arXiv.1512.03385
Heavens, A., Alsing, J., Jaffe, A., et al. 2018, in The Fourteenth Marcel Grossmann Meeting, World Scientific, 3005–3010, doi: 10.1142/9789813226609_0379
Heitmann, K., Finkel, H., Pope, A., et al. 2019, The Astrophysical Journal Supplement Series, 245, 16, doi: 10.3847/1538-4365/ab4da1
Hermans, J., Delaunoy, A., Rozet, F., et al. 2022, Transactions on Machine Learning Research, doi: 10.48550/arXiv.2110.06581
Huang, D., Bharti, A., Souza, A., Acerbi, L., & Kaski, S. 2023, Advances in Neural Information Processing Systems, 36, 7289, doi: 10.52202/075280-0318
Ivezić, Ž., Kahn, S. M., Tyson, J. A., et al. 2019, The Astrophysical Journal, 873, 111, doi: 10.3847/1538-4357/ab042c
Jeffrey, N., Gatti, M., Chang, C., et al. 2021, Monthly Notices of the Royal Astronomical Society, 505, 4626, doi: 10.1093/mnras/stab1495
Jeffrey, N., Whiteway, L., Gatti, M., et al. 2024, Monthly Notices of the Royal Astronomical Society, stae2629, doi: 10.1093/mnras/stae2629
Kaiser, N., & Squires, G. 1993, Astrophysical Journal, 404, 441, doi: 10.1086/172297
Kelly, R. P., Warne, D. J., Frazier, D. T., et al. 2025, arXiv:2503.12315, doi: 10.48550/arXiv.2503.12315
Kilbinger, M. 2015, Reports on Progress in Physics, 78, 086901, doi: 10.1088/0034-4885/78/8/086901
Korytov, D., Hearin, A., Kovacs, E., et al. 2019, The Astrophysical Journal Supplement Series, 245, 26, doi: 10.3847/1538-4365/ab510c
Lanzieri, Denise, Zeghal, Justine, Lucas Makinen, T., et al. 2025, Astronomy & Astrophysics, 697, A162, doi: 10.1051/0004-6361/202451535
Laureijs, R., Amiaux, J., Arduini, S., et al. 2011, arXiv:1110.3193, doi: 10.48550/arXiv.1110.3193
Leterme, H., Tersenov, A., Fadili, J., & Starck, J.-L. 2026, Astronomy & Astrophysics, 710, A292, doi: 10.1051/0004-6361/202557652
Li, X., Mandelbaum, R., Jarvis, M., et al. 2024, Monthly Notices of the Royal Astronomical Society, 527, 10388, doi: 10.1093/mnras/stad3895
Lipman, Y., Chen, R. T., Ben-Hamu, H., Nickel, M., & Le, M. 2022, arXiv preprint arXiv:2210.02747, doi: 10.48550/arXiv.2210.02747
Makinen, T. L., Heavens, A., Porqueres, N., et al. 2025, Journal of Cosmology and Astroparticle Physics, 2025, 095, doi: 10.1088/1475-7516/2025/01/095
Mandelbaum, R., Eifler, T., Hložek, R., et al. 2018, arXiv:1809.01669, doi: 10.48550/arXiv.1809.01669
McNamara, D., Duan, Y., & Regier, J. 2026, in The Fourteenth International Conference on Learning Representations. https://proceedings.iclr.cc/paper_files/paper/2026/hash/00ba1ebd7939b6324427a7372ac81abb-Abstract-Conference.html
Miller, L., Kitching, T. D., Heymans, C., Heavens, A. F., & Van Waerbeke, L. 2007, Monthly Notices of the Royal Astronomical Society, 382, 315, doi: 10.1111/j.1365-2966.2007.12363.x
Mishra, A., Habermann, D., Schmitt, M., Radev, S. T., & Bürkner, P.-C. 2025, arXiv preprint arXiv:2501.13483, doi: 10.48550/arXiv.2501.13483
O'Callaghan, M., Mandel, K. S., & Gilmore, G. 2025, arXiv preprint arXiv:2509.05724, doi: 10.48550/arXiv.2509.05724
Patel, A., Zhang, T., Avestruz, C., Regier, J., & LSST Dark Energy Science Collaboration. 2025, The Astronomical Journal, 170, 155, doi: 10.3847/1538-3881/afdef32
Prat, J., & Bacon, D. 2026, in Encyclopedia of Astrophysics (First Edition), 1st edn., ed. I. Mandel (Oxford: Elsevier), 508-537, doi: 10.1016/B978-0-443-21439-4.00071-7
Prat, J., Zuntz, J., Omori, Y., et al. 2023, The Open Journal of Astrophysics, 6, doi: 10.21105/astro.2212.09345
Regier, J. 2026, The Annals of Applied Statistics, 20, 702, doi: 10.1214/25-AOAS2125
Remy, B., Lanusse, F., Jeffrey, N., et al. 2023, Astronomy & Astrophysics, 672, A51, doi: 10.1051/0004-6361/202243054
Ribli, D., Dobos, L., & Csabai, I. 2019, Monthly Notices of the Royal Astronomical Society, 489, 4847, doi: 10.1093/mnras/stz2374
Rowe, B. T., Jarvis, M., Mandelbaum, R., et al. 2015, Astronomy and Computing, 10, 121, doi: 10.1016/j.ascom.2015.02.002
Sallaberry, G., Priest, B. W., Armstrong, R., et al. 2025, The Astrophysical Journal, 981, 166, doi: 10.3847/1538-4357/adb0b7
Schneider, M. D., Hogg, D. W., Marshall, P. J., et al. 2015, The Astrophysical Journal, 807, 87, doi: 10.1088/0004-637X/807/1/87
Schneider, M. D., Ng, K. Y., Dawson, W. A., et al. 2017, The Astrophysical Journal, 839, 25, doi: 10.3847/1538-4357/839/1/25
Senouf, O., Wehenkel, A., Vincent-Cuaz, C., Abbé, E., & Frossard, P. 2025, arXiv preprint arXiv:2508.15593, doi: 10.48550/arXiv.2508.15593
Sharma, D., Dai, B., & Seljak, U. 2024, Journal of Cosmology and Astroparticle Physics, 2024, 010, doi: 10.1088/1475-7516/2024/08/010
Sheldon, E. S., Becker, M. R., Jarvis, M., Armstrong, R., & LSST Dark Energy Science Collaboration. 2023, arXiv:2303.03947, doi: 10.48550/arXiv.2303.03947
Swierc, P., Tamargo-Arizmendi, M., Cíprijanović, A., & Nord, B. D. 2024, arXiv preprint arXiv:2410.16347, doi: 10.48550/arXiv.2410.16347
Tewes, M., Kuntzer, T., Nakajima, R., et al. 2019, Astronomy & Astrophysics, 621, A36, doi: 10.1051/0004-6361/201833775
Ward, D., Cannon, P., Beaumont, M., Fasiolo, M., & Schmon, S. 2022, Advances in Neural Information Processing Systems, 35, 33845, doi: 10.52202/068431-2453
Wehenkel, A., Gamella, J. L., Sener, O., et al. 2024, arXiv preprint arXiv:2405.08719, doi: 10.48550/arXiv.2405.08719
Whitney, J. J., Liaudat, T. I., Price, M. A., Mars, M., & McEwen, J. D. 2025, Monthly Notices of the Royal Astronomical Society, 542, 2464, doi: 10.1093/mnras/staf1356
Wildberger, J., Dax, M., Buchholz, S., et al. 2023, Advances in Neural Information Processing Systems, 36, 16837, doi: 10.52202/075280-0737
Wu, Y., & He, K. 2018, in Proceedings of the European Conference on Computer Vision (ECCV), 3–19, doi: 10.48550/arXiv.1803.08494
Zeghal, Justine, Lanzieri, Denise, Lanusse, François, et al. 2025, Astronomy & Astrophysics, 699, A327, doi: 10.1051/0004-6361/202452410
Zhang, C., Bütepage, J., Kjellström, H., & Mandt, S. 2019, IEEE Transactions on Pattern Analysis and Machine Intelligence, 41, 2008, doi: 10.1109/TPAMI.2018.2889774
Zhang, Z., Shan, H., Li, N., et al. 2024, Astronomy & Astrophysics, 683, A209, doi: 10.1051/0004-6361/202345903
Zhou, A. J., Li, X., Dodelson, S., & Mandelbaum, R. 2024, Physical Review D, 110, 023539, doi: 10.1103/PhysRevD.110.023539
WHITE ET AL.
APPENDIX
A. ADDITIONAL FIGURES

Figure A1. Marginal histograms and pairwise scatter plots of redshift, r-band magnitude, shear, and convergence for 50,000 galaxies whose centroids lie in tract 3828 or 3829 of the DC2 Simulated Sky Survey.

Figure A2. Actual tomographic shear maps for the 0.6 deg test set versus the posterior mean of , the variational distribution for shear across the test images. Samples from this variational distribution are of poor quality for the reasons discussed in Section 3.2, so we omit them here. The horizontal and vertical axes are right ascension (RA) and declination (DEC), respectively.

Figure A3. Cross-correlation coefficient between the actual and posterior median convergence maps as a function of multipole , in each of the four tomographic redshift bins. The solid lines represent the median across 200 samples drawn from the variational distributions inferred by NPE, while the shaded bands span from the 0.25 quantile to the 0.75 quantile of these samples. Spectra are computed via 2D FFT of the stitched tile test-set map and radially binned in nine log-spaced bins.

Figure A4. Auto- and cross-power spectra of the convergence field, , for the four redshift bins . The diagonal panels display the auto-power spectra, while the off-diagonal panels display the cross-power spectra. Black dashed curves are the power spectra computed using the actual DC2 convergence maps from the 40-image test set, stitched into a single tile field covering approximately . The green curves are the medians across 200 samples drawn from the variational distributions inferred by NPE. Each shaded band spans from the 0.25 quantile to the 0.75 quantile of the 200 samples. Spectra are estimated by 2D FFT of the stitched maps and radially averaged in nine log-spaced bins.
WHITE ET AL.

Figure A5. Tomographic standard deviation maps for the 0.6 deg test set. These maps depict the marginal standard deviations of , the variational distribution for shear and convergence across the test images. The horizontal and vertical axes are right ascension (RA) and declination (DEC), respectively.
B. NEURAL NETWORK ARCHITECTURE
Figure B1 illustrates the architecture of our neural network , which maps a PSF-augmented image x to variational parameters . The network's inputs and outputs (outlined in black) are connected by a series of individual layers (shaded gray) and multi-layer residual blocks (shaded blue).
The backbone of the network consists of 14 residual blocks. Each residual block transforms the network's intermediate representations based on an input channel count c, an output channel count , and a stride. The resulting channel depth and spatial resolution of these intermediate representations are listed in italics on the left side of the diagram. While these tensors also have a batch dimension, we omit it from the diagram. As explained in Section 3.1, we use a batch size of one to accommodate GPU memory constraints.
The panel on the right side of the diagram details the internal structure of a single residual block. Each block employs two convolutional layers interspersed with group normalization and SiLU activation layers (Y. Wu & K. He 2018), as well as a skip connection composed of a convolution and group normalization.

Figure B1. The architecture of our neural network .