Table of Contents
Fetching ...

SymBoltz.jl: a symbolic-numeric, approximation-free and differentiable linear Einstein-Boltzmann solver

Herman Sletmoen

TL;DR

SymBoltz addresses the need for a flexible, differentiable, approximation-free solver for the linear Einstein-Boltzmann equations to enable rapid exploration of extended cosmologies. It introduces a symbolic-numeric interface that compiles high-level equations into fast, implicit ODE code, with automatic stage separation, Jacobian generation, and solution interpolation. It supports automatic differentiation for Fisher forecasting and gradient-based inference, achieving agreement with CLASS at roughly the 0.1% level for power spectra and offering faster computation of P(k) in many regimes. The modular Julia-based tool reduces modeling friction and supports interactive prototyping and differentiable analyses, positioning SymBoltz as a practical complement to traditional Boltzmann codes.

Abstract

SymBoltz is a new Julia package that solves the linear Einstein-Boltzmann equations. It features a symbolic-numeric interface for specifying equations, is free of approximation switching schemes and is compatible with automatic differentiation. Cosmological models are built from replaceable physical components in a way that scales well in model space, or alternatively written as one compact system of equations. The modeler should simply write down their equations, and SymBoltz solves them and eliminates friction in the modeling process. Symbolic knowledge enables powerful automation of tasks, such as separating computational stages like the background and perturbations, generating the analytical Jacobian matrix and its sparsity pattern, and interpolating arbitrary variables from the solution. Implicit solvers integrate the full stiff equations at all times without approximations, which greatly simplifies the code. Performance remains as good as in existing approximation-based codes due to high-order implicit methods that take long time steps, fast generated code, optimal handling of the Jacobian and efficient sparse matrix methods. Automatic differentiation gives exact derivatives of any output with respect to any input, which is important for gradient-based Markov chain Monte Carlo methods in large parameter spaces, training of emulators, Fisher forecasting and sensitivity analysis. The main features form a synergy that reinforces the design of the code. Results agree with established codes to 0.1% with standard precision. More work is needed to implement additional features and for fast reverse-mode automatic differentiation of scalar loss functions. SymBoltz is available at https://github.com/hersle/SymBoltz.jl with single-command installation and extensive documentation, and welcomes all contributions.

SymBoltz.jl: a symbolic-numeric, approximation-free and differentiable linear Einstein-Boltzmann solver

TL;DR

SymBoltz addresses the need for a flexible, differentiable, approximation-free solver for the linear Einstein-Boltzmann equations to enable rapid exploration of extended cosmologies. It introduces a symbolic-numeric interface that compiles high-level equations into fast, implicit ODE code, with automatic stage separation, Jacobian generation, and solution interpolation. It supports automatic differentiation for Fisher forecasting and gradient-based inference, achieving agreement with CLASS at roughly the 0.1% level for power spectra and offering faster computation of P(k) in many regimes. The modular Julia-based tool reduces modeling friction and supports interactive prototyping and differentiable analyses, positioning SymBoltz as a practical complement to traditional Boltzmann codes.

Abstract

SymBoltz is a new Julia package that solves the linear Einstein-Boltzmann equations. It features a symbolic-numeric interface for specifying equations, is free of approximation switching schemes and is compatible with automatic differentiation. Cosmological models are built from replaceable physical components in a way that scales well in model space, or alternatively written as one compact system of equations. The modeler should simply write down their equations, and SymBoltz solves them and eliminates friction in the modeling process. Symbolic knowledge enables powerful automation of tasks, such as separating computational stages like the background and perturbations, generating the analytical Jacobian matrix and its sparsity pattern, and interpolating arbitrary variables from the solution. Implicit solvers integrate the full stiff equations at all times without approximations, which greatly simplifies the code. Performance remains as good as in existing approximation-based codes due to high-order implicit methods that take long time steps, fast generated code, optimal handling of the Jacobian and efficient sparse matrix methods. Automatic differentiation gives exact derivatives of any output with respect to any input, which is important for gradient-based Markov chain Monte Carlo methods in large parameter spaces, training of emulators, Fisher forecasting and sensitivity analysis. The main features form a synergy that reinforces the design of the code. Results agree with established codes to 0.1% with standard precision. More work is needed to implement additional features and for fast reverse-mode automatic differentiation of scalar loss functions. SymBoltz is available at https://github.com/hersle/SymBoltz.jl with single-command installation and extensive documentation, and welcomes all contributions.

Paper Structure

This paper contains 37 sections, 32 equations, 8 figures, 1 table.

Figures (8)

  • Figure 1: SymBoltz represents cosmological models with symbolic equations grouped in physical components for the metric, gravity and particle species. This is compiled to a numerical problem that splits equations into background and perturbation stages and generates fast code for ODE functions $\boldsymbol{f}$ and Jacobians $\boldsymbol{J}$. The problem is then solved and the result stored in a solution object that gives access to any variable $S$ in the model.
  • Figure 2: Included plot recipes in SymBoltz make it trivial to visualize any symbolic variable or expression thereof from a solution of the Einstein-Boltzmann equations. This plot was made with one short line of code per subplot. Wavenumbers $k$ are in units of $H_0/c$.
  • Figure 3: Matter and CMB (TT, TE and EE) power spectra computed by SymBoltz (SB; colored lines) compared to CLASS (CL; grey dashes) with relative errors $\text{rel.err.} = P_k^\text{SB}/P_k^\text{CL}-1$ and $\text{rel.err.} = C_l^\text{SB}/C_l^\text{CL}-1$ for the $\Lambda \text{CDM}$ model. CLASS uses the precision parameters in \ref{['sec:precision']}.
  • Figure 4: Normalized derivatives $(\partial C_l / \partial p_i) / C_l$ of a CMB TT power spectrum with respect to cosmological parameters $p_i$ from SymBoltz and automatic differentiation (AD; colored lines) versus CLASS and central finite differences (FD; gray dashes). CLASS uses the precision parameters in \ref{['sec:precision']} and finite differences with $5 \%$ relative step sizes.
  • Figure 5: Marginalized 68% and 95% 2D confidence ellipses for parameter constraints from a Fisher forecast on a cosmic variance-dominated CMB TT-only survey using the derivatives in \ref{['fig:derivatives']}.
  • ...and 3 more figures