  The next generation of space- and ground-based facilities promise to reveal
an entirely new picture of the gravitational wave sky: thousands of galactic
and extragalactic binary signals, as well as stochastic gravitational wave
backgrounds (SGWBs) of unresolved astrophysical and possibly cosmological
signals. These will need to be disentangled to achieve the scientific goals of
experiments such as LISA, Einstein Telescope, or Cosmic Explorer. We focus on
one particular aspect of this challenge: reconstructing an SGWB from (mock)
LISA data. We demonstrate that simulation-based inference (SBI) - specifically
truncated marginal neural ratio estimation (TMNRE) - is a promising avenue to
overcome some of the technical difficulties and compromises necessary when
applying more traditional methods such as Monte Carlo Markov Chains (MCMC). To
highlight this, we show that we can reproduce results from traditional methods
both for a template-based and agnostic search for an SGWB. Moreover, as a
demonstration of the rich potential of SBI, we consider the injection of a
population of low signal-to-noise ratio supermassive black hole transient
signals into the data. TMNRE can implicitly marginalize over this complicated
parameter space, enabling us to directly and accurately reconstruct the
stochastic (and instrumental noise) contributions. We publicly release our
TMNRE implementation in the form of the code saqqara.
