Limits and Challenges in �Deep Learning Optimizers
Sanghyuk Chun
@NAVER AI Lab
Recap: Gradient Descent Algorithm
GD algorithm, an example.
(optimal solution ≈ -0.21864…)
Recap: How to use GD for deep neural networks (DNNs)?
Recap: Chain rule (“Backpropagation algorithm”) for computing gradients of deep neural networks
Hooray! There are many frameworks supporting automatic gradient computations!
Stochastic Gradient Descent (SGD):�Towards a large-scale optimization
SGD with an adaptive learning rate
SGD with an adaptive learning rate
Deep learning optimization in the wild
ICLR’21
AdamP: Slowing Down the Slowdown for�Momentum Optimizers on Scale-invariant Weights
Byeongho Heo*, Sanghyuk Chun*, Seong Joon Oh, Dongyoon Han,
Sangdoo Yun, Gyuwan Kim, Youngjung Uh, Jung-Woo Ha
Three Secret Recipe of Neural Networks
Three Secret Recipe of Neural Networks
Batch Normalization (BN)
Batch Normalization (BN)
x1
x2
x3
x4
x5
(x1 - μ) / σ
μ and σ are sample-mean and sample-variance of the mini-batch samples
* γ + ß (γ and ß are learnable parameters)
Batch Normalization (BN)
x1
x2
x3
x4
x5
(x1 - μ) / σ
μ and σ are sample-mean and sample-variance of the mini-batch samples
* γ + ß (γ and ß are learnable parameters)
Widely-used “ResNet” block
BN makes scale-invariant parameters
BN makes scale-invariant parameters
BN makes scale-invariant (SI) parameters
BN makes scale-invariant (SI) parameters
Widely-used “ResNet” block
Gradient descent increases norm of SI parameters w
Optimizing SI parameters in Rd space is same as optimizing normalized SI parameters in Rd-1 space
Gradient scale of a normalized, or effective parameter
Proposional to the weight norm || wt+1 ||
Norm increasement adaptively controls the step size
It implies that GD will converge even with an arbitrary large learning rate for scale-invariant parameters!
Arora, Sanjeev, Zhiyuan Li, and Kaifeng Lyu. "Theoretical analysis of auto rate-tuning by batch normalization." ICLR 2019
Key lemmas for auto-tuning theorem
Three Secret Recipe of Neural Networks
Momentum SGD
Momentum SGD makes norm increases much faster
Momentum makes effective step size rapidly decrease
ß = 0.9
ß = 0.95
ß = 0.99
SGDP & AdamP: a simple projection-based solution
In other words, we remove the radial direction of update step to prevent unintended norm increases by momentum optimizers
wt
pt
qt
Three Secret Recipe of Neural Networks
Dark magic for NN optimization: weight decay (WD)
Dark magic for NN optimization: weight decay (WD)
Dark magic for NN optimization: weight decay (WD)
Deep learning optimization needs careful WD tuning
Our projection solution can handle norm increases without careful WD tuning
Our projection solution can handle norm increases without careful WD tuning
Conjecture: Adam momentum more drastically increases norm, AdamP can mitigate this issue
Our projection solution can handle norm increases without careful WD tuning
Real-world experiments: 6 tasks and 14 datasets
Image recognition tasks
ImageNet classification accuracies.
MS-COCO object detection mAP.
Image recognition tasks
ImageNet classification accuracies.
MS-COCO object detection mAP.
Adam now works better than SGD with our solution!
AdamP is not only effective to BN, but also to L2 projection
Image retrieval tasks.
f(x) = f(x) / || f(x) ||
AdamP works well in complex minimax optimization tasks
Standard and attacked accuracies of Wide-ResNet trained on CIFAR-10 with PGD-10 attacks.
AdamP works well in complex minimax optimization tasks
ReBias 9-Class ImageNet experiments.
ReBias Biased-MNIST experiments.
Non-image domain results
Language modeling.
Audio classification tasks.
LM uses layer normalization (LN), not BN
ClovaAI/AdamP: Open source for SGDP / AdamP.
from adamp import AdamP, SGDP
# Usage is exactly same as torch.optim library!
optimizer = AdamP(lr=0.001, betas=(0.9, 0.999), weight_decay=1e-2)�optimizer = SGDP(lr=0.1, weight_decay=1e-5, momentum=0.9, nesterov=True)
pip install adamp
Conclusion of SGDP / AdamP.
Recap: Deep learning optimization in the wild
Recap: Deep learning optimization in the wild
Recap: Deep learning optimization in the wild
Flatness and Sharpness are also matter
ICLR’17. On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima
Flatness and Sharpness are also matter
UAI’18. Averaging Weights Leads to Wider Optima and Better Generalization
Flatness and Domain Generalization
Q&A
Thanks for all co-authors and colleagues.
Many slides are borrowed from Byeongho’s slide.