Abstract: Recently, a type of neural networks called generative adversarial networks (GANs) has been proposed as a solution for the fast generation of simulation-like datasets in an attempt to avoid intensive computations and running cosmological simulations that are expensive in terms of time and computing power. We built and trained a GAN to determine the strengths and limitations of such an approach in more detail. We then show how we made use of the trained GAN to construct an autoencoder (AE) that can conserve the statistical properties of the data. The GAN and AE were trained on images and cubes issued from two types of N-body simulations, namely 2D and 3D simulations. We find that the GAN successfully generates new images and cubes that are statistically consistent with the data on which it was trained. We then show that the AE can efficiently extract information from simulation data and satisfactorily infers the latent encoding of the GAN to generate data with similar large-scale structures.
Introduction
Understanding the evolution of the universe requires massive N-body simulations (like Millennium or IllustrisTNG) that track millions of particles under the influence of gravity. While accurate, these simulations are computationally expensive, requiring thousands of CPU hours. There is a growing need for "mock" datasets to calibrate telescopes and test cosmological theories. Analytical models are fast but struggle with the highly non-linear structures—clusters and filaments—that form as gravity pulls matter together. This research explores whether deep learning can provide a "shortcut" to generate realistic cosmic structures in seconds rather than days.
Methods and Data Transformation
The authors employed two primary neural network architectures: Generative Adversarial Networks (GANs) and Autoencoders (AEs). Based on the DCGAN architecture, the GAN uses a Generator to create fake cosmic maps from random noise and a Discriminator to distinguish them from real simulation data. In a novel approach, the researchers used the pre-trained GAN Generator as a decoder for an Autoencoder, training a separate Encoder to map real simulation images into the GAN’s latent space.
Because cosmic density maps have a massive dynamic range—mostly empty space with extremely dense clusters—a log-like transformation was applied. This "flattens" the data, making the faint filaments visible to the neural network and ensuring the model doesn't focus solely on the densest peaks.
Datasets
The models were trained on two types of data derived from N-body simulations:
- 2D Snapshots: 1000 independent $256 \times 256$ density maps generated from a particle-mesh simulation using standard $\Lambda$CDM cosmology.
- 3D Cubes: Data from the GADGET2 code, representing a $100 \text{ Mpc}^3$ box with $512^3$ particles, from which $64^3$ sub-cubes were extracted for training.
Key Results
- Statistical Fidelity: The GAN-generated images were virtually indistinguishable from real simulations. Quantitatively, the Power Spectrum and Pixel PDF showed nearly perfect overlap with the ground truth, indicating that the GAN successfully captured the matter distribution across various scales.
- Halo Recovery: The models accurately reproduced "peak counts"—the high-density regions where galaxies form—confirming that the GANs captured the underlying physics of gravitational collapse.
- Efficient Compression: The AE successfully compressed 3D volumes ($64^3$ voxels) into a compact 200-element vector. Using the Sørensen-Dice coefficient, the authors showed that the AE is particularly excellent at recovering the "skeleton" of the cosmic web.
Discussion and Future Work
While the models are highly effective, they exhibit saturation at extremely low densities ($< 10^{-3}$ particles per pixel), meaning "voids" are less detailed than filaments. Additionally, like many GANs, the model occasionally suffers from "mode collapse" if overtrained.
Despite these limitations, this framework offers a powerful tool for cosmological research. Future applications could include "inpainting" to fill in missing data in galaxy surveys or removing instrumental noise from astronomical observations, providing a fast and physically consistent alternative to traditional simulation methods.
Summary updated