The Living Thing / Notebooks :

Regularising and generalisation in neural networks

Q: Which of these tricks can I apply outside of deep settings?

General framing

How do we get generalisation from neural networks?

Here’s one interesting perspective. Is it correct? (ZBHR17)

  1. The effective capacity of neural networks is large enough for a brute-force memorization of the entire data set.
  2. Even optimization on random labels remains easy. In fact, training time increases only by a small constant factor compared with training on the true labels.
  3. Randomizing labels is solely a data transformation, leaving all other properties of the learning problem unchanged.

[…] Explicit regularization may improve generalization performance, but is neither necessary nor by itself sufficient for controlling generalization error. […]Appealing to linear models, we analyze how SGD acts as an implicit regularizer.

Early stopping

e.g. Prec12. Don’t keep training your model. The regularisation method that actually makes learning go faster, because you don’t bother to do as much of it.

Noise layers


A very popular of noise layer, multiplicative. Interesting because it has an interesting rationale in terms of model averaging and as a kind of implicit probabilistic learning.

Input perturbation

Parametric noise layer. If you are hip you will take this further and do it by…

Adversarial training

See adversarial learning.

Regularisation penalties

L_1, L_2, dropout… Seems to be applied to weights, but rarely to actual neurons.

See Compressing neural networks for that latter use.

This is attractive but has an expensive hyperparameter to choose.

Reversible learning

An elegant autodiff hack, where you find the gradient of the model (loss?) with respect to the model hyperparameters. Usually regularisation hyperparameters, although they don’t require that. Proposed by Bengio, Baydin and Pearlmutter (Beng00, BaPe14) made feasible by Maclaurin et al (MaDA15). Differentiate your optimisation itself with respect to hyperparameters. Non-trivial to implement, though.

Bayesian optimisation

Choose your regularisation hyperparameters optimally even without fancy reversible learning but designing optimal experiments to find the optimum loss. See Bayesian optimisation.


Weight Normalization

Pragmatically, controlling for variability in your data can be very hard in, e.g. deep learning so you might normalise it by the batch variance. Salimans and Kingma (SaKi16) have a more satisfying approach to this.

We present weight normalization: a reparameterization of the weight vectors in a neural network that decouples the length of those weight vectors from their direction. By reparameterizing the weights in this way we improve the conditioning of the optimization problem and we speed up convergence of stochastic gradient descent. Our reparameterization is inspired by batch normalization but does not introduce any dependencies between the examples in a minibatch. This means that our method can also be applied successfully to recurrent models such as LSTMs and to noise-sensitive applications such as deep reinforcement learning or generative models, for which batch normalization is less well suited. Although our method is much simpler, it still provides much of the speed-up of full batch normalization. In addition, the computational overhead of our method is lower, permitting more optimization steps to be taken in the same amount of time.

They provide an open implemention for keras, Tensorflow and lasagne.


Bach, F. (2014) Breaking the Curse of Dimensionality with Convex Neural Networks. ArXiv:1412.8690 [Cs, Math, Stat].
Bahadori, M. T., Chalupka, K., Choi, E., Chen, R., Stewart, W. F., & Sun, J. (2017) Neural Causal Regularization under the Independence of Mechanisms Assumption. ArXiv:1702.02604 [Cs, Stat].
Baldi, P., Sadowski, P., & Lu, Z. (2016) Learning in the Machine: Random Backpropagation and the Learning Channel. ArXiv:1612.02734 [Cs].
Baydin, A. G., & Pearlmutter, B. A.(2014) Automatic Differentiation of Algorithms for Machine Learning. ArXiv:1404.7456 [Cs, Stat].
Bengio, Y. (2000) Gradient-Based Optimization of Hyperparameters. Neural Computation, 12(8), 1889–1900. DOI.
Cutajar, K., Bonilla, E. V., Michiardi, P., & Filippone, M. (2016) Practical Learning of Deep Gaussian Processes via Random Fourier Features. ArXiv:1610.04386 [Stat].
Dasgupta, S., Yoshizumi, T., & Osogami, T. (2016) Regularized Dynamic Boltzmann Machine with Delay Pruning for Unsupervised Learning of Temporal Sequences. ArXiv:1610.01989 [Cs, Stat].
Gal, Y. (2015) A Theoretically Grounded Application of Dropout in Recurrent Neural Networks. ArXiv:1512.05287 [Stat].
Hardt, M., Recht, B., & Singer, Y. (2015) Train faster, generalize better: Stability of stochastic gradient descent. ArXiv:1509.01240 [Cs, Math, Stat].
Im, D. J., Tao, M., & Branson, K. (2016) An empirical analysis of the optimization of deep network loss surfaces. ArXiv:1612.04010 [Cs].
Maclaurin, D. (2016) Modeling, Inference and Optimization with Composable Differentiable Procedures.
Maclaurin, D., Duvenaud, D. K., & Adams, R. P.(2015) Gradient-based Hyperparameter Optimization through Reversible Learning. In ICML (pp. 2113–2122).
Molchanov, D., Ashukha, A., & Vetrov, D. (2017) Variational Dropout Sparsifies Deep Neural Networks. ArXiv:1701.05369 [Cs, Stat].
Nøkland, A. (2016) Direct Feedback Alignment Provides Learning in Deep Neural Networks. In Advances In Neural Information Processing Systems.
Pan, W., Dong, H., & Guo, Y. (2016) DropNeuron: Simplifying the Structure of Deep Neural Networks. ArXiv:1606.07326 [Cs, Stat].
Perez, C. E.(2016, November 6) Deep Learning: The Unreasonable Effectiveness of Randomness. Medium.
Prechelt, L. (2012) Early Stopping — But When?. In G. Montavon, G. B. Orr, & K.-R. Müller (Eds.), Neural Networks: Tricks of the Trade (pp. 53–67). Springer Berlin Heidelberg DOI.
Salimans, T., & Kingma, D. P.(2016) Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, & R. Garnett (Eds.), Advances in Neural Information Processing Systems 29 (pp. 901–901). Curran Associates, Inc.
Scardapane, S., Comminiello, D., Hussain, A., & Uncini, A. (2016) Group Sparse Regularization for Deep Neural Networks. ArXiv:1607.00485 [Cs, Stat].
Srinivas, S., & Babu, R. V.(2016) Generalized Dropout. ArXiv:1611.06791 [Cs].
Xie, B., Liang, Y., & Song, L. (2016) Diversity Leads to Generalization in Neural Networks. ArXiv:1611.03131 [Cs, Stat].
Zhang, C., Bengio, S., Hardt, M., Recht, B., & Vinyals, O. (2017) Understanding deep learning requires rethinking generalization. In Proceedings of ICLR.