Papers
Topics
Authors
Recent
Search
2000 character limit reached

Differentiable PM N-body Simulations: DISCO-DJ II

Updated 23 April 2026
  • The paper introduces DISCO-DJ II, a GPU-accelerated, fully differentiable particle–mesh code that accurately simulates cosmic structure formation for end-to-end parameter inference.
  • It employs advanced time integration methods like BullFrog to achieve per-cent level accuracy with minimal time steps, leveraging FFT-based force computations and NUFFT for precision.
  • The framework utilizes JAX’s automatic differentiation with an adjoint strategy, ensuring efficient gradient computation and seamless integration with modern inference and machine learning pipelines.

Differentiable Particle–Mesh (PM) N-body simulations represent a convergence of modern high-performance computational astrophysics, cosmological inference, and automatic differentiation frameworks. DISCO-DJ II is a GPU-accelerated, fully differentiable particle–mesh code tailored for the rapid and accurate simulation of the large-scale structure in the mildly non-linear regime of cosmic structure formation. Its design philosophy is to combine field-level accuracy, computational performance, and full differentiability—both in forward and reverse (adjoint) mode—thus enabling end-to-end, gradient-based inference of cosmological parameters and initial conditions directly from observational data (List et al., 6 Oct 2025).

1. Mathematical and Algorithmic Foundation

DISCO-DJ II simulates the evolution of cosmic matter using the Vlasov–Poisson system in comoving coordinates (x,p)(\mathbf{x},\mathbf{p}), with background expansion parameterized by the scale factor aa: tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta, where δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 1 (List et al., 6 Oct 2025).

In the NN-body discretization, the phase-space density ff is represented by NN tracer particles, whose masses are deposited onto an Ng3N_g^3 mesh using mass-assignment kernels WW, most commonly using CIC (linear), TSC (quadratic), or PCS (cubic spline). The deposited density ρ(xg)\rho(\mathbf{x}_g) is then used to solve Poisson’s equation via FFTs on the mesh, enabling rapid determination of the gravitational potential and subsequent acceleration computation. The resulting mesh-based gravitational force is interpolated back to the particle positions, closing the evolution loop (List et al., 6 Oct 2025, Li et al., 2022, Li et al., 2022).

2. Time Integration Schemes: BullFrog and Beyond

Accurate time integration is essential for minimizing systematic biases in cosmological predictions. DISCO-DJ II implements a flexible drift–kick–drift (DKD) integrator,

aa0

with step size aa1 and aa2 representing acceleration. The parameters aa3 specialize the scheme:

  • FastPM: Enforces 1LPT-consistency and symplecticity by matching the Zel’dovich approximation (ZA), with aa4, aa5, where aa6.
  • BullFrog: Implements exact 2LPT consistency at each step:

aa7

where aa8 is the linear growth factor, aa9 (List et al., 6 Oct 2025).

BullFrog yields per-cent-level accuracy in the power spectrum with as few as tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,0–tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,1 time steps at tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,2, significantly enhancing efficiency in parameter inference pipelines.

3. Force Computation: Particle–Mesh and NUFFT Approaches

Force evaluation in DISCO-DJ II employs advanced mass assignment and interpolation:

  • Mass assignment: Standard (CIC, TSC, PCS) kernels tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,3 are used, possessing analytically known real- and Fourier-space forms; for instance, tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,4 for the order-tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,5 kernel.
  • FFT-based PM: Poisson's equation is solved on the mesh as tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,6, and the acceleration as tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,7.
  • Interpolation: The force is interpolated to particles via the same kernel or with a custom Non-Uniform FFT (NUFFT), employing an exponential-of-semicircle spreading kernel of tunable support, grid upsampling (tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,81.25tf+pa2xfxϕapf=0;x2ϕ=3ΩmH022δ,\partial_t f + \frac{\mathbf{p}}{a^2}\cdot\nabla_{\mathbf{x}} f - \frac{\nabla_{\mathbf{x}}\phi}{a}\cdot\nabla_{\mathbf{p}} f = 0;\quad \nabla^2_{\mathbf{x}} \phi = \frac{3\Omega_m H_0^2}{2}\delta,9), and frequency truncation. Aliasing can be controlled down to arbitrary accuracy by increasing the kernel size.
  • Anti-aliasing and deconvolution: DISCO-DJ II implements interlaced meshes, explicit deconvolution (divide by δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 10), and advanced resampling to suppress artifacts (List et al., 6 Oct 2025).

4. Differentiable Architecture and Adjoint Gradient Computation

Every operation in DISCO-DJ II is written in JAX, supporting both forward- and reverse-mode automatic differentiation. While forward-mode gradient evaluation (Jacobian-vector product, JVP) can be straightforwardly parallelized, reverse-mode (vector-Jacobian product, VJP) naïvely incurs δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 11 memory overhead.

To address this, DISCO-DJ II implements a continuous adjoint (discretize-then-optimize) strategy. The adjoint drift–kick–drift scheme propagates cotangent variables δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 12 backward in time using the same integrator as the forward pass but requires only δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 13 memory with respect to the number of time steps. All gather/scatter operations exploit their linearity for custom JVP/VJP rules, ensuring end-to-end differentiability at minimal memory footprint. This mirrors regular adjoint-based PM codes such as pmwd (Li et al., 2022, Li et al., 2022).

5. Numerical Accuracy and Performance Benchmarks

Default settings for high-fidelity cosmological inference are as follows:

  • δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 14 particles, box δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 15, initial conditions at δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 16 from 2LPT; PM grid δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 17 per dimension; CIC mass assignment, no deconvolution; BullFrog integrator, uniform stepping in δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 18 (List et al., 6 Oct 2025).
  • With BullFrog:
    • δ(x)=f(x,p)d3p1\delta(\mathbf{x}) = \int f(\mathbf{x},\mathbf{p})\, d^3p - 19 time steps: per-cent accuracy in NN0 for NN1Mpc.
    • NN2 steps: NN3 error up to NN4Mpc.
    • NN5 steps: NN6 error at NN7Mpc.

Timing benchmarks (single NVIDIA A100):

Configuration Time per step (s)
NN8 (CIC + NN9 grid, no deconv.) 0.4
ff0 (CIC + ff1 grid, deconv.) 0.2
ff2 (NUFFT, kernel ff3) 0.3
ff4 0.1
ff5 0.02

This suggests near-linear scaling with ff6 in practice. (List et al., 6 Oct 2025)

6. Field-Level Inference: Direct Application

DISCO-DJ II enables fully differentiable field-level Bayesian inference. In a prototypical application, a synthetic Gadget-4 ff7 matter field (box ff8 Mpc/ff9) is degraded by Gaussian white noise. The latent variables are the initial Gaussian random field NN0 (for NN1) and the cosmological amplitude NN2.

The likelihood in (Fourier) data space, up to NN3Mpc, is

NN4

A forward model with NN5 particles and BullFrog (16 steps) yields a gradient evaluation in less than NN6 ms (A100). Posterior sampling via Hamiltonian Monte Carlo (BlackJAX) successfully recovers NN7 (input 0.8102, cosmic-variance shift NN80.8062), and reconstructs large-scale modes of the initial and final density fields with high accuracy (List et al., 6 Oct 2025).

7. Ecosystem Integration and Future Directions

DISCO-DJ II is designed to function in tandem with a differentiable Einstein–Boltzmann solver, forming a pipeline that is differentiable from primordial initial conditions and cosmological parameters through to the non-linear matter field at late times. Its technical backbone—JAX and the adjoint PM methodology—ensures compatibility with modern scientific machine learning platforms, simulation-based inference, and rapid prototyping workflows (List et al., 6 Oct 2025, Li et al., 2022, Li et al., 2022).

Further development directions include nonparametric time-stepping, coupling to semi-analytic or deep-learning subgrid models, distributed multi-GPU capabilities, and incorporation of additional physics such as short-range (PP) forces and baryonic effects. A plausible implication is that such pipelines will become standard tools for next-generation, inference-driven cosmological survey analyses.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Differentiable Particle–Mesh N-body Simulations (DISCO-DJ II).