arXiv ScienceSearch

arXiv subjects

Alessio Spurio Mancini

Publications and source records attributed to Alessio Spurio Mancini.

At least 19 recordsLinked to original sources

GRADSOLVE: fast exact gradients for ODE ensembles on GPUs

Ordinary differential equations (ODEs) underlie models in science and engineering, and many applications need derivatives of their solutions with respect to parameters. Ensembles of independent trajectories suit graphics processing units (GPUs), but current GPU software forces a trade-off: the fastest ensemble solvers cannot be differentiated in reverse mode at the speed they solve, and the solvers built for differentiation solve more slowly. No single tool has yet offered a reverse-mode gradient at the speed of a fused-kernel solve. We present GRADSOLVE, an open-source JAX library for solving and reverse-mode differentiating low-dimensional ODE ensembles on NVIDIA GPUs. It records the steps an adaptive solver accepts and differentiates a fixed-step replay of them; the returned gradient is the exact discrete adjoint of those steps, the same derivative Diffrax returns by default, obtained more cheaply from a fixed-length chain than from an adaptive loop. It targets ensembles differentiated many times against one recorded mesh, keeps Diffrax as a fallback, and supports explicit and Rosenbrock integrators. Used as a solver, GRADSOLVE's forward-only kernel ran 2.8x faster than DiffEqGPU.jl; used for gradients, once a record exists, it computed them 5.6-14.1x faster than Diffrax's checkpointed adjoint at matched forward-state accuracy across three GPU generations, the advantage narrowing on large ensembles and, on stiff systems, down to parity at tight accuracy. GRADSOLVE is released at https://github.com/ECLIPSE-AI4Science/gradsolve.

cs.MS

Field-level weak lensing cosmology with $60$ simulations using multifidelity simulation-based inference

We perform a realistic KiDS-Legacy mock analysis with field-level neural compression and simulation-based inference using just 60 $N$-body simulations. The weak lensing shear field encodes substantially more cosmological information than standard two-point summary statistics such as the power spectrum. Field-level inference can fully exploit this information, but physical realism at the field-level requires very high-fidelity simulations. This poses a major challenge for simulation-based inference (SBI): accurate empirical density modelling and deep-learning-based neural compression require tens of thousands of training samples, but achieving physical realism at the field level makes each simulation extremely costly. We demonstrate that multifidelity SBI can alleviate this tension by substantially reducing the number of high-fidelity simulations needed for accurate cosmological inference. We pre-train neural inference models on realistic KiDS-Legacy-like shear mocks using fast log-normal \texttt{GLASS} simulations and fine-tune them on a small set of high-fidelity $N$-body simulations. We show that $60$ high-fidelity simulations are sufficient to obtain informative and well-calibrated cosmological posteriors, enabling at least an order-of-magnitude reduction in simulation cost for accurate field-level inference in a realistic setting.

astro-ph.CO

KiDS-Legacy: Constraints on Horndeski gravity from weak lensing combined with galaxy clustering and cosmic microwave background anisotropies

We present constraints on modified gravity from a cosmic shear analysis of the final data release of the Kilo-Degree Survey (KiDS-Legacy) in combination with DESI measurements of baryon acoustic oscillations, eBOSS observations of redshift space distortions, and cosmic microwave background anisotropies from Planck. We study the Horndeski class of modified gravity models in an effective field theory framework employing a parameterisation that satisfies stability conditions by construction and, for the first time, present a cosmological analysis in this inherently stable parameter basis. Cosmic shear constrains the Horndeski parameter space significantly, matching or surpassing the CMB contribution. Adopting the de-mixed kinetic term of the scalar field perturbation, $D_{\rm kin}$, and the deviation of the Planck mass from its fiducial value, $\Delta M_*^2\equiv M_*^2-1$, as model parameters, we constrain their present values to be $\Delta \hat{M}_*^2=0.32^{+0.07}_{-0.21}$ and $\hat{D}_{\rm kin} = 3.74^{+0.69}_{-1.92}$, which deviate from general relativity at $1.5\sigma$ and $1.9\sigma$, respectively. We derive constraints on the structure growth parameter $S_8=0.813^{+0.008}_{-0.011}$, which is compatible with the $\Lambda$CDM constraint at $0.54\sigma$. We obtain the deviation of the effective Newtonian coupling from the GR value as $\Delta \mu_{\infty,{\rm eff}}=0.066\pm0.023$, corresponding to a $2.9\sigma$ significance. Although modified gravity provides a slightly better fit to the data, a model comparison shows only a weak preference for modified gravity at the $1.4\sigma$ level. When adopting a dynamical dark energy model of the background cosmology, the inferred modified gravity parameter constraints are stable with respect to a $\Lambda$CDM background, while a mild preference at $1.57\sigma$ for dynamical dark energy remains.

