Batch normalisation: steadying the layers of a deep network
10 questions on normalising hidden layers per mini-batch, learnable scale and shift, vanishing gradients, prediction-time statistics and why it works.
- 10 questions
- Stopwatch
- Instant feedback
Sample questions
Play now ↑Answers stay hidden. Start the quiz to play them.
Sample 1
In a 50-layer network, the learning signal for the first layer is a product of one contribution from each layer. Most of those contributions have a size well above one. What is likely to happen?
- The signal fades to zero, so the first layer cannot learn
- The signal grows enormously, which is the exploding gradient problem
- The signal stays exactly constant
Sample 2
Batch normalisation was first motivated by the idea that earlier layers change the distribution seen by later ones. What do later studies suggest?
- That the benefit mainly comes from a smoother error surface, and the distribution shift is not a significant factor
- That the method does not improve training at all
- That the original explanation was fully confirmed
How it works
- One question per screen. An answer is final once sent.
- You see right away whether you were right, with a short explanation.
- The stopwatch runs: on equal scores, the faster player ranks first.
- Only your best attempt counts, so replaying is never risky.
About this quiz
Training a deep network is a little like running a relay race in which each runner starts only when the previous one arrives. The first layers change their output every time their weights are updated, and every later layer must keep adjusting to a moving target. If one layer suddenly hands over values a hundred times larger than before, the next one is thrown off, and the unrest passes down the whole chain. Batch normalisation is a way of making each hand-over tidy: before values enter the next layer, they are standardised, so the layer always receives numbers of a familiar size.
This quiz explains how the idea works and why it became so popular after it was introduced. You will see where the averages and spreads come from, and why they have to be recomputed throughout training instead of once at the start. You will see how the method deals with a notorious problem of deep networks, in which learning signals sent back through many layers shrink to nothing or grow without bound. You will also meet the two adjustable numbers that give back flexibility, and work out why they do not simply cancel what the normalisation did.
The quiz then turns to practice. A trained network receives a single new case, with no mini-batch to compute an average from: what is used instead? And the final question is about humility: the original explanation of why the method works has been challenged by later studies, and the quiz asks what the newer evidence points to.
Some common mistakes are worth anticipating. People often assume that the statistics are always taken over the whole training set, or that they come from the single example being predicted. They imagine the learnable numbers are redundant. Or they take for granted that everyone agrees on why the method helps, whereas the explanation is itself a matter of research. There is a practical reason to understand the method rather than just switch it on. Batch normalisation changes how a network behaves in training and in use, it depends on the size of the mini-batch, and it adds numbers that must be stored with the trained model. Teams that ignore these facts sometimes find that a model works well on their benchmark and strangely poorly when served one request at a time, or that results shift when they change the batch size to fit a different machine. Knowing the mechanism makes such surprises easy to diagnose.
It suits learners who know input normalisation and the basic idea of layers, and practitioners who add the layer by habit and want to know what it does. No algebra is needed. There are 10 questions with explanations, and it takes about four minutes.
Questions and answers
›How long does the quiz take?
About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. An explanation appears after every answer, so you can follow the reasoning even if you miss one.
›Do I need to understand deep networks in detail?
No. You should know that a deep network is a chain of layers whose outputs feed the next one, and that training adjusts weights by gradient descent. The quiz on input normalisation is a useful companion, but not a requirement.
›What is batch normalisation?
It is an extra step applied to the values inside a layer. For each hidden unit, the method measures the average and spread of that unit's values over the current mini-batch of examples, then shifts and rescales them to have zero average and unit spread. It is then usually followed by an adjustable shift and scale. The step is inserted between layers and used throughout training.
›Why can't the statistics be computed once, like for the inputs?
The inputs to the network never change, so one calculation is enough. The values inside the network depend on the weights, and the weights change after every update. So the averages and spreads of the hidden values also change, and the normalisation has to be recomputed for each mini-batch as training proceeds.
›What are vanishing and exploding gradients?
The learning signal for an early layer is obtained by multiplying together contributions from every layer above it. A long product of numbers that are mostly smaller than one tends towards zero, while a long product of numbers mostly larger than one tends towards infinity. So in a very deep network, early layers can receive almost no signal, or an enormous one. Keeping layer values well scaled largely resolves the difficulty.
›What are the learnable scale and shift for?
Forcing every unit to have exactly zero average and unit spread reduces what the layer can represent. Two adjustable numbers per unit, one setting the spread and one setting the average, are learned by gradient descent together with the weights, so the network can pick whatever values suit it. They are what makes the method a trainable part of the network.
›Is batch normalisation better than other normalisation methods?
It is very effective in many settings but depends on having a reasonably large mini-batch to estimate averages from. Alternatives that normalise within each example are used when batches are small or when the data come in sequences. Neither is universally best, and the sister quiz on layer normalisation compares them directly.
›Do researchers agree on why it works?
Not fully. The method was first motivated by a particular explanation about the changing distribution of values seen by later layers. Subsequent investigations have questioned how important that effect is, and offered a different account. The practical benefits are well established, while the theory behind them remains an open topic.