STORM: Foundations of End-to-End Empirical Risk Minimization on the Edge