JAX-COSMO: An End-to-End Differentiable and GPU Accelerated Cosmology Library
Jean-Eric Campagne, François Lanusse, Joe Zuntz, Alexandre Boucaud, Santiago Casas, Minas Karamanis, David Kirkby, Denise Lanzieri, Yin Li, Austin Peel
我们提出了jax-cosmo,这是一个用于宇宙学理论计算自动微分的库。它使用JAX库,后者已经构建了一个全新的编程生态系统,尤其在概率编程领域表现突出。除了批量加速、即时编译以及针对不同硬件类型(CPU、GPU、TPU)的代码自动优化功能外,JAX还提供了自动微分(autodiff)机制。得益于自动微分技术,jax-cosmo能够获取宇宙学似然函数相对于其任意参数的导数,从而支持一系列原本在宇宙学领域难以实现的强大贝叶斯推断算法,例如哈密顿蒙特卡洛(Hamiltonian Monte Carlo)和变分推断(Variational Inference)。\n在其初始版本中,jax-cosmo实现了背景演化、线性与非线性功率谱(采用halofit模型或Eisenstein and Hu转移函数),以及适用于星系和弱引力透镜探测的、基于Limber近似的角功率谱,所有这些计算都支持相对于宇宙学参数及其他输入量的微分操作。我们举例说明了自动微分如何为费希尔矩阵计算、或基于梯度技术的完整后验推断等常见任务带来颠覆性改变。具体而言,我们展示了如今费希尔矩阵计算速度快、结果精确,不再需要任何精细调优,且其本身也具备可微性。\n最后,我们以暗能量巡天第一年(Dark Energy Survey Year 1)的3x2pt分析作为基准,演示了jax-cosmo如何与概率编程语言结合,使用包括无回跳采样器(No U-Turn Sampler)、自动微分变分推断(Automatic Differentiation Variational Inference)以及神经输运哈密顿蒙特卡洛(Neural Transport HMC)在内的前沿算法执行后验推断。我们进一步证明,采用神经输运的归一化流(Normalizing Flows)是分析初期阶段模型验证的一种很有前景的方法。
英文摘要:
We present jax-cosmo, a library for automatically differentiable cosmological theory calculations. It uses the JAX library, which has created a new coding ecosystem, especially in probabilistic programming. As well as batch acceleration, just-in-time compilation, and automatic optimization of code for different hardware modalities (CPU, GPU, TPU), JAX exposes an automatic differentiation (autodiff) mechanism. Thanks to autodiff, jax-cosmo gives access to the derivatives of cosmological likelihoods with respect to any of their parameters, and thus enables a range of powerful Bayesian inference algorithms, otherwise impractical in cosmology, such as Hamiltonian Monte Carlo and Variational Inference. In its initial release, jax-cosmo implements background evolution, linear and non-linear power spectra (using halofit or the Eisenstein and Hu transfer function), as well as angular power spectra with the Limber approximation for galaxy and weak lensing probes, all differentiable with respect to the cosmological parameters and their other inputs. We illustrate how autodiff can be a game-changer for common tasks involving Fisher matrix computations, or full posterior inference with gradient-based techniques. In particular, we show how Fisher matrices are now fast, exact, no longer require any fine tuning, and are themselves differentiable. Finally, using a Dark Energy Survey Year 1 3x2pt analysis as a benchmark, we demonstrate how jax-cosmo can be combined with Probabilistic Programming Languages to perform posterior inference with state-of-the-art algorithms including a No U-Turn Sampler, Automatic Differentiation Variational Inference,and Neural Transport HMC. We further demonstrate that Normalizing Flows using Neural Transport are a promising methodology for model validation in the early stages of analysis.
Furax: A Modular JAX Framework for Linear Operators in Astrophysical and Cosmological Data Analysis
Jodrell Bank Centre for Astrophysics, The University of Manchester(曼彻斯特大学天体物理学中心);Université Paris Cité, CNRS, Astroparticule et Cosmologie(巴黎西岱大学、法国国家科学研究中心、粒子与宇宙学);Istituto Nazionale di Fisica Nucleare, Sezione di Ferrara(意大利国家核物理研究所,费拉拉分部)
pmwd: A Differentiable Cosmological Particle-Mesh $N$-body Library
大尺度结构的形成,星系、类星体和暗物质在宇宙尺度上的演化和分布,都需要数值模拟。可微模拟提供了宇宙学参数的梯度,这可以加速从观测数据的统计分析中提取物理信息。深度学习革命不仅带来了无数强大的神经网络,还带来了包括自动微分(AD)工具和GPU等计算加速器在内的突破,从而促进了对宇宙的可微模拟的前向建模。由于AD需要保存整个前向演化历史以反向传播梯度,当前可微宇宙学模拟受到内存的限制。利用伴随方法,通过逆时间积分重构演化历史,开发了一个低内存开销的可微宇宙学粒子网格(PM)模拟库pmwd(particle-mesh with derivatives).基于强大的AD库JAX,pmwd是完全可区分的,并且在GPU上具有高性能。
cloelike: A Python Library for Cosmological Likelihood Inference in the Euclid Era
Waterloo Centre for Astrophysics, University of Waterloo(滑铁卢天体物理中心,滑铁卢大学);Leiden Observatory, Leiden University(莱顿天文台,莱顿大学);Centre for Astrophysics Research, University of Hertfordshire(天体物理学研究中心,赫特福德大学);Scientific Information, German Aerospace Center (DLR)(科学信息部,德国航空航天中心);INAF - Osservatorio Astronomico di Trieste(意大利国家天体物理研究所 - 的里雅斯特天文台);INAF - Osservatorio Astronomico di Brera(意大利国家天体物理研究所 - 布雷拉天文台);Institute of Space Sciences (ICE, CSIC)(空间科学研究所);INAF - IASF Milano(意大利国家天体物理研究所 - 米兰天体物理研究所);Astronomical Institute (AIRUB), Ruhr University Bochum(天文研究所,鲁尔大学波鸿分校);Department of Physics, University of Oxford(物理系,牛津大学);Dipartimento di Fisica "Aldo Pontremoli", Università degli Studi di Milano(物理系,米兰大学);IRAP, Université de Toulouse(天体物理研究所,图卢兹大学);Osservatorio Astronomico di Roma(罗马天文台);Mullard Space Science Laboratory, University College London(穆拉德太空科学实验室,伦敦大学学院);Software Institut d’Estudis Espacials de Catalunya (IEEC)(加泰罗尼亚空间研究研究所)
Fast(er)PM and Moving Mesh: JAX-native Geometric Multigrid Methods
Kavli IPMU (WPI)(卡弗里宇宙学前沿研究所);UTIAS(多伦多大学应用科学与工程研究所);The University of Tokyo(东京大学);Center for Data-Driven Discovery, Kavli IPMU (WPI)(卡弗里宇宙学前沿研究所数据驱动发现中心);Lawrence Berkeley National Lab(劳伦斯伯克利国家实验室)
Differentiable Cosmological Hydrodynamics for Field-Level Inference and High Dimensional Parameter Constraints
Kavli IPMU (WPI), UTIAS, The University of Tokyo(东京大学 Kavli宇宙物理数学研究所(WPI)UTIAS);Center for Data-Driven Discovery, Kavli IPMU (WPI), UTIAS, The University of Tokyo(东京大学 Kavli宇宙物理数学研究所(WPI)UTIAS 数据驱动发现中心);Lawrence Berkeley National Lab(劳伦斯伯克利国家实验室)
DISCO-DJ II: a differentiable particle-mesh code for cosmology
University of Vienna(维也纳大学);Department of Astrophysics, Türkenschanzstraße 17, 1180 Vienna, Austria(天体物理系);Department of Mathematics, Oskar-Morgenstern-Platz 1, 1090 Vienna, Austria(数学系)
High-Dimensional Bayesian Model Comparison in Cosmology with GPU-accelerated Nested Sampling and Neural Emulators
Institute of Astronomy, University of Cambridge(剑桥大学天文学研究所);Kavli Institute for Cosmology, University of Cambridge(剑桥大学卡弗里宇宙学研究所);Department of Physics, Royal Holloway, University of London(伦敦大学皇家霍洛威学院物理系)