Optimizers for Deep Learning
创始人
2024-06-01 16:12:10
0

文章目录

  • 一、Some Notations
    • What is Optimization about?
  • 二、SGD
    • SGD with Momentum(SGDM)
    • Why momentum?
  • 三、Adagrad
    • RMSProp
  • 四、Adam
    • SWATS [Keskar, et al., arXiv’17]
    • Towards Improving Adam
    • Towards Improving SGDM
    • RAdam vs SWATS
    • Lookahead [Zhang, et al., arXiv’19]
    • Momentum recap
    • Can we look into the future
  • 五、optimizer
    • L2
    • AdamW & SGDW with momentum
    • Something helps optimization
  • 总结
    • Advices:

一、Some Notations

𝜃𝑡: model parameters at time step 𝑡
• ∇𝐿(𝜃𝑡) or 𝑔𝑡 : gradient at 𝜃𝑡 , used to compute 𝜃𝑡+1
𝑚𝑡+1: momentum accumulated from time step 0 to
time step 𝑡, which is used to compute 𝜃𝑡+1
在这里插入图片描述

What is Optimization about?

Find a 𝜃 to get the lowest σ𝑥 𝐿(𝜃; 𝑥)
Or, Find a 𝜃 to get the lowest 𝐿(𝜃)
在这里插入图片描述

二、SGD

在这里插入图片描述

SGD with Momentum(SGDM)

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Why momentum?

在这里插入图片描述

三、Adagrad

在这里插入图片描述
在这里插入图片描述
What if the gradients at the first few time steps are extremely large…

RMSProp

在这里插入图片描述
在这里插入图片描述
Exponential moving average (EMA) of squared gradients is not monotonically increasing

四、Adam

在这里插入图片描述

Adam vs SGDM
在这里插入图片描述

Adam vs SGDM
在这里插入图片描述

Adam vs SGDM

在这里插入图片描述在这里插入图片描述
Adam:fast training, large generalization gap, unstable
• SGDM:stable, little generalization gap, better convergence(?)
在这里插入图片描述

SWATS [Keskar, et al., arXiv’17]

Begin with Adam(fast), end with SGDM
在这里插入图片描述

Towards Improving Adam

Trouble shooting:
在这里插入图片描述
The “memory” of 𝑣𝑡 keeps roughly 1000 steps!!
In the final stage of training, most gradients are small and non-informative, while some mini-batches provide large informative gradient rarely
在这里插入图片描述

Towards Improving SGDM

Adaptive learning rate algorithms:dynamically adjust learning rate over time
SGD-type algorithms:fix learning rate for all updates… too slow for small learning rates and bad result for large learning rates
Cyclical LR [Smith, WACV’17]
• learning rate:decide by LR range test
• stepsize:several epochs
• avoid local minimum by varying learning rate
在这里插入图片描述
• SGDR [Loshchilov, et al., ICLR’17]
在这里插入图片描述
Adam need warm-up
在这里插入图片描述
Experiments show that the gradient distribution distorted in the first 10 steps
在这里插入图片描述
在这里插入图片描述
Keep your step size small at the beginning of training helps to reduce the variance of the gradients
在这里插入图片描述
RAdam [Liu, et al., ICLR’20]
在这里插入图片描述
1 、effective memory size of EMA

2、max memory size (t → ∞)
3、**加粗样式
**

RAdam vs SWATS

在这里插入图片描述

Lookahead [Zhang, et al., arXiv’19]

在这里插入图片描述

在这里插入图片描述

Momentum recap

在这里插入图片描述

Can we look into the future

Nesterov accelerated gradient (NAG) [Nesterov, jour Dokl. Akad. Nauk SSSR’83]
SGDM:
𝜃𝑡 = 𝜃𝑡−1 − 𝑚𝑡
𝑚𝑡 = 𝜆𝑚𝑡−1 + 𝜂∇𝐿(𝜃𝑡−1)
Look into the future:
𝜃𝑡 = 𝜃𝑡−1 − 𝑚𝑡
𝑚𝑡 = 𝜆𝑚𝑡−1 + 𝜂∇𝐿(𝜃𝑡−1 − 𝜆𝑚𝑡−1)

