  We present Capse.jl, a novel neural network-based emulator designed for rapid
and accurate prediction of Cosmic Microwave Background (CMB) temperature,
polarization, and lensing angular power spectra. The emulator computes
predictions in just a few microseconds with emulation errors below $0.1\sigma$
for all the scales relevant for the upcoming CMB-S4 survey. Capse.jl can also
be trained in an hour's time on a 8-cores CPU. We test Capse.jl on Planck 2018,
ACT DR4, and 2018 SPT-3G data and demonstrate its capability to derive
cosmological constraints comparable to those obtained by traditional methods,
but with a computational efficiency that is three to six orders of magnitude
higher. We take advantage of the differentiability of our emulators to use
gradient-based methods, such as Pathfinder and Hamiltonian Monte Carlo (HMC),
which speed up the convergence and increase sampling efficiency. Together,
these features make Capse.jl a powerful tool for studying the CMB and its
implications for cosmology. When using the fastest combination of our
likelihoods, emulators, and analysis algorithm, we are able to perform a
Plancky TT + TE + EE analysis in less than a second. To ensure full
reproducibility, we provide open access to the codes and data required to
reproduce all the results of this work.
