A scalar parameter starts at and is trained with Adam using learning rate , , and . The first two gradients are and . What are and , and what would the first step have been without bias correction?
Deep learning, Optimisers
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can run Adam by hand and explain why the bias-correction factors are needed.
Key idea
Adam keeps and , both started at , so early values are biased towards zero. Dividing by and fixes this, and the update is .
Steps
- Step 1 moments. and .
- Step 1 correction. and , so .
- Step 1 update. . A first Adam step has size about , whatever the gradient scale.
- Step 2 moments. and .
- Step 2 correction. and , so .
- Step 2 update. . The sign flip in the gradient shrinks the momentum, so the step is small.
- Without correction, step 1 would use , giving an update of , about three times too large, because is biased towards zero much more than .
Common mistakes
- Forgetting that and use with the step number in the exponent, not a fixed .
- Taking and as interchangeable, or dividing by without correcting either one.
- Squaring the gradient incorrectly for : , so the sign does not matter for .
How long your answer should be
About half a page; 4 minutes.
Read this
Previous in Deep learning: How does focal loss modify cross-entropy for extreme class imbalance, where is the predicted probability for the true class and is the focusing parameter? What is the ratio of the loss on a hard example () to an easy example () for versus , and why does this help?
Next in Deep learning: You have implemented backpropagation by hand and want to test it with gradient checking. Why is the central difference preferred to the forward difference, how do you compare it with your analytic gradient, and what goes wrong if is too large or too small? Illustrate with at and ?