  When a physical system is driven away from equilibrium, the statistical
distribution of its dynamical trajectories informs many of its physical
properties. Characterizing the nature of the distribution of dynamical
observables, such as a current or entropy production rate, has become a central
problem in nonequilibrium statistical mechanics. Asymptotically, for a broad
class of observables, the distribution of a given observable satisfies a large
deviation principle when the dynamics is Markovian, meaning that fluctuations
can be characterized in the long-time limit by computing a scaled cumulant
generating function. Calculating this function is not tractable analytically
(nor often numerically) for complex, interacting systems, so the development of
robust numerical techniques to carry out this computation is needed to probe
the properties of nonequilibrium materials. Here, we describe an algorithm that
recasts this task as an optimal control problem that can be solved
variationally. We solve for optimal control forces using neural network
ans\"atze that are tailored to the physical systems to which the forces are
applied. We demonstrate that this approach leads to transferable and accurate
solutions in two systems featuring large numbers of interacting particles.
