Scalable learning of macroscopic stochastic dynamics