  Sampling-based inference techniques are central to modern cosmological data
analysis; these methods, however, scale poorly with dimensionality and
typically require approximate or intractable likelihoods. In this paper we
describe how Truncated Marginal Neural Ratio Estimation (TMNRE) (a new approach
in so-called simulation-based inference) naturally evades these issues,
improving the $(i)$ efficiency, $(ii)$ scalability, and $(iii)$ trustworthiness
of the inferred posteriors. Using measurements of the Cosmic Microwave
Background (CMB), we show that TMNRE can achieve converged posteriors using
orders of magnitude fewer simulator calls than conventional Markov Chain Monte
Carlo (MCMC) methods. Remarkably, the required number of samples is effectively
independent of the number of nuisance parameters. In addition, a property
called \emph{local amortization} allows the performance of rigorous statistical
consistency checks that are not accessible to sampling-based methods. TMNRE
promises to become a powerful tool for cosmological data analysis, particularly
in the context of extended cosmologies, where the timescale required for
conventional sampling-based inference methods to converge can greatly exceed
that of simple cosmological models such as $\Lambda$CDM. To perform these
computations, we use an implementation of TMNRE via the open-source code
\texttt{swyft}.