astro-ph.CO

High-Dimensional Bayesian Model Comparison in Cosmology with GPU-accelerated Nested Sampling and Neural Emulators

We demonstrate a GPU-accelerated nested sampling framework for efficient high-dimensional Bayesian inference in cosmology. Using JAX-based neural emulators and likelihoods for cosmic microwave background and cosmic shear analyses, our approach provides parameter constraints and direct calculation of Bayesian evidence. In the 39-dimensional $\Lambda$CDM vs $w_0w_a$ shear analysis, we produce Bayes factors and a robust error bar in just 2 days on a single A100 GPU, without loss of accuracy. Where CPU-based nested sampling can now be outpaced by methods relying on MCMC sampling and decoupled evidence estimation, we demonstrate that with GPU acceleration nested sampling offers the necessary speed-up to put it on equal computational footing with these methods, especially where reliable model comparison is paramount. We also explore interpolation in the matter power spectrum for cosmic shear analysis, finding a further factor of 4 speed-up with consistent posterior contours and Bayes factor. We put forward both nested and gradient-based sampling as useful tools for the modern cosmologist, where cutting-edge inference pipelines can yield orders of magnitude improvements in computation time.

astro-ph.CO

CLASS_SZ II: Notes and Examples of Fast and Accurate Calculations of Halo Model, Large Scale Structure and Cosmic Microwave Background Observables