Nesterov accelerated gradient (NAG):
𝜃𝑡 = 𝜃𝑡−1 − 𝑚𝑡
𝑚𝑡 = 𝜆𝑚𝑡−1 + 𝜂∇𝐿(𝜃𝑡−1 − 𝜆𝑚𝑡−1)
𝐿𝑒𝑡 𝜃𝑡′ = 𝜃𝑡 − 𝜆𝑚𝑡
= 𝜃𝑡−1 − 𝑚𝑡 − 𝜆𝑚𝑡
= 𝜃𝑡−1 − 𝜆𝑚𝑡 − 𝜆𝑚𝑡−1 − 𝜂∇𝐿(𝜃𝑡−1 − 𝜆𝑚𝑡−1)
= 𝜃𝑡−1’ − 𝜆𝑚𝑡 − 𝜂∇𝐿(𝜃𝑡−1′)
𝑚𝑡 = 𝜆𝑚𝑡−1 + 𝜂∇𝐿(𝜃𝑡−1′)
SGDM:

𝜃𝑡 = 𝜃𝑡−1 − 𝑚𝑡
𝑚𝑡 = 𝜆𝑚𝑡−1 + 𝜂∇𝐿(𝜃𝑡−1)
or
𝜃𝑡 = 𝜃𝑡−1 − 𝜆𝑚𝑡−1-𝜂∇𝐿(𝜃𝑡−1)
𝑚𝑡 = 𝜆𝑚𝑡−1 + 𝜂∇𝐿(𝜃𝑡−1)

Nadam [Dozat, ICLR workshop’16]
在这里插入图片描述
在这里插入图片描述

五、optimizer

L2

𝐿𝑙2(𝜃) = 𝐿 𝜃 + 𝛾| θ |2
在这里插入图片描述

AdamW & SGDW with momentum

在这里插入图片描述

Something helps optimization

Normalization
在这里插入图片描述

总结

在这里插入图片描述
在这里插入图片描述

Advices:

在这里插入图片描述

相关内容

热门资讯

喜欢穿一身黑的男生性格(喜欢穿... 今天百科达人给各位分享喜欢穿一身黑的男生性格的知识,其中也会对喜欢穿一身黑衣服的男人人好相处吗进行解...
发春是什么意思(思春和发春是什... 本篇文章极速百科给大家谈谈发春是什么意思,以及思春和发春是什么意思对应的知识点,希望对各位有所帮助,...
网络用语zl是什么意思(zl是... 今天给各位分享网络用语zl是什么意思的知识,其中也会对zl是啥意思是什么网络用语进行解释,如果能碰巧...
为什么酷狗音乐自己唱的歌不能下... 本篇文章极速百科小编给大家谈谈为什么酷狗音乐自己唱的歌不能下载到本地?,以及为什么酷狗下载的歌曲不是...
华为下载未安装的文件去哪找(华... 今天百科达人给各位分享华为下载未安装的文件去哪找的知识,其中也会对华为下载未安装的文件去哪找到进行解...
怎么往应用助手里添加应用(应用... 今天百科达人给各位分享怎么往应用助手里添加应用的知识,其中也会对应用助手怎么添加微信进行解释,如果能...
家里可以做假山养金鱼吗(假山能... 今天百科达人给各位分享家里可以做假山养金鱼吗的知识,其中也会对假山能放鱼缸里吗进行解释,如果能碰巧解...
一帆风顺二龙腾飞三阳开泰祝福语... 本篇文章极速百科给大家谈谈一帆风顺二龙腾飞三阳开泰祝福语,以及一帆风顺二龙腾飞三阳开泰祝福语结婚对应...
四分五裂是什么生肖什么动物(四... 本篇文章极速百科小编给大家谈谈四分五裂是什么生肖什么动物,以及四分五裂打一生肖是什么对应的知识点,希...
美团联名卡审核成功待激活(美团... 今天百科达人给各位分享美团联名卡审核成功待激活的知识,其中也会对美团联名卡审核未通过进行解释,如果能...