Conditional variational autoencoders for cosmological model discrimination and anomaly detection in cosmic microwave background power spectra
Abstract
The cosmic microwave background power spectra are a primary window into the early universe. However, achieving interpretable, likelihood-compatible compression and fast inference under weak model assumptions remains challenging. We propose a parameter-conditioned variational autoencoder (CVAE) that aligns a data-driven latent representation with cosmological parameters while remaining compatible with standard likelihood analyses. The model achieves high-fidelity compression of the $D_\ell^{TT}$, $D_\ell^{EE}$, and $D_\ell^{TE}$ spectra into just 5 latent dimensions, with reconstruction accuracy exceeding $99.9\%$ within Planck uncertainties. It reliably reconstructs spectra for beyond-$\Lambda$CDM scenarios, even under parameter extrapolation, and enables rapid inference, reducing the computation time from $\sim$40 hours to $\sim$2 minutes while maintaining posterior consistency. The learned latent space demonstrates a physically meaningful structure, capturing a distributed representation that mirrors known cosmological parameters and their degeneracies. Moreover, it supports highly effective unsupervised discrimination among cosmological models, achieving performance competitive with supervised approaches. Overall, this physics-informed CVAE enables anomaly detection beyond $\Lambda$CDM and points to physically meaningful directions for refinement.