These notes are very much work-in-progress and simply intended to showcase, in various degrees of details (and rigour), some of the cosmology calculations that class_sz can do. We describe the class_sz code in C, Python and Jax. Based on the Boltzmann code class, it can compute a wide range of observables relevant to current and forthcoming CMB and Large Scale Structure surveys. This includes galaxy shear and clustering, CMB lensing, thermal and kinetic Sunyaev and Zeldovich observables, Cosmic Infrared Background, cross-correlations and three-point statistics. Calculations can be done either within the halo model or the linear bias model. For standard $\Lambda$CDM cosmology and extensions, class_sz uses high-accuracy cosmopower emulators of the CMB and matter power spectrum to accelerate calculations. With this, along with efficient numerical integration routines, most class_sz output can be obtained in less than 500 ms (CMB $C_\ell$'s or matter $P(k)$ take $\mathcal{O}(1\mathrm{ms})$), allowing for fast or ultra-fast parameter inference analyses. Parts of the calculations are "jaxified", so the software can be integrated into differentiable pipelines.

astro-ph.CO

Savage-Dickey density ratio estimation with normalizing flows for Bayesian model comparison

A core motivation of science is to evaluate which scientific model best explains observed data. Bayesian model comparison provides a principled statistical approach to comparing scientific models and has found widespread application within cosmology and astrophysics. Calculating the Bayesian evidence is computationally challenging, especially as we continue to explore increasingly more complex models. The Savage-Dickey density ratio (SDDR) provides a method to calculate the Bayes factor (evidence ratio) between two nested models using only posterior samples from the super model. The SDDR requires the calculation of a normalised marginal distribution over the extra parameters of the super model, which has typically been performed using classical density estimators, such as histograms. Classical density estimators, however, can struggle to scale to high-dimensional settings. We introduce a neural SDDR approach using normalizing flows that can scale to settings where the super model contains a large number of extra parameters. We demonstrate the effectiveness of this neural SDDR methodology applied to both toy and realistic cosmological examples. For a field-level inference setting, we show that Bayes factors computed for a Bayesian hierarchical model (BHM) and simulation-based inference (SBI) approach are consistent, providing further validation that SBI extracts as much cosmological information from the field as the BHM approach. The SDDR estimator with normalizing flows is implemented in the open-source harmonic Python package.

astro-ph.CO

Transfer learning for multifidelity simulation-based inference in cosmology

Simulation-based inference (SBI) enables cosmological parameter estimation when closed-form likelihoods or models are unavailable. However, SBI relies on machine learning for neural compression and density estimation. This requires large training datasets which are prohibitively expensive for high-quality simulations. We overcome this limitation with multifidelity transfer learning, combining less expensive, lower-fidelity simulations with a limited number of high-fidelity simulations. We demonstrate our methodology on dark matter density maps from two separate simulation suites in the hydrodynamical CAMELS Multifield Dataset. Pre-training on dark-matter-only $N$-body simulations reduces the required number of high-fidelity hydrodynamical simulations by a factor between $8$ and $15$, depending on the model complexity, posterior dimensionality, and performance metrics used. By leveraging cheaper simulations, our approach enables performant and accurate inference on high-fidelity models while substantially reducing computational costs.

astro-ph.CO

Constraining the primordial power spectrum using a differentiable likelihood

The simplest inflationary models predict the primordial power spectrum (PPS) of curvature perturbations to be nearly scale-invariant. However, various other models of inflation predict deviations from this behaviour, motivating a data-driven approach to reconstruct the PPS and constrain its shape. In this work, we present a novel method that employs a fully differentiable pipeline to reconstruct the PPS using Gaussian Processes and uses neural network emulators for fast and differentiable theoretical predictions. By leveraging gradient-based sampling techniques, such as Hamiltonian Monte Carlo, our approach efficiently samples the high-dimensional parameter space of cosmological parameters and the free-form PPS, enabling joint constraints on both. Applying this framework to Planck 2018 Cosmic Microwave Background (CMB) temperature anisotropy data we find our reconstructed PPS to be consistent with near scale-invariance on small scales, while exhibiting large uncertainties at large scales, driven mostly by cosmic variance. Our results show an overestimation of the PPS amplitude compared to $\Lambda$CDM predictions from the Planck 2018 analysis, which we attribute to our choice of a wider prior on the optical depth $\tau$ based on Planck 2015 measurements. Adopting a prior consistent with Planck 2018 measurements brings our results into full agreement with previous work. To ensure robustness of our results, we validate our differentiable pipeline against a non-differentiable framework, and also demonstrate that our results are insensitive to the choice of Gaussian process hyperparameters. These promising results and the flexibility of our pipeline make it ideally suited for application to additional data sets such as CMB polarisation as well as Large-Scale Structure probes, thus moving towards multi-probe primordial power spectrum reconstruction.

astro-ph.CO

Testing interacting dark energy with Stage IV cosmic shear surveys through differentiable neural emulators

We employ a novel framework for accelerated cosmological inference, based on neural emulators and gradient-based sampling methods, to forecast constraints on dark energy models from Stage IV cosmic shear surveys. We focus on dark scattering (DS), an interacting dark energy model with pure momentum exchange in the dark sector, and train COSMOPOWER emulators to accurately and efficiently model the DS non-linear matter power spectrum produced by the halo model reaction framework, including the effects of baryon feedback and massive neutrinos. We embed the emulators within a fully-differentiable pipeline for gradient-based cosmological inference for which the batch likelihood call is up to $O(10^5)$ times faster than with traditional approaches, producing parameter constraints from simulated Stage IV cosmic shear data running on a single graphics processing unit (GPU). We also perform model comparison on the output chains from the inference process, employing the learnt harmonic mean estimator implemented in the software HARMONIC. We investigate degeneracies between dark energy and systematics parameters and assess the impact of scale cuts on the final constraints. Assuming a DS model for the mock data vector, we find that a Stage IV survey cosmic shear analysis can constrain the DS amplitude parameter $A_{\mathrm{ds}}$ with an uncertainty roughly an order of magnitude smaller than current constraints from Stage III surveys, even after marginalising over baryonic feedback, intrinsic alignments and redshift distribution uncertainties. These results show great promise for constraining DS with Stage IV data; furthermore, our methodology can be straightforwardly extended to a wide range of dark energy and modified gravity models.

astro-ph.CO

The future of cosmological likelihood-based inference: accelerated high-dimensional parameter estimation and model comparison

We advocate for a new paradigm of cosmological likelihood-based inference, leveraging recent developments in machine learning and its underlying technology, to accelerate Bayesian inference in high-dimensional settings. Specifically, we combine (i) emulation, where a machine learning model is trained to mimic cosmological observables, e.g. CosmoPower-JAX; (ii) differentiable and probabilistic programming, e.g. JAX and NumPyro, respectively; (iii) scalable Markov chain Monte Carlo (MCMC) sampling techniques that exploit gradients, e.g. Hamiltonian Monte Carlo; and (iv) decoupled and scalable Bayesian model selection techniques that compute the Bayesian evidence purely from posterior samples, e.g. the learned harmonic mean implemented in harmonic. This paradigm allows us to carry out a complete Bayesian analysis, including both parameter estimation and model selection, in a fraction of the time of traditional approaches. First, we demonstrate the application of this paradigm on a simulated cosmic shear analysis for a Stage IV survey in 37- and 39-dimensional parameter spaces, comparing $\Lambda$CDM and a dynamical dark energy model ($w_0w_a$CDM). We recover posterior contours and evidence estimates that are in excellent agreement with those computed by the traditional nested sampling approach while reducing the computational cost from 8 months on 48 CPU cores to 2 days on 12 GPUs. Second, we consider a joint analysis between three simulated next-generation surveys, each performing a 3x2pt analysis, resulting in 157- and 159-dimensional parameter spaces. Standard nested sampling techniques are simply unlikely to be feasible in this high-dimensional setting, requiring a projected 12 years of compute time on 48 CPU cores; on the other hand, the proposed approach only requires 8 days of compute time on 24 GPUs. All packages used in our analyses are publicly available.

astro-ph.CO

Learned harmonic mean estimation of the Bayesian evidence with normalizing flows

We present the learned harmonic mean estimator with normalizing flows - a robust, scalable and flexible estimator of the Bayesian evidence for model comparison. Since the estimator is agnostic to sampling strategy and simply requires posterior samples, it can be applied to compute the evidence using any Markov chain Monte Carlo (MCMC) sampling technique, including saved down MCMC chains, or any variational inference approach. The learned harmonic mean estimator was recently introduced, where machine learning techniques were developed to learn a suitable internal importance sampling target distribution to solve the issue of exploding variance of the original harmonic mean estimator. In this article we present the use of normalizing flows as the internal machine learning technique within the learned harmonic mean estimator. Normalizing flows can be elegantly coupled with the learned harmonic mean to provide an approach that is more robust, flexible and scalable than the machine learning models considered previously. We perform a series of numerical experiments, applying our method to benchmark problems and to a cosmological example in up to 21 dimensions. We find the learned harmonic mean estimator is in agreement with ground truth values and nested sampling estimates. The open-source harmonic Python package implementing the learned harmonic mean, now with normalizing flows included, is publicly available.

astro-ph.IM

Dark Scattering: accelerated constraints from KiDS-1000 with $\tt{ReACT}$ and $\tt{CosmoPower}$

We present constraints on the Dark Scattering model through cosmic shear measurements from the Kilo Degree Survey (KiDS-1000), using an accelerated pipeline with novel emulators produced with $\tt{CosmoPower}$. Our main emulator, for the Dark Scattering non-linear matter power spectrum, is trained on predictions from the halo model reaction framework, previously validated against simulations. Additionally, we include the effects of baryonic feedback from $\tt{HMcode2016}$, whose contribution is also emulated. We analyse the complete set of statistics of KiDS-1000, namely Band Powers, COSEBIs and Correlation Functions, for Dark Scattering in two distinct cases. In the first case, taking into account only KiDS cosmic shear data, we constrain the amplitude of the dark energy - dark matter interaction to be $\vert A_{\rm ds} \vert \lesssim 20$ $\rm b/GeV$ at 68% C.L. Furthermore, we add information from the cosmic microwave background (CMB) from Planck, along with baryon acoustic oscillations (BAO) from 6dFGS, SDSS and BOSS, approximating a combined weak lensing + CMB + BAO analysis. From this combination, we constrain $A_{\rm ds} = 10.6^{+4.5}_{-7.3}$ $\rm b/GeV$ at 68% C.L. We confirm that with this estimated value of $A_{\rm ds}$ the interacting model considered in this work offers a promising alternative to solve the $S_8$ tension.

astro-ph.CO

Fast emulation of anisotropies induced in the cosmic microwave background by cosmic strings

Cosmic strings are linear topological defects that may have been produced during symmetry-breaking phase transitions in the very early Universe. In an expanding Universe the existence of causally separate regions prevents such symmetries from being broken uniformly, with a network of cosmic string inevitably forming as a result. To faithfully generate observables of such processes requires computationally expensive numerical simulations, which prohibits many types of analyses. We propose a technique to instead rapidly emulate observables, thus circumventing simulation. Emulation is a form of generative modelling, often built upon a machine learning backbone. End-to-end emulation often fails due to high dimensionality and insufficient training data. Consequently, it is common to instead emulate a latent representation from which observables may readily be synthesised. Wavelet phase harmonics are an excellent latent representations for cosmological fields, both as a summary statistic and for emulation, since they do not require training and are highly sensitive to non-Gaussian information. Leveraging wavelet phase harmonics as a latent representation, we develop techniques to emulate string induced CMB anisotropies over a 7.2 degree field of view, with sub-arcminute resolution, in under a minute on a single GPU. Beyond generating high fidelity emulations, we provide a technique to ensure these observables are distributed correctly, providing a more representative ensemble of samples. The statistics of our emulations are commensurate with those calculated on comprehensive Nambu-Goto simulations. Our findings indicate these fast emulation approaches may be suitable for wide use in, e.g., simulation based inference pipelines. We make our code available to the community so that researchers may rapidly emulate cosmic string induced CMB anisotropies for their own analysis.

astro-ph.CO

Learned harmonic mean estimation of the marginal likelihood with normalizing flows

Computing the marginal likelihood (also called the Bayesian model evidence) is an important task in Bayesian model selection, providing a principled quantitative way to compare models. The learned harmonic mean estimator solves the exploding variance problem of the original harmonic mean estimation of the marginal likelihood. The learned harmonic mean estimator learns an importance sampling target distribution that approximates the optimal distribution. While the approximation need not be highly accurate, it is critical that the probability mass of the learned distribution is contained within the posterior in order to avoid the exploding variance problem. In previous work a bespoke optimization problem is introduced when training models in order to ensure this property is satisfied. In the current article we introduce the use of normalizing flows to represent the importance sampling target distribution. A flow-based model is trained on samples from the posterior by maximum likelihood estimation. Then, the probability density of the flow is concentrated by lowering the variance of the base distribution, i.e. by lowering its "temperature", ensuring its probability mass is contained within the posterior. This approach avoids the need for a bespoke optimisation problem and careful fine tuning of parameters, resulting in a more robust method. Moreover, the use of normalizing flows has the potential to scale to high dimensional settings. We present preliminary experiments demonstrating the effectiveness of the use of flows for the learned harmonic mean estimator. The harmonic code implementing the learned harmonic mean, which is publicly available, has been updated to now support normalizing flows.

stat.ME

High-accuracy emulators for observables in $\Lambda$CDM, $N_\mathrm{eff}$, $\Sigma m_\nu$, and $w$ cosmologies

We use the emulation framework CosmoPower to construct and publicly release neural network emulators of cosmological observables, including the Cosmic Microwave Background (CMB) temperature and polarization power spectra, matter power spectrum, distance-redshift relation, baryon acoustic oscillation (BAO) and redshift-space distortion (RSD) observables, and derived parameters. We train our emulators on Einstein-Boltzmann calculations obtained with high-precision numerical convergence settings, for a wide range of cosmological models including $\Lambda$CDM, $w$CDM, $\Lambda$CDM+$N_\mathrm{eff}$, and $\Lambda$CDM+$\Sigma m_\nu$. Our CMB emulators are accurate to better than 0.5% out to $\ell=10^4$ which is sufficient for Stage-IV data analysis, and our $P(k)$ emulators reach the same accuracy level out to $k=50 \,\, \mathrm{Mpc}^{-1}$, which is sufficient for Stage-III data analysis. We release the emulators via an online repository CosmoPower Organisation, which will be continually updated with additional extended cosmological models. Our emulators accelerate cosmological data analysis by orders of magnitude, enabling cosmological parameter extraction analyses, using current survey data, to be performed on a laptop. We validate our emulators by comparing them to CLASS and CAMB and by reproducing cosmological parameter constraints derived from Planck TT, TE, EE, and CMB lensing data, as well as from the Atacama Cosmology Telescope Data Release 4 CMB data, Dark Energy Survey Year-1 galaxy lensing and clustering data, and Baryon Oscillation Spectroscopic Survey Data Release 12 BAO and RSD data.

astro-ph.CO

Machine learning assisted Bayesian model comparison: learnt harmonic mean estimator

We resurrect the infamous harmonic mean estimator for computing the marginal likelihood (Bayesian evidence) and solve its problematic large variance. The marginal likelihood is a key component of Bayesian model selection to evaluate model posterior probabilities; however, its computation is challenging. The original harmonic mean estimator, first proposed by Newton and Raftery in 1994, involves computing the harmonic mean of the likelihood given samples from the posterior. It was immediately realised that the original estimator can fail catastrophically since its variance can become very large (possibly not finite). A number of variants of the harmonic mean estimator have been proposed to address this issue although none have proven fully satisfactory. We present the \emph{learnt harmonic mean estimator}, a variant of the original estimator that solves its large variance problem. This is achieved by interpreting the harmonic mean estimator as importance sampling and introducing a new target distribution. The new target distribution is learned to approximate the optimal but inaccessible target, while minimising the variance of the resulting estimator. Since the estimator requires samples of the posterior only, it is agnostic to the sampling strategy used. We validate the estimator on a variety of numerical experiments, including a number of pathological examples where the original harmonic mean estimator fails catastrophically. We also consider a cosmological application, where our approach leads to $\sim$ 3 to 6 times more samples than current state-of-the-art techniques in 1/3 of the time. In all cases our learnt harmonic mean estimator is shown to be highly accurate. The estimator is computationally scalable and can be applied to problems of dimension $O(10^3)$ and beyond. Code implementing the learnt harmonic mean estimator is made publicly available

stat.ME

Modified Gravity and Cosmology: An Update by the CANTATA Network

General Relativity and the $\Lambda$CDM framework are currently the standard lore and constitute the concordance paradigm. Nevertheless, long-standing open theoretical issues, as well as possible new observational ones arising from the explosive development of cosmology the last two decades, offer the motivation and lead a large amount of research to be devoted in constructing various extensions and modifications. All extended theories and scenarios are first examined under the light of theoretical consistency, and then are applied to various geometrical backgrounds, such as the cosmological and the spherical symmetric ones. Their predictions at both the background and perturbation levels, and concerning cosmology at early, intermediate and late times, are then confronted with the huge amount of observational data that astrophysics and cosmology are able to offer recently. Theories, scenarios and models that successfully and efficiently pass the above steps are classified as viable and are candidates for the description of Nature. This work is a Review of the recent developments in the fields of gravity and cosmology, presenting the state of the art, high-lighting the open problems, and outlining the directions of future research. Its realization was performed in the framework of the COST European Action ``Cosmology and Astrophysics Network for Theoretical Advances and Training Actions''.

gr-qc

Towards fast machine-learning-assisted Bayesian posterior inference of microseismic event location and source mechanism

Bayesian inference applied to microseismic activity monitoring allows the accurate location of microseismic events from recorded seismograms and the estimation of the associated uncertainties. However, the forward modelling of these microseismic events, which is necessary to perform Bayesian source inversion, can be prohibitively expensive in terms of computational resources. A viable solution is to train a surrogate model based on machine learning techniques, to emulate the forward model and thus accelerate Bayesian inference. In this paper, we substantially enhance previous work, which considered only sources with isotropic moment tensors. We train a machine learning algorithm on the power spectrum of the recorded pressure wave and show that the trained emulator allows complete and fast event locations for $\textit{any}$ source mechanism. Moreover, we show that our approach is computationally inexpensive, as it can be run in less than 1 hour on a commercial laptop, while yielding accurate results using less than $10^4$ training seismograms. We additionally demonstrate how the trained emulators can be used to identify the source mechanism through the estimation of the Bayesian evidence. Finally, we demonstrate that our approach is robust to real noise as measured in field data. This work lays the foundations for efficient, accurate future joint determinations of event location and moment tensor, and associated uncertainties, which are ultimately key for accurately characterising human-induced and natural earthquakes, and for enhanced quantitative seismic hazard assessments.

physics.geo-ph