Conditional variational autoencoders for cosmological model discrimination and anomaly detection in cosmic microwave background power spectra
The cosmic microwave background power spectra are a primary window into the early universe. However, achieving interpretable compression and fast inference diagnostics 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 retaining an interface to likelihood-style diagnostic tests. The model achieves high directional reconstruction fidelity for the $D_\ell^{TT}$, $D_\ell^{EE}$, and $D_\ell^{TE}$ spectra in just 5 latent dimensions. It reconstructs spectra for several beyond-$Λ$CDM test cases, including controlled parameter extrapolations, and enables an amortized surrogate diagnostic that reduces one representative post-training MCMC run from $\sim$40 hours on CPU cores to $\sim$2 minutes on a GPU in this demonstration. The learned latent space shows a distributed, partially structured organization that mirrors known cosmological parameters and their degeneracies. It also provides representation-space discrimination diagnostics for distinguishing tested cosmological spectra from a fiducial reference. Overall, this physics-informed CVAE supports interpretable compression, rapid diagnostic exploration, and anomaly-sensitive representation learning beyond $Λ$CDM.