sgd-based optimization routines