  We present a new empirical model for the mass assembly of dark matter halos.
We approximate the growth of individual halos as a simple power-law function of
time, where the power-law index smoothly decreases as the halo transitions from
the fast-accretion regime at early times, to the slow-accretion regime at late
times. Using large samples of halo merger trees taken from high-resolution
cosmological simulations, we demonstrate that our 3-parameter model, Diffmah,
can approximate halo growth with a typical accuracy of 0.1 dex for t > 1 Gyr
for all halos of present-day mass greater than 10^11Msun, including subhalos
and host halos in gravity-only simulations, as well as in the TNG
hydrodynamical simulation. We additionally present a new model for the assembly
of halo populations, DiffmahPop, which not only reproduces average mass growth
across time, but also faithfully captures the diversity with which halos
assemble their mass. Our python implementation is based on the autodiff library
JAX, and so our model self-consistently captures the mean and variance of halo
mass accretion rate across cosmic time. We show that the connection between
halo assembly and the large-scale density field, known as halo assembly bias,
is accurately captured by Diffmah, and that residual errors in our
approximations to halo assembly history exhibit a negligible residual
correlation with the density field. Our publicly available source code can be
used to generate Monte Carlo realizations of cosmologically representative halo
histories; our differentiable implementation facilitates the incorporation of
our model into existing analytical halo model frameworks.
