MoonSay /Tutorials/Machine Learning Interview #9
Contents
  1. 01Introduction
  2. 02Gradient descent
  3. 03The learning rate
  4. 04Batch gradient descent
  5. 05Stochastic gradient descent
  6. 06Mini-batch gradient descent
  7. 07Momentum and Adam
  8. 08Common misconceptions
  9. 09Interview questions and model answers
  10. 10Summary
  11. References
Gradient Descent/Chapter 08 of 10

08Common misconceptions

  • “The gradient points to the minimum.” It points in the steepest local direction. In a narrow valley that is mostly across the valley, which is why gradient descent zigzags (Section 7).
  • “Batch gradient descent is best because its gradient is exact.” Per update, yes; per unit of compute, no. On the running example one epoch leaves batch gradient descent at J=2.923 and SGD at 0.134 (Table 1), as Bottou (2010) argues for large data.
  • “SGD with a constant learning rate converges to the minimum.” It converges to a noise ball whose size is proportional to \eta; reaching the minimum needs a decaying rate (10) (or a growing batch).
  • “A bigger batch is always faster.” Noise falls only like 1/\sqrt b, the hardware saturates, the linear scaling rule breaks down for very large batches, and very large batches can generalize worse (Goyal et al., 2017; Keskar et al., 2017).
  • “Momentum just makes the steps bigger.” It averages gradients: it lengthens steps along consistent directions and damps oscillating ones. Used with plain gradient descent’s learning rate, it can oscillate more, not less.
  • “Adam with L2 regularization is AdamW.” No: in Adam the L2 term is rescaled per parameter; AdamW decays the weights directly (Loshchilov and Hutter, 2019).