Paper commentary
Practical recommendations for gradient-based training of deep architectures
Practical guide explains how to tune hyper-parameters for training deep networks
- Problem Deep networks have many hyper-parameters, and most of the advice on setting them has never been formally checked. Researchers often disagree on which settings matter most.
- Method The author gives defaults and tuning rules for the main settings. The learning rate comes first, tuned to within about a factor of 2.
- Results Unsupervised pre-training helped in most of the author's settings and very rarely hurt. It costs extra training time and extra hyper-parameters.
Why deep network training is hard to set up
Training a deep network by gradient descent involves many settings that the learning algorithm does not pick for itself. These include the learning rate, the mini-batch size and the number of training iterations, and each one can change the outcome. Researchers and research groups do not always agree on this practice, and much of the advice has not been formally checked.
The validation error used to pick these settings is itself optimized, so it can become optimistically biased. Once validation data has guided the choices, it can no longer give an unbiased estimate, so a test set or double cross-validation is needed. The author separates optimizer settings from model settings, which helps decide what to tune first.
Greedy pre-training as the starting point
The key idea is to build a deep network one layer at a time, using an unsupervised learner for each layer before any supervised training. Each new layer takes the representation produced by the layer below it as its input. The learner can be a Restricted Boltzmann Machine, an auto-encoder or a sparsifying auto-encoder similar to sparse coding.
Supervised fine-tuning then adjusts all the layers together, and this usually generalizes better than purely supervised training from random weights.
The author's experience is that pre-training helps in most settings and very rarely hurts. The cost is extra training time and extra hyper-parameters, so it is a trade-off rather than a free gain. Pre-training matters because the start point can decide which minimum the network reaches, a point the later sections return to.
Learning rate and mini-batch size
The initial learning rate is usually the most important setting, and the author advises tuning it to within about a factor of 2. A default of 0.01 typically works for standard multi-layer networks, but the author warns against relying on that value alone. If only one setting can be tuned under stochastic gradient descent, the learning rate is the one worth the effort.
A schedule can keep the rate constant for a first number of steps and then decay it roughly as 1/t to a power alpha. Keeping the rate constant is the default, and the author says the gain from a different schedule is often small. For non-convex problems the author suggests a smaller alpha, especially when momentum or gradient averaging is used.
Larger batches compute faster through matrix-matrix products but need more examples to reach the same error. Batch size is best tuned by comparing training curves against training time, after the other settings are chosen.
Early stopping and momentum
Early stopping chooses the number of updates by tracking validation error as training runs and keeping the best point. It also hides the overfitting caused by other settings, so the author suggests switching it off when studying the effect of one setting. A patience rule waits for a minimum number of examples after the best point before stopping, and the MLP tutorial starts at 10000 examples.
Validation error should be checked after every N examples rather than after every update, with N at least the validation set size.
Momentum keeps a moving average of past gradients, controlled by a small coefficient beta, and updates with that average instead. The idea is to reduce the noise and oscillations of stochastic gradient descent, especially along directions of high curvature. A default of beta equal to 1, meaning no momentum, works in many cases, but in some cases momentum makes a clear difference.
Polyak averaging, which averages the parameters, has theoretical advantages and helped some unsupervised procedures such as RBMs.
Initialization, seeds and preprocessing
Initialization scales weights so that units with more inputs get smaller weights, using the fan-in and the fan-out of each unit. For hyperbolic tangent units the author samples uniformly in plus or minus the square root of 6 over the sum of fan-in and fan-out. The author reports that these formulas removed any need for an initialization hyper-parameter in the author's experiments.
For RBMs, a zero-mean Gaussian with standard deviation around 0.1 or 0.01 works well.
Several sources of randomness exist, and local minima make parameter initialization matter. The random seed typically has only a slight effect and can mostly be ignored during the search. For a final set of choices, 5 to 10 different seeds can squeeze out a bit more performance.
Element-wise standardization is the usual starting point, and PCA is often advocated, at the cost of one more hyper-parameter. A logarithm or square root can reduce the tails of input features and make them more Gaussian-like. The penalty coefficient of the contractive auto-encoder appears sensitive and needs careful tuning.
Searching hyper-parameter values
Random search is preferred over grid search for automating hyper-parameter optimization. When only one computer is available, coordinate descent changes one setting at a time. If the best value sits near the border of the tried interval, the author recommends exploring beyond that border.
Trying only 3 values for a numerical setting is insufficient, even if the middle one is best, because the error curve is noisy. Sampling on a logarithmic scale is usually more informative, since 0.01 and 0.011 give similar results while 0.001 and 0.002 can differ a lot. A cheap estimator, such as using random weights in the lower layers, appears correlated with the expensive validation error.
Compute, debugging and visualization
Matrix-matrix products run substantially faster than the equivalent matrix-vector products, through BLAS caching and parallelism. On 512-core machines, the author routinely obtained speed-ups of 4× to 40× for large neural networks on GPUs. Transfers between GPU and CPU can slow training a great deal, so a profiler should show which operations run on the GPU.
Reconstruction-based learners struggle with sparse inputs, and sampled reconstruction reduces the cost by reconstructing only some elements. Sampling more often the elements likely to have large loss reduces the variance this sampling adds.
Buffers should be allocated once, and initializing them to NaN makes uninitialized values easy to spot. Networks are easier to compare by the number of examples visited than by epochs, since epochs depend on training set size. Filter visualization and function-space trajectories help show what has been learned and whether different starts reach different minima.
Open problems in training deeper networks
Some experiments suggest that deeper networks are harder to train from random initialization, with a greater chance of missing better minima. Erhan et al. found that different random starts seem to fall into different local minima, and these effects grow with depth.
Many procedures that train deep networks give each layer a local training signal, which avoids back-propagating through many non-linearities. Glorot and Bengio aimed for Jacobians with singular values near 1, which greatly reduced the gap between purely supervised and pre-trained networks. Without unsupervised pre-training, sigmoids in the top hidden layer stalled for a long time, while the rectifier worked very well for hidden units.
Adaptive learning rate methods such as adagrad still need more evaluation in the neural network context. The author notes that the recommendations are to be tried and challenged, not treated as a fixed practice.
Paper info
- Authors
- Yoshua Bengio
- Venue
- arXiv · Preprint
- First published
- 2012-6-24
- Added
- 2026-11-12
- Updated
- 2012-9-16
- Version
- v2
- arXiv
- 1206.5533
- Category
- cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Yoshua Bengio (2012). Practical recommendations for gradient-based training of deep architectures. arXiv:1206.5533v2. https://arxiv.org/abs/1206.5533v2
BibTeX
@misc{bengio2012practical,
title = {{Practical recommendations for gradient-based training of deep architectures}},
author = {Yoshua Bengio},
year = {2012},
eprint = {1206.5533},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1206.5533v2}
}