Cosmological N-body simulations: a challenge for scalable generative models

Nathanaël Perraudin, Ankit Srivastava, Aurélien Lucchi, Tomasz Kacprzak, Thomas Hofmann, Alexandre Réfrégier

Abstract

Simulating the large-scale structure of the universe is a computationally intensive task, often requiring thousands of hours for high-resolution runs. This paper presents a scalable 3D Generative Adversarial Network (GAN) framework capable of generating high-quality cosmological $N$-body simulations in seconds. By employing a sequential multi-scale approach and patch-based generation, the model addresses memory constraints and physical accuracy, providing a new benchmark for the machine learning community in physical sciences.

Introduction

In cosmology, $N$-body simulations are essential for modeling the "cosmic web"—the intricate network of dark matter halos, filaments, and voids. However, these simulations represent a significant computational bottleneck. Generating a single high-resolution volume can take hours or even days on high-performance computing clusters. While GANs have seen success in 2D image synthesis, scaling them to 3D cosmological volumes ($256^3$ voxels) is hindered by GPU memory limits and the need for strict physical accuracy in skewed data distributions.

Methodology

The authors propose a Sequential Multi-Scale GAN architecture to generate large 3D volumes while capturing both global structures and local details.

Multi-Scale Pipeline

The framework utilizes three GANs ($M_3, M_2, M_1$) operating at increasing resolutions: $32^3, 64^3,$ and $256^3$. The first model, $M_3$, generates a low-resolution global "skeleton." Subsequent models act as upscalers, adding finer details while conditioned on the lower-resolution output to maintain global consistency.

The sequential multi-scale pipeline showing the progression from low-resolution $32^3$ to high-resolution $256^3$ volumes.

Patch-based Generation and Neighborhood Conditioning

To overcome memory constraints, the model generates $256^3$ volumes in smaller $32^3$ patches. To ensure spatial continuity across patch boundaries, the generator is conditioned on the borders of adjacent, previously generated patches. This "neighborhood conditioning" allows the model to decide local features based on the surrounding cosmic environment.

The GAN architecture for patch-based generation, showing the generator conditioned on borders and down-sampled real patches.

The training utilizes a Wasserstein GAN with Gradient Penalty (WGAN-GP) for stability. Additionally, a custom logarithmic transformation is applied to the density data to manage the high dynamic range of the cosmic web, where matter is concentrated in sparse, ultra-dense regions.

Results and Discussion

The proposed GAN framework achieves a massive speedup, generating a $256^3$ sample in approximately 7 seconds on a single GPU—a task that takes 6 to 30 hours using traditional simulators like L-PICOLA or PKDGRAV3.

Visually, the generated 3D cubes are indistinguishable from real simulations, accurately recreating the characteristic filaments and voids. Quantitatively, the model performs well in the mid-range of mass densities. However, challenges remain in capturing the extreme "tails" of the density distribution, where the rarest and densest halos reside. Statistical metrics such as Power Spectral Density (PSD) and mass histograms indicate that while the "typical" universe is well-modeled, high-precision accuracy for rare features is still a hurdle.

Conclusion

This work introduces a scalable baseline for 3D generative modeling in cosmology. By releasing the dataset and evaluation routines at 3DcosmoGAN, the authors invite the community to improve upon these results. Future work will focus on refining statistical accuracy for high-precision science and exploring conditional GANs that can generate simulations based on varying cosmological parameters.

Summary updated

BibTeX
@inproceedings{perraudin2019cosmological,
  author = {Nathanaël Perraudin and Ankit Srivastava and Aurélien Lucchi and Tomasz Kacprzak and Thomas Hofmann and Alexandre Réfrégier},
  title = {{Cosmological N-body simulations: a challenge for scalable generative models}},
  booktitle = {Computational},
  year = {2019},
  doi = {10.1186/s40668-019-0032-1},
}
Figure