SlideShare a Scribd company logo
The Machinery behind Deep Learning
Stefan Kühn
Join me on XING
Minds Mastering Machines - Cologne - April 26th, 2018
Stefan Kühn (XING) Deep Optimization 26.04.2018 1 / 35
Contents
1 Training Deep Networks
2 Training and Learning
3 The Toolbox of Optimization Methods
4 Takeaways
Stefan Kühn (XING) Deep Optimization 26.04.2018 2 / 35
1 Training Deep Networks
2 Training and Learning
3 The Toolbox of Optimization Methods
4 Takeaways
Stefan Kühn (XING) Deep Optimization 26.04.2018 3 / 35
Deep Learning
Neural Networks - Universal Approximation Theorem
1-hidden-layer feed-forward neural net with finite number of parameters can
approximate any continuous function on compact subsets of Rn
Questions:
Why do we need deep learning at all?
theoretic result, requires wide nets
approximation by piecewise constant functions (not what you might
want for classification/regression)
deep nets can replicate capacity of wide shallow nets with performance
and stability improvements
Why are deep nets harder to train than shallow nets?
More parameters to be learned by training?
More hyperparameters to be set before training?
Numerical issues?
disclaimer — ideas stolen from Martens, Sutskever, Bengio et al. and many more —
Stefan Kühn (XING) Deep Optimization 26.04.2018 4 / 35
Example: RNNs
Recurrent Neural Nets
Extremely powerful for modeling sequential data, e.g. time series but
extremely hard to train (somewhat less hard for LSTMs/GRUs)
Main Advantages:
Qualitatively: Flexible and rich model class
Practically: Gradients easily computed by Backpropagation (BPTT)
Main Problems:
Qualitatively: Learning long-term dependencies
Practically: Gradient-based methods struggle when separation between
input and target output is large
Stefan Kühn (XING) Deep Optimization 26.04.2018 5 / 35
Example: RNNs
Recurrent Neural Nets
Highly volatile relationship between parameters and hidden states
Indicators
Vanishing/exploding gradients
Internal Covariate Shift
Remedies
ReLU
’Careful’ initialization
Small stepsizes
(Recurrent) Batch Normalization
Stefan Kühn (XING) Deep Optimization 26.04.2018 6 / 35
Example: RNNs
Recurrent Neural Nets and LSTM
Schmidhuber/Hochreiter proposed change of RNN architecture by adding
Long Short-Term Memory Units
Vanishing/exploding gradients?
fixed linear dynamics, no longer problematic
Any questions open?
Gradient-based trainings works better with LSTMs
LSTMs can compensate one deficiency of Gradient-based learning but
is this the only one?
Most problems are related to specific numerical issues.
Stefan Kühn (XING) Deep Optimization 26.04.2018 7 / 35
1 Training Deep Networks
2 Training and Learning
3 The Toolbox of Optimization Methods
4 Takeaways
Stefan Kühn (XING) Deep Optimization 26.04.2018 8 / 35
Notions of Optimality
Mathematical Optimization
Minimize a given loss function by a certain optimization method or strategy
until convergence.
Vidal et al, Mathematics of Deep Learning
Stefan Kühn (XING) Deep Optimization 26.04.2018 9 / 35
Notions of Optimality
Mathematical Optimization
Minimize a given loss function by a certain optimization method or strategy
until convergence.
Local Optimum: Minimum in local neighborhood (global minimum
might not even exist)
Global Optimum: Point with lowest function value (if existing)
Critical points: Candidates for local/global optima, or saddle points
Iterative Minimization: Step-by-step approach to find minima
Descent direction: Direction in which the function value decreases at
least for a small steps
Gradient: For differentiable functions the negative gradient always is a
descent direction and it vanishes at critical points
Stefan Kühn (XING) Deep Optimization 26.04.2018 10 / 35
Optimality and Deep Neural Nets
Some surprisingly strong theoretical results for this nonlinear+nonconvex
optimization problem - and practical evidence as well!
Saddle points: In high-dimensional convex problem critical points are
saddle points -> could not be observed for Deep Nets
Local and global optimal: Deep Nets seem to have the property that
local optima are located near the global optimum
Optimal representation: Deep Nets can represent data optimally under
certain conditions (minimal sufficient statistic)
Information Theory: Deep Nets and entropy are becoming best friend,
strong relations to optimal control theory (Optimization in infinite
dimensions)
Global optimality for positively homogeneous networks:
self-explanatory
Stefan Kühn (XING) Deep Optimization 26.04.2018 11 / 35
Notions of Error
Decomposition of the Error
Even the best possible prediction - the optimal prediction via the so-called
Bayes predictor - comes with an error.
Error Components
Bayes Error: Theoretically optimal error
Approximation Error: Error introduced by the model class
Estimation Error: Error introduced by parameter estimation / model
training / optimization method
Stefan Kühn (XING) Deep Optimization 26.04.2018 12 / 35
Notions of Error
Example
Bayes Error: Even the optimal predictor for house prices using only zip
codes makes an error -> Property of the data / features
Approximation Error: Linear Models cannot resolve non-linear
relationships between the features irrespective of the training method
(but possibly could with different features, like e.g. polynomial
regression)
Estimation Error: Did we select the right model from the model class
based on the available data? -> depends on model class, data and
training / optimization method
But what about the Generalization Error?
Stefan Kühn (XING) Deep Optimization 26.04.2018 13 / 35
Notions of Learning
Learning
A core objective of a learner is to generalize from its experience.
But why do we use Mathematical Optimization for Learning?
What would be an alternative? Biology?
Stefan Kühn (XING) Deep Optimization 26.04.2018 14 / 35
Trade-offs between Optimization and Learning
Computational complexity becomes the limiting factor when one envisions
large amounts of training data. [Bouttou, Bousquet]
Underlying Idea
Approximate optimization algorithms might be sufficient for learning
purposes. [Bouttou, Bousquet]
Implications:
Small-scale: Trade-off between approximation error and estimation
error
Large-scale: Computational complexity dominates
Long story short:
The best optimization methods might not be the best learning
methods!
Stefan Kühn (XING) Deep Optimization 26.04.2018 15 / 35
Empirical results
Empirical evidence for SGD being a better learner than optimizer.
RCV1, text classification, see e.g. Bouttou, Stochastic Gradient Descent Tricks
Stefan Kühn (XING) Deep Optimization 26.04.2018 16 / 35
1 Training Deep Networks
2 Training and Learning
3 The Toolbox of Optimization Methods
4 Takeaways
Stefan Kühn (XING) Deep Optimization 26.04.2018 17 / 35
Advanced Concepts in Mathematical Optimization
Stepsize rules: Dynamically adjust step lengths to speed up
convergence
Preconditioning: Helps with ill-conditioned problems -> pathological
curvature
Damping: A strategy for making ill-posed problem regular -> helps
making local methods (Newton) work globally
Trust region: Determine step length - or radius of trust - first and then
look for good/best descent directions
Relaxation: Relax constraints for better tractability
Combine simple and complex methods: Levenberg-Marquardt
algorithm, combines Gradient Descent and Newton’s method (ensures
global convergence plus fast local convergence)
Stefan Kühn (XING) Deep Optimization 26.04.2018 18 / 35
Gradient Descent
Minimize a given objective function f :
min f (x), x ∈ Rn
Direction of Steepest Descent, the negative gradient:
d = − f (x)
Update in step k
xk+1 = xk − α f (xk)
Properties:
always a descent direction, no test needed
locally optimal, globally convergent
works with inexact line search, e.g. Armijo’s rule
Stefan Kühn (XING) Deep Optimization 26.04.2018 19 / 35
Stochastic Gradient Descent
Setting
x model parameters
f (x) :=
i
fi (x), loss function is sum of individual losses
f (x) :=
i
fi (x), i = 1, . . . , m number of training examples
Choose i and update in step k
xk+1 = xk − α fi (xk)
Stefan Kühn (XING) Deep Optimization 26.04.2018 20 / 35
Shortcomings of Gradient Descent
local: only local information used
especially: no curvature information used
greedy: prefers high curvature directions
scale invariant: no
James Martens, Deep learning via Hessian-free optimization
Stefan Kühn (XING) Deep Optimization 26.04.2018 21 / 35
Momentum
Update in step k
zk+1 = βzk + f (xk)
xk+1 = xk − αzk+1
Properties for a quadratic convex objective:
condition number κ of improves by square root
stepsizes can be twice as long
order of convergence
√
κ − 1
√
κ + 1
instead of
κ − 1
κ + 1
can diverge, if β is not properly chosen/adapted
Gabriel Goh, Why momentum really works
Stefan Kühn (XING) Deep Optimization 26.04.2018 22 / 35
Momentum
D E M O
https://distill.pub/2017/momentum/
Stefan Kühn (XING) Deep Optimization 26.04.2018 23 / 35
Adam
Properties:
combines several clever tricks (from Momentum, RMSprop, AdaGrad)
has some similarities to Trust Region methods
empirically proven - best in class (personal opinion)
Kingma, Ba Adam: A method for stochastic optimization
Stefan Kühn (XING) Deep Optimization 26.04.2018 24 / 35
SGD, Momentum and more
D E M O
Visualization of algorithms - by Sebastian Ruder
Stefan Kühn (XING) Deep Optimization 26.04.2018 25 / 35
Beyond Adam
Adam has problems (and it’s not Eve)
Parameters are coupled
Some results indicate that Adam has not the best generalization
properties
It’s a heuristic -> convergence guarantuee?
And Adam has friends!
New variants that decouple parameters
Combine Adam - better at early training stages - and SGD - better
generalization properties
This also helps with convergence!
Wilson et al The Marginal Value of Adaptive Gradient Methods in Machine Learning
Keskar, Socher Improving Generalization Performance by Switching from Adam to SGD
Stefan Kühn (XING) Deep Optimization 26.04.2018 26 / 35
Higher-Order Methods
Second-Order Methods
Require existence of Hessian and use this for scaling gradients accordingly,
very successful but computationally expensive
Classical Newton Method: fast local convergence, no global
convergence
Relaxed Newton Methods: help with global convergence
Damped Newton Methods: help with global convergence
Modified Newton Methods: help with computational complexity
Quasi-Newton Methods: help with computational complexity
Nonlinear Conjugate Gradient Methods: iteratively build approximation
to Hessian
But there is a lot more to explore, e.g. the basin-hopping algorithm - a strategy for finding global optima - or
derivative-free methods like Nelder-Mead (downhill simplex), Particle Swarm Optimization (PSO and its variants)
Stefan Kühn (XING) Deep Optimization 26.04.2018 27 / 35
L-BFGS and Nonlinear CG
Observations so far:
The better the method, the more parameters to tune.
All better methods try to incorporate curvature information.
Why not doing so directly?
L-BFGS
Quasi-Newton method, builds an approximation of the (inverse) Hessian
and scales gradient accordingly.
Nonlinear CG
Informally speaking, Nonlinear CG tries to solve a quadratic approximation
of the function.
No surprise: They also work with minibatches.
Stefan Kühn (XING) Deep Optimization 26.04.2018 28 / 35
Empirical results
Empirical evidence for better optimizers being better learners.
MNIST, handwritten digit recognition, from Ng et al., On Optimization Methods for Deep Learning
Stefan Kühn (XING) Deep Optimization 26.04.2018 29 / 35
Truncated Newton: Hessian-Free Optimization
Main ideas:
Approximate not Hessian H, but matrix-vector product Hd.
Use finite differences instead of exact Hessian.
Use damping.
Use Linear CG method for solving quadratic approximation.
Use clever mini-batch stragegy for large data-sets.
Stefan Kühn (XING) Deep Optimization 26.04.2018 30 / 35
Empirical test on pathological problems
Main results:
The addition problem is known to be effectively impossible for
gradient descent, HF did it.
Basic RNN cells are used, no specialized architectures (LSTMs etc.).
(Martens/Sutskever (2011), Hochreiter/Schmidhuber, (1997)
Stefan Kühn (XING) Deep Optimization 26.04.2018 31 / 35
1 Training Deep Networks
2 Training and Learning
3 The Toolbox of Optimization Methods
4 Takeaways
Stefan Kühn (XING) Deep Optimization 26.04.2018 32 / 35
Summary
In the long run, the biggest bottleneck will be the sequential parts of an
algorithm. That’s why the number of iterations needs to be small. SGD and
its successors tend to have much more iterations, and they cannot benefit
as much from higher parallelism (GPUs).
But whatever you do/prefer/choose:
At least try out successors of SGD: Momentum, Adam etc.
Look for generic approaches instead of more and more specialized and
manually finetuned solutions.
Key aspects:
Initialization
Adaptive choice of stepsizes/momentum/. . .
Scaling of the gradient
Stefan Kühn (XING) Deep Optimization 26.04.2018 33 / 35
Resources
Overview of Gradient Descent methods
Why momentum really works
Adam - A Method for Stochastic Optimization
Mathematics of Deep Learning
The Marginal Value of Adaptive Gradient Methods in Machine
Learning
Andrew Ng et al. about L-BFGS and CG outperforming SGD
Lecture Slides Neural Networks for Machine Learning - Hinton et al.
On the importance of initialization and momentum in deep learning
Data-Science-Blog: Summary article in preparation (Stefan Kühn)
The Neural Network Zoo
Stefan Kühn (XING) Deep Optimization 26.04.2018 34 / 35
Thank you!
Stefan Kühn (XING) Deep Optimization 26.04.2018 35 / 35

More Related Content

PDF
Deep Learning and Optimization Methods
PDF
A HYBRID CLUSTERING ALGORITHM FOR DATA MINING
PDF
IEEE P2P 2013 - Bootstrapping Skynet: Calibration and Autonomic Self-Control ...
PPT
November, 2006 CCKM'06 1
PPTX
K Nearest Neighbor Algorithm
PPT
The Pyramid Match Kernel: Discriminative Classification with Sets of Image Fe...
PPTX
Fast AutoAugment
PPT
3.2 partitioning methods
Deep Learning and Optimization Methods
A HYBRID CLUSTERING ALGORITHM FOR DATA MINING
IEEE P2P 2013 - Bootstrapping Skynet: Calibration and Autonomic Self-Control ...
November, 2006 CCKM'06 1
K Nearest Neighbor Algorithm
The Pyramid Match Kernel: Discriminative Classification with Sets of Image Fe...
Fast AutoAugment
3.2 partitioning methods

What's hot (20)

PDF
Dimensionality Reduction
PPTX
Selection K in K-means Clustering
PDF
The Gaussian Process Latent Variable Model (GPLVM)
PDF
New Approach for K-mean and K-medoids Algorithm
PPTX
An Introduction to Reinforcement Learning - The Doors to AGI
PPT
Facial keypoint recognition
PPTX
Knn Algorithm presentation
DOCX
K means report
PPSX
Ds03 algorithms jyoti lakhani
PDF
Big data Clustering Algorithms And Strategies
PPTX
K Nearest Neighbor V1.0 Supervised Machine Learning Algorithm
PPTX
Types of clustering and different types of clustering algorithms
PPTX
Ironwood4_Tuesday_Medasani_1PM
PPTX
Machine learning clustering
PPTX
Introduction to Clustering algorithm
PPT
Shai Avidan's Support vector tracking and ensemble tracking
PPTX
Problem Formulation in Artificial Inteligence Projects
PPTX
InfoGAN: Interpretable Representation Learning by Information Maximizing Gene...
PDF
Dynamic approach to k means clustering algorithm-2
Dimensionality Reduction
Selection K in K-means Clustering
The Gaussian Process Latent Variable Model (GPLVM)
New Approach for K-mean and K-medoids Algorithm
An Introduction to Reinforcement Learning - The Doors to AGI
Facial keypoint recognition
Knn Algorithm presentation
K means report
Ds03 algorithms jyoti lakhani
Big data Clustering Algorithms And Strategies
K Nearest Neighbor V1.0 Supervised Machine Learning Algorithm
Types of clustering and different types of clustering algorithms
Ironwood4_Tuesday_Medasani_1PM
Machine learning clustering
Introduction to Clustering algorithm
Shai Avidan's Support vector tracking and ensemble tracking
Problem Formulation in Artificial Inteligence Projects
InfoGAN: Interpretable Representation Learning by Information Maximizing Gene...
Dynamic approach to k means clustering algorithm-2
Ad

Similar to The Machinery behind Deep Learning (20)

PDF
lecture3.pdf
PDF
DNN_M3_Optimization.pdf
PDF
Chap 8. Optimization for training deep models
PPTX
Techniques in Deep Learning
PPTX
1. Introduction to deep learning.pptx
PPTX
Introduction to deep Learning Fundamentals
PPTX
1. Introduction to deep learning.pptx
PDF
Optimization in deep learning
PPTX
Deep learning
PPTX
Deep learning.pptxst8itsstitissitdyiitsistitsitd
PDF
"A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep...
PDF
Theoretical Deep Learning
PDF
Stochastic optimization from mirror descent to recent algorithms
PDF
04 numerical
PDF
Training Neural Networks
PDF
Methods of Optimization in Machine Learning
PDF
Dep Neural Networks introduction new.pdf
PPTX
Deep Neural Network Module 3A Optimization.pptx
ODP
Machine learning 2016: deep networks and Monte Carlo Tree Search
ODP
Machine learning 2016: deep networks and Monte Carlo Tree Search
lecture3.pdf
DNN_M3_Optimization.pdf
Chap 8. Optimization for training deep models
Techniques in Deep Learning
1. Introduction to deep learning.pptx
Introduction to deep Learning Fundamentals
1. Introduction to deep learning.pptx
Optimization in deep learning
Deep learning
Deep learning.pptxst8itsstitissitdyiitsistitsitd
"A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep...
Theoretical Deep Learning
Stochastic optimization from mirror descent to recent algorithms
04 numerical
Training Neural Networks
Methods of Optimization in Machine Learning
Dep Neural Networks introduction new.pdf
Deep Neural Network Module 3A Optimization.pptx
Machine learning 2016: deep networks and Monte Carlo Tree Search
Machine learning 2016: deep networks and Monte Carlo Tree Search
Ad

More from Stefan Kühn (15)

PDF
data2day2023_SKuehn_DataPlatformFallacy.pdf
PDF
data2day2022_SKuehn_DataValueChain.pdf
PDF
Talk at MCubed London about Manifold Learning and Applications
PDF
Data Science - Cargo Cult - Organizational Change
PDF
Interactive Dashboards with R
PDF
Talk at PyData Berlin about Manifold Learning and Applications
PDF
Bridging the gap
PDF
Manifold Learning and Data Visualization
PDF
Becoming Data-driven - Machine Learning @ XING Marketing Solutions
PDF
Learning To Rank data2day 2017
PDF
Visualizing and Communicating High-dimensional Data
PDF
Data quality - The True Big Data Challenge
PDF
Data Visualization at codetalks 2016
PDF
SKuehn_MachineLearningAndOptimization_2015
PDF
SKuehn_Talk_FootballAnalytics_data2day2015
data2day2023_SKuehn_DataPlatformFallacy.pdf
data2day2022_SKuehn_DataValueChain.pdf
Talk at MCubed London about Manifold Learning and Applications
Data Science - Cargo Cult - Organizational Change
Interactive Dashboards with R
Talk at PyData Berlin about Manifold Learning and Applications
Bridging the gap
Manifold Learning and Data Visualization
Becoming Data-driven - Machine Learning @ XING Marketing Solutions
Learning To Rank data2day 2017
Visualizing and Communicating High-dimensional Data
Data quality - The True Big Data Challenge
Data Visualization at codetalks 2016
SKuehn_MachineLearningAndOptimization_2015
SKuehn_Talk_FootballAnalytics_data2day2015

Recently uploaded (20)

PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
Fluorescence-microscope_Botany_detailed content
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PDF
.pdf is not working space design for the following data for the following dat...
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PDF
Mega Projects Data Mega Projects Data
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
PPT
Quality review (1)_presentation of this 21
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPTX
Database Infoormation System (DBIS).pptx
Reliability_Chapter_ presentation 1221.5784
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Fluorescence-microscope_Botany_detailed content
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
.pdf is not working space design for the following data for the following dat...
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
Galatica Smart Energy Infrastructure Startup Pitch Deck
Business Ppt On Nestle.pptx huunnnhhgfvu
IBA_Chapter_11_Slides_Final_Accessible.pptx
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Mega Projects Data Mega Projects Data
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
Quality review (1)_presentation of this 21
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
IB Computer Science - Internal Assessment.pptx
Acceptance and paychological effects of mandatory extra coach I classes.pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
Database Infoormation System (DBIS).pptx

The Machinery behind Deep Learning

  • 1. The Machinery behind Deep Learning Stefan Kühn Join me on XING Minds Mastering Machines - Cologne - April 26th, 2018 Stefan Kühn (XING) Deep Optimization 26.04.2018 1 / 35
  • 2. Contents 1 Training Deep Networks 2 Training and Learning 3 The Toolbox of Optimization Methods 4 Takeaways Stefan Kühn (XING) Deep Optimization 26.04.2018 2 / 35
  • 3. 1 Training Deep Networks 2 Training and Learning 3 The Toolbox of Optimization Methods 4 Takeaways Stefan Kühn (XING) Deep Optimization 26.04.2018 3 / 35
  • 4. Deep Learning Neural Networks - Universal Approximation Theorem 1-hidden-layer feed-forward neural net with finite number of parameters can approximate any continuous function on compact subsets of Rn Questions: Why do we need deep learning at all? theoretic result, requires wide nets approximation by piecewise constant functions (not what you might want for classification/regression) deep nets can replicate capacity of wide shallow nets with performance and stability improvements Why are deep nets harder to train than shallow nets? More parameters to be learned by training? More hyperparameters to be set before training? Numerical issues? disclaimer — ideas stolen from Martens, Sutskever, Bengio et al. and many more — Stefan Kühn (XING) Deep Optimization 26.04.2018 4 / 35
  • 5. Example: RNNs Recurrent Neural Nets Extremely powerful for modeling sequential data, e.g. time series but extremely hard to train (somewhat less hard for LSTMs/GRUs) Main Advantages: Qualitatively: Flexible and rich model class Practically: Gradients easily computed by Backpropagation (BPTT) Main Problems: Qualitatively: Learning long-term dependencies Practically: Gradient-based methods struggle when separation between input and target output is large Stefan Kühn (XING) Deep Optimization 26.04.2018 5 / 35
  • 6. Example: RNNs Recurrent Neural Nets Highly volatile relationship between parameters and hidden states Indicators Vanishing/exploding gradients Internal Covariate Shift Remedies ReLU ’Careful’ initialization Small stepsizes (Recurrent) Batch Normalization Stefan Kühn (XING) Deep Optimization 26.04.2018 6 / 35
  • 7. Example: RNNs Recurrent Neural Nets and LSTM Schmidhuber/Hochreiter proposed change of RNN architecture by adding Long Short-Term Memory Units Vanishing/exploding gradients? fixed linear dynamics, no longer problematic Any questions open? Gradient-based trainings works better with LSTMs LSTMs can compensate one deficiency of Gradient-based learning but is this the only one? Most problems are related to specific numerical issues. Stefan Kühn (XING) Deep Optimization 26.04.2018 7 / 35
  • 8. 1 Training Deep Networks 2 Training and Learning 3 The Toolbox of Optimization Methods 4 Takeaways Stefan Kühn (XING) Deep Optimization 26.04.2018 8 / 35
  • 9. Notions of Optimality Mathematical Optimization Minimize a given loss function by a certain optimization method or strategy until convergence. Vidal et al, Mathematics of Deep Learning Stefan Kühn (XING) Deep Optimization 26.04.2018 9 / 35
  • 10. Notions of Optimality Mathematical Optimization Minimize a given loss function by a certain optimization method or strategy until convergence. Local Optimum: Minimum in local neighborhood (global minimum might not even exist) Global Optimum: Point with lowest function value (if existing) Critical points: Candidates for local/global optima, or saddle points Iterative Minimization: Step-by-step approach to find minima Descent direction: Direction in which the function value decreases at least for a small steps Gradient: For differentiable functions the negative gradient always is a descent direction and it vanishes at critical points Stefan Kühn (XING) Deep Optimization 26.04.2018 10 / 35
  • 11. Optimality and Deep Neural Nets Some surprisingly strong theoretical results for this nonlinear+nonconvex optimization problem - and practical evidence as well! Saddle points: In high-dimensional convex problem critical points are saddle points -> could not be observed for Deep Nets Local and global optimal: Deep Nets seem to have the property that local optima are located near the global optimum Optimal representation: Deep Nets can represent data optimally under certain conditions (minimal sufficient statistic) Information Theory: Deep Nets and entropy are becoming best friend, strong relations to optimal control theory (Optimization in infinite dimensions) Global optimality for positively homogeneous networks: self-explanatory Stefan Kühn (XING) Deep Optimization 26.04.2018 11 / 35
  • 12. Notions of Error Decomposition of the Error Even the best possible prediction - the optimal prediction via the so-called Bayes predictor - comes with an error. Error Components Bayes Error: Theoretically optimal error Approximation Error: Error introduced by the model class Estimation Error: Error introduced by parameter estimation / model training / optimization method Stefan Kühn (XING) Deep Optimization 26.04.2018 12 / 35
  • 13. Notions of Error Example Bayes Error: Even the optimal predictor for house prices using only zip codes makes an error -> Property of the data / features Approximation Error: Linear Models cannot resolve non-linear relationships between the features irrespective of the training method (but possibly could with different features, like e.g. polynomial regression) Estimation Error: Did we select the right model from the model class based on the available data? -> depends on model class, data and training / optimization method But what about the Generalization Error? Stefan Kühn (XING) Deep Optimization 26.04.2018 13 / 35
  • 14. Notions of Learning Learning A core objective of a learner is to generalize from its experience. But why do we use Mathematical Optimization for Learning? What would be an alternative? Biology? Stefan Kühn (XING) Deep Optimization 26.04.2018 14 / 35
  • 15. Trade-offs between Optimization and Learning Computational complexity becomes the limiting factor when one envisions large amounts of training data. [Bouttou, Bousquet] Underlying Idea Approximate optimization algorithms might be sufficient for learning purposes. [Bouttou, Bousquet] Implications: Small-scale: Trade-off between approximation error and estimation error Large-scale: Computational complexity dominates Long story short: The best optimization methods might not be the best learning methods! Stefan Kühn (XING) Deep Optimization 26.04.2018 15 / 35
  • 16. Empirical results Empirical evidence for SGD being a better learner than optimizer. RCV1, text classification, see e.g. Bouttou, Stochastic Gradient Descent Tricks Stefan Kühn (XING) Deep Optimization 26.04.2018 16 / 35
  • 17. 1 Training Deep Networks 2 Training and Learning 3 The Toolbox of Optimization Methods 4 Takeaways Stefan Kühn (XING) Deep Optimization 26.04.2018 17 / 35
  • 18. Advanced Concepts in Mathematical Optimization Stepsize rules: Dynamically adjust step lengths to speed up convergence Preconditioning: Helps with ill-conditioned problems -> pathological curvature Damping: A strategy for making ill-posed problem regular -> helps making local methods (Newton) work globally Trust region: Determine step length - or radius of trust - first and then look for good/best descent directions Relaxation: Relax constraints for better tractability Combine simple and complex methods: Levenberg-Marquardt algorithm, combines Gradient Descent and Newton’s method (ensures global convergence plus fast local convergence) Stefan Kühn (XING) Deep Optimization 26.04.2018 18 / 35
  • 19. Gradient Descent Minimize a given objective function f : min f (x), x ∈ Rn Direction of Steepest Descent, the negative gradient: d = − f (x) Update in step k xk+1 = xk − α f (xk) Properties: always a descent direction, no test needed locally optimal, globally convergent works with inexact line search, e.g. Armijo’s rule Stefan Kühn (XING) Deep Optimization 26.04.2018 19 / 35
  • 20. Stochastic Gradient Descent Setting x model parameters f (x) := i fi (x), loss function is sum of individual losses f (x) := i fi (x), i = 1, . . . , m number of training examples Choose i and update in step k xk+1 = xk − α fi (xk) Stefan Kühn (XING) Deep Optimization 26.04.2018 20 / 35
  • 21. Shortcomings of Gradient Descent local: only local information used especially: no curvature information used greedy: prefers high curvature directions scale invariant: no James Martens, Deep learning via Hessian-free optimization Stefan Kühn (XING) Deep Optimization 26.04.2018 21 / 35
  • 22. Momentum Update in step k zk+1 = βzk + f (xk) xk+1 = xk − αzk+1 Properties for a quadratic convex objective: condition number κ of improves by square root stepsizes can be twice as long order of convergence √ κ − 1 √ κ + 1 instead of κ − 1 κ + 1 can diverge, if β is not properly chosen/adapted Gabriel Goh, Why momentum really works Stefan Kühn (XING) Deep Optimization 26.04.2018 22 / 35
  • 23. Momentum D E M O https://distill.pub/2017/momentum/ Stefan Kühn (XING) Deep Optimization 26.04.2018 23 / 35
  • 24. Adam Properties: combines several clever tricks (from Momentum, RMSprop, AdaGrad) has some similarities to Trust Region methods empirically proven - best in class (personal opinion) Kingma, Ba Adam: A method for stochastic optimization Stefan Kühn (XING) Deep Optimization 26.04.2018 24 / 35
  • 25. SGD, Momentum and more D E M O Visualization of algorithms - by Sebastian Ruder Stefan Kühn (XING) Deep Optimization 26.04.2018 25 / 35
  • 26. Beyond Adam Adam has problems (and it’s not Eve) Parameters are coupled Some results indicate that Adam has not the best generalization properties It’s a heuristic -> convergence guarantuee? And Adam has friends! New variants that decouple parameters Combine Adam - better at early training stages - and SGD - better generalization properties This also helps with convergence! Wilson et al The Marginal Value of Adaptive Gradient Methods in Machine Learning Keskar, Socher Improving Generalization Performance by Switching from Adam to SGD Stefan Kühn (XING) Deep Optimization 26.04.2018 26 / 35
  • 27. Higher-Order Methods Second-Order Methods Require existence of Hessian and use this for scaling gradients accordingly, very successful but computationally expensive Classical Newton Method: fast local convergence, no global convergence Relaxed Newton Methods: help with global convergence Damped Newton Methods: help with global convergence Modified Newton Methods: help with computational complexity Quasi-Newton Methods: help with computational complexity Nonlinear Conjugate Gradient Methods: iteratively build approximation to Hessian But there is a lot more to explore, e.g. the basin-hopping algorithm - a strategy for finding global optima - or derivative-free methods like Nelder-Mead (downhill simplex), Particle Swarm Optimization (PSO and its variants) Stefan Kühn (XING) Deep Optimization 26.04.2018 27 / 35
  • 28. L-BFGS and Nonlinear CG Observations so far: The better the method, the more parameters to tune. All better methods try to incorporate curvature information. Why not doing so directly? L-BFGS Quasi-Newton method, builds an approximation of the (inverse) Hessian and scales gradient accordingly. Nonlinear CG Informally speaking, Nonlinear CG tries to solve a quadratic approximation of the function. No surprise: They also work with minibatches. Stefan Kühn (XING) Deep Optimization 26.04.2018 28 / 35
  • 29. Empirical results Empirical evidence for better optimizers being better learners. MNIST, handwritten digit recognition, from Ng et al., On Optimization Methods for Deep Learning Stefan Kühn (XING) Deep Optimization 26.04.2018 29 / 35
  • 30. Truncated Newton: Hessian-Free Optimization Main ideas: Approximate not Hessian H, but matrix-vector product Hd. Use finite differences instead of exact Hessian. Use damping. Use Linear CG method for solving quadratic approximation. Use clever mini-batch stragegy for large data-sets. Stefan Kühn (XING) Deep Optimization 26.04.2018 30 / 35
  • 31. Empirical test on pathological problems Main results: The addition problem is known to be effectively impossible for gradient descent, HF did it. Basic RNN cells are used, no specialized architectures (LSTMs etc.). (Martens/Sutskever (2011), Hochreiter/Schmidhuber, (1997) Stefan Kühn (XING) Deep Optimization 26.04.2018 31 / 35
  • 32. 1 Training Deep Networks 2 Training and Learning 3 The Toolbox of Optimization Methods 4 Takeaways Stefan Kühn (XING) Deep Optimization 26.04.2018 32 / 35
  • 33. Summary In the long run, the biggest bottleneck will be the sequential parts of an algorithm. That’s why the number of iterations needs to be small. SGD and its successors tend to have much more iterations, and they cannot benefit as much from higher parallelism (GPUs). But whatever you do/prefer/choose: At least try out successors of SGD: Momentum, Adam etc. Look for generic approaches instead of more and more specialized and manually finetuned solutions. Key aspects: Initialization Adaptive choice of stepsizes/momentum/. . . Scaling of the gradient Stefan Kühn (XING) Deep Optimization 26.04.2018 33 / 35
  • 34. Resources Overview of Gradient Descent methods Why momentum really works Adam - A Method for Stochastic Optimization Mathematics of Deep Learning The Marginal Value of Adaptive Gradient Methods in Machine Learning Andrew Ng et al. about L-BFGS and CG outperforming SGD Lecture Slides Neural Networks for Machine Learning - Hinton et al. On the importance of initialization and momentum in deep learning Data-Science-Blog: Summary article in preparation (Stefan Kühn) The Neural Network Zoo Stefan Kühn (XING) Deep Optimization 26.04.2018 34 / 35
  • 35. Thank you! Stefan Kühn (XING) Deep Optimization 26.04.2018 35 / 35