Inpainting Galaxy Counts onto N-Body Simulations over Multiple Cosmologies and Astrophysics

Antoine Bourdin, Ronan Legin, Matthew Ho, Alexandre Adam, Yashar Hezaveh, Laurence Perreault-Levasseur

TL;DR

Simulating full cosmological hydrodynamics with baryonic physics (stars, gas, and galaxies) costs hundreds of millions of CPU hours, whereas dark-matter-only N-body simulations are orders of magnitude faster but lack galaxies. This paper introduces a 3D conditional score-based diffusion model that directly "paints" realistic, stochastic galaxy count fields onto N-body simulations across varying cosmologies and astrophysical feedback regimes in minutes, outperforming traditional Halo Occupation Distribution (HOD) baselines.

What Problem Does This Paper Address?

To extract fundamental physics from galaxy surveys, cosmologists must compare observational data against large suites of simulations. However, full cosmological hydrodynamic simulations scale as $\mathcal{O}(n^2)$ due to complex thermodynamic, radiative, and feedback processes, requiring up to tens or hundreds of millions of CPU hours per volume.

Gravity-only N-body simulations scale as $\mathcal{O}(n \log n)$ and accurately track the cold dark matter that makes up ~85% of cosmic matter, but they do not simulate visible galaxies. Standard phenomenological methods to bridge this gap—such as Halo Occupation Distribution (HOD) models—rely on simplifying assumptions: they map galaxies based strictly on isolated dark matter halo masses, ignoring surrounding environmental factors (e.g., cosmic filaments and voids), failing to capture baryonic spatial shifts, and lacking sensitivity to variations in cosmological parameters.

Methods

The authors frame the task as learning a conditional probability distribution $p(\mathbf{x}|\mathbf{y})$ of 3D galaxy count fields $\mathbf{x}$ conditioned on dark matter density fields $\mathbf{y}$.

  • Conditional Score-Based Diffusion: The model learns the conditional score $\nabla_{\mathbf{x}} \log p_t(\mathbf{x}|\mathbf{y})$ using a continuous Variance-Exploding Stochastic Differential Equation (VE-SDE).
  • Architecture: A 3D U-Net featuring four down/upsampling stages with BigGAN residual blocks. The conditioning dark matter field $\mathbf{y}$ is supplied as an extra input channel. Crucially, the model does not receive cosmological or astrophysical parameters as inputs; it learns to implicitly marginalize over them directly from the structure of $\mathbf{y}$.
  • Handling Discrete Galaxy Counts: Continuous diffusion models often fail on high-valued discrete count data. The authors tackle this by applying a $\log_{10}$ transformation to galaxy counts and appending high-frequency sinusoidal feature embeddings ($\sin$ and $\cos$ maps at frequencies 64 and 128) to help the network resolve steep gradient steps between adjacent voxels.

Datasets

The model was trained and evaluated on the Latin Hypercube (LH) set of the CAMELS-ASTRID suite:

  • Content: 1,000 paired N-body and hydrodynamical simulations in boxes of volume $(25\,h^{-1}\text{Mpc})^3$.
  • Varied Parameters: Each pair varies six parameters spanning cosmological ($\Omega_m \in [0.1, 0.5]$, $\sigma_8 \in [0.6, 1.0]$) and astrophysical feedback ($A_{\text{SN1}}, A_{\text{SN2}}$ for supernovae; $A_{\text{AGN1}}, A_{\text{AGN2}}$ for active galactic nuclei).
  • Grid Setup: Dark matter mass and galaxies (stellar mass $> 10^{9.5} M_\odot / h$) were voxelized onto $32^3$ grids. 900 simulations were used for training and 100 reserved for testing.

Key Insights and Ideas

  • Implicit Marginalization: The network infers the underlying cosmological and astrophysical context entirely from the nonlinear dark matter distribution, producing accurate galaxy distributions across widely varying cosmologies without explicit parameter conditioning.
  • Environmental Context Beats Halo Mass: Unlike HOD approaches that operate purely per-halo, the U-Net’s multi-scale receptive field captures surrounding cosmic environments, correctly suppressing galaxy formation in low-density voids and preventing over-clustering in dense nodes.
  • Correcting Baryonic Displacements: Adding baryons gravitationally alters halo positions relative to gravity-only N-body runs. While HOD cannot compensate for these shifts, the diffusion model’s higher Fourier cross-correlation demonstrates that it learns to adjust for these positional discrepancies.

Key Results

  • Generation Speed: The model generated 100 conditional realizations for a given N-body simulation in 20 minutes (generating 10,000 test fields across 100 cosmologies took 80 minutes on 20 NVIDIA A100 GPUs)—representing a speedup of several orders of magnitude over running hydro simulations.
  • Summary Statistics Precision: Across scales $0.36\,h\,\text{Mpc}^{-1} \le k \le 3.88\,h\,\text{Mpc}^{-1}$, the diffusion model matches the true hydrodynamical power spectrum $P(k)$ (ratio $\approx 1.0$) and exhibits higher cross-correlation than HOD across all scales.
  • Distribution Calibration: Evaluated across the 100 test cosmologies using the Test of Accuracy with Random Points (TARP), the diffusion model aligns closely with nominal credibility diagonals, whereas HOD shows significant calibration errors.

Limitations and Future Work

  • Resolution and Volume: The current model operates on modest $32^3$ grids within small $(25\,h^{-1}\text{Mpc})^3$ boxes. Future efforts will leverage convolutional architectures to outpaint larger cosmological volumes and resolve higher spatial resolutions.
  • Low-Credibility Bias: The TARP metric revealed slight coverage bias at lower credibility levels, likely reflecting training set sample variance (900 simulations); data augmentation and multi-suite pretraining are proposed remedies.
  • Simulation-Based Inference (SBI): The authors plan to test whether synthetic galaxy fields generated by this emulator can substitute for expensive hydrodynamical simulations to train downstream neural parameter-inference pipelines without introducing bias.

Summary updated

BibTeX
@inproceedings{bourdin2024inpainting,
  author = {Antoine Bourdin and Ronan Legin and Matthew Ho and Alexandre Adam and Yashar Hezaveh and Laurence Perreault-Levasseur},
  title = {{Inpainting Galaxy Counts onto N-Body Simulations over Multiple Cosmologies and Astrophysics}},
  booktitle = {AI4Science @ ICML},
  year = {2024},
  url = {https://openreview.net/forum?id=jFZvD2dgUM},
}
Figure