CosmoFlow: Scale-Aware Representation Learning for Cosmology with Flow Matching

Sidharth Kannan, Tian Qiu, Carolina Cuesta-Lázaro, Haewon JeongarXiv 2025 · DOI

Abstract

CosmoFlow is a novel generative framework designed to compress high-dimensional cosmological simulation data into compact, 8-element latent vectors without sacrificing physical accuracy. By leveraging flow matching and a unique progressive masking technique, CosmoFlow learns scale-aware representations that preserve critical small-scale details often lost in traditional Variational Autoencoders (VAEs). Our results demonstrate that CosmoFlow achieves high-fidelity reconstructions and enables accurate cosmological parameter inference, overcoming the "data deluge" bottleneck in modern cosmology.

Introduction

Modern cosmology relies on massive hydrodynamic simulations, such as AbacusSummit, which can exceed 2,000 Terabytes in size. This "data deluge" creates a significant bottleneck for machine learning, as training models directly on such high-dimensional raw data is computationally impractical. To address this, researchers use representation learning to map complex data into a compact "latent space." However, existing methods like Variational Autoencoders (VAEs) often produce blurry reconstructions, losing the high-frequency (small-scale) details crucial for understanding cosmic physics.

Methods

The authors introduce CosmoFlow, which combines a ResNet encoder with a Flow Matching decoder to achieve high-fidelity compression.

Flow Matching and Progressive Masking

Flow matching is a generative paradigm that learns a "velocity field" to transform simple Gaussian noise into complex cosmological maps. The "secret sauce" of CosmoFlow is progressive masking: during decoding, the model is forced to use different latent channels at different time steps. Early in the flow, it uses all channels to build the large-scale structure; as it nears the final image, it masks channels, forcing the remaining ones to focus on fine-grained details. This results in a latent space disentangled by physical scale.

Architecture

A ResNet-18 compresses a $256 \times 256$ image into "compressed fields," which are then pooled into a tiny 8-element "summary statistics" vector. The model was trained on the CAMELS Multifield Dataset (Astrid suite), focusing on Cold Dark Matter (CDM) maps.

Key Results

CosmoFlow achieves a 32x reduction in compressed field size while maintaining scientific integrity.

High-Fidelity Reconstruction

Unlike VAEs, which fail at high frequencies, CosmoFlow’s power spectrum closely matches the original data across almost all scales. This ensures that both the large-scale cosmic web and small-scale dark matter clumps are accurately represented.

Visual and spectral comparison of CosmoFlow and VAE reconstructions against the original simulation field.

Parameter Inference

Using only the 8-element summary vector, CosmoFlow can estimate cosmological parameters like matter density ($\Omega_m$) and fluctuation amplitude ($\sigma_8$) with roughly 5% error—performance nearly as accurate as models trained on full, uncompressed data.

Discussion and Future Work

While CosmoFlow provides realistic reconstructions, slight deviations remain at the highest frequencies. Furthermore, its current inability to distinguish between Cold and Warm Dark Matter in its latent space limits its use for direct anomaly detection. Future work will focus on 3D point cloud data and integrating advanced neural compression modules to shrink data even further.

Summary updated

BibTeX
@misc{kannan2025cosmoflow,
  author = {Sidharth Kannan and Tian Qiu and Carolina Cuesta-Lázaro and Haewon Jeong},
  title = {{CosmoFlow: Scale-Aware Representation Learning for Cosmology with Flow Matching}},
  year = {2025},
  eprint = {2507.11842},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.11842},
}
Figure