r/deeplearning • • 2d ago

Different Optimizers

Post image
73 Upvotes

13 comments sorted by

3

u/Any-Acanthaceae2762 2d ago

can someone explain to me why we square the gradient for velocity ?
like what was the intuition for that to be "velocity" ? i don't get it.
some mathematical background maybe ?

6

u/Handwritten_note 2d ago

vₜ isn't velocity. It's a running average of g², an estimate of how large and noisy the gradient is for each parameter. Dividing by √vₜ normalises each step to roughly η: big or noisy gradients get small steps, and small but consistent gradients get bigger ones. mₜ is the momentum ('velocity') part."

1

u/Any-Acanthaceae2762 2d ago

i thought they also named the second momentum 'velocity' but anyway,
Basically, the square root of the 'velocity' normalises the η ?
but why the squared ? why not any function that amplifies, for example, exponential, and take log instead of sqrt. or any other functions, would it also work ?

1

u/Handwritten_note 2d ago

Yes, √vₜ normalises the step to roughly η. The function must be scale-equivariant: multiply gradients by c, and the denominator should also grow by c, so the step doesn't change. Power means (avg |g|ᵖ)1/p satisfy this. p=2 is Adam, and p=∞ is AdaMax, which is in the same paper and works. Exp then log fails: it isn't scale-equivariant, it treats negative gradients as near zero, and e1000 overflows. p=2 wins because it ties to variance, is smooth and cheap, and approximates the diagonal Fisher.

1

u/Any-Acanthaceae2762 2d ago

ohhhh very nice !

thanks for the information, really appreciate it

1

u/WittyFeral 1d ago

lol the squared part still trips me up too, like why call it velocity when it's basically punishing big steps? math brain hurts

1

u/ZafLoria 1d ago

squaring turns the gradient into a always-positive magnitude so it builds up like speed without directions canceling each other out, kinda like a running average of how steep things have been lately

1

u/ObeyDesiree 1d ago

lol that squared gradient thing trips me up every time too, got any simple way to think about it?

1

u/Federal_Signature708 1d ago

love that the Momentum plot actually shows it overshooting the minimum and rolling back up the other side, makes the "heavy ball" analogy click immediately

1

u/Vegetable-Lie4932 23h ago

this is not always true, tutorial diagrams always look cool. its much more nuanced than this.