CNN+FoF: application of deep learning to the identification of dark matter haloes
We present a deep-learning-based approach for identifying dark matter haloes in cosmological N-body simulations. Our framework consists of a volumetric Convolutional Neural Network to classify individual simulation particles as either halo or non-halo members, followed by a highly optimised and parallelised Friends-of-Friends clustering algorithm that groups the classified halo members into distinct haloes. The training data comprise simulations generated using GADGET-4, with labels obtained with the ROCKSTAR halo finder. Our models incorporate two main halo mass definitions, $M_{200\mathrm{b}}$ and $M_{\text{vir}}$, with similar performance. For haloes defined by the ROCKSTAR $M_{200\mathrm{b}}$ criterion, the classification network demonstrated stable performance across multiple simulation resolutions. For the highest resolution, it achieved over $98%$ across all primary performance metrics when identifying halo particles. Furthermore, the FoF algorithm yielded halo catalogues with a purity generally exceeding $95%$ and a stable completeness of $93%$ for masses above $5\times10^{11} , M_\odot$. Our pipeline recovered the centre-of-mass positions, velocities and halo masses with high fidelity, yielding a halo mass function consistent to within $5%$ of the reference while faithfully reconstructing the internal density profiles. The primary objective of this study is to offer a faster and scalable alternative to conventional halo finders, achieving a speed-up of approximately one order of magnitude relative to ROCKSTAR, offering a promising pathway for modern simulation-based inference methods that rely on rapid and accurate structure identification.
💡 Research Summary
This paper introduces a hybrid halo‑finding pipeline that combines a three‑dimensional convolutional neural network (CNN) with a highly optimized Friends‑of‑Friends (FoF) clustering algorithm, aiming to provide a fast, scalable, and accurate alternative to traditional halo finders such as ROCKSTAR. The authors generate a suite of cosmological N‑body simulations using GADGET‑4 under a flat ΛCDM cosmology, covering four configurations (L = 200 Mpc with N = 32³, 64³, 128³ particles and a high‑resolution L = 100 Mpc, N = 128³ run). ROCKSTAR is employed to produce ground‑truth halo catalogs using two common overdensity definitions, M₍₂₀₀b₎ and M₍vir₎. Particles inside the overdensity radius of any ROCKSTAR halo are labeled as halo members (y = 1); all others are non‑members (y = 0). Only halos with ≥ 25 particles are retained to avoid noise‑dominated structures.
The CNN component is based on the VNet architecture originally developed for volumetric density field emulation (He et al. 2019). Input to the network is a six‑channel voxel grid: three displacement components (Ψₓ, Ψᵧ, Ψ𝓏) relative to the initial lattice and three velocity components (vₓ, vᵧ, v𝓏). The grid resolution matches the particle count (N₍res₎³ voxels), guaranteeing a one‑to‑one mapping between voxels and particles. The encoder consists of three down‑sampling stages, each with two 3×3×3 convolutions (stride 1, periodic padding) followed by a stride‑2 convolution that halves the spatial dimensions while doubling the channel count (64 → 128 → 256). The decoder mirrors this structure with transposed convolutions for up‑sampling and skip connections that concatenate encoder features to preserve fine‑scale information. All intermediate layers use ReLU activations and batch normalization; the final layer applies a sigmoid to produce a halo‑membership probability per voxel. The network contains roughly 8.4 million trainable parameters and is trained with binary cross‑entropy loss using the Adam optimizer (learning rate = 0.001). Training data comprise 350 simulations per resolution, with 50 for validation and 100 for testing, ensuring robust performance across cosmological variance.
After the CNN predicts probabilities, a threshold (typically 0.5) selects candidate halo particles. These candidates are then fed to a custom FoF implementation that operates on the CPU but is heavily parallelized using OpenMP and SIMD vectorization. By clustering only the filtered subset, the algorithm reduces the number of distance calculations by more than an order of magnitude compared with a naïve FoF applied to the full particle set. The FoF uses the standard linking length (0.2 times the mean inter‑particle separation) and merges particles into distinct groups, each identified as a halo.
Performance evaluation proceeds on two levels. At the particle‑classification stage, the model achieves > 98 % accuracy, precision, recall, and F1‑score on the held‑out test set, with an ROC‑AUC of 0.997. At the halo‑catalog level, for halos defined by M₍₂₀₀b₎ with masses above 5 × 10¹¹ M⊙, the catalog purity exceeds 95 % and completeness stays around 93 %. The resulting halo mass function matches the ROCKSTAR reference within 5 % across the full mass range, and recovered halo centres, bulk velocities, and NFW‑fit density profiles show negligible bias (position offsets ≲ 0.02 Mpc, velocity differences ≲ 10 km s⁻¹). Importantly, the pipeline’s runtime is roughly ten times faster than ROCKSTAR on the same hardware; the CNN inference (GPU‑accelerated) accounts for ~70 % of the total wall‑clock time, while the FoF clustering completes in a few seconds even for simulations containing > 10⁹ particles.
The authors discuss several limitations and avenues for improvement. First, the supervised approach relies on ROCKSTAR labels; any systematic errors in those labels propagate into the CNN. Second, the current FoF step remains CPU‑bound; a fully GPU‑native clustering routine could further reduce latency and simplify integration into end‑to‑end differentiable pipelines. Third, sub‑halo detection is not addressed; extending the network to multi‑class classification or adding a regression head for sub‑halo properties would broaden applicability. Fourth, the training data span only a single cosmology; transfer learning or domain‑adaptation techniques would be needed to generalize to alternative models (e.g., wCDM, massive neutrinos). Finally, the authors note that hyper‑parameter choices such as the probability threshold and linking length could be optimized jointly in a differentiable framework, potentially enabling gradient‑based cosmological inference.
In summary, the “CNN+FoF” framework demonstrates that deep learning can effectively prune the search space for halo identification, allowing a conventional FoF algorithm to operate on a dramatically reduced set of candidate particles. This hybrid approach retains the high fidelity of phase‑space halo finders while delivering an order‑of‑magnitude speedup, making it well‑suited for modern simulation‑driven inference pipelines, real‑time mock catalog generation, and upcoming large‑scale structure surveys that demand rapid, accurate structure identification.
Comments & Academic Discussion
Loading comments...
Leave a Comment