How to make your optimizer generalize better