Activation functions and weight-space symmetries
10 questions on why networks need nonlinearity, vanishing gradients, ReLU and its variants, softplus, tanh versus sigmoid and equivalent weight settings.
- 10 questions
- Stopwatch
- Instant feedback
Sample questions
Play now ↑Answers stay hidden. Start the quiz to play them.
Sample 1
A network with logistic sigmoid hidden units has an exact equivalent with tanh hidden units. Why might they still train differently?
- The weights have to be initialised differently, so the same initialisation scheme doesn't suit both
- tanh networks can represent different functions
- Sigmoid networks cannot be trained at all
Sample 2
A layer has three hidden units. In how many different orders can the units be arranged, giving the same function with different weights?
- Three
- Six
- Nine
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
Strip the nonlinear function out of a neural network and something striking happens: however many layers you stack, the whole network collapses into one single linear transformation, no more powerful than a plain linear model. The nonlinear activation function applied inside every hidden unit is what gives depth its power, and the choice of that function has shaped the history of the field. Networks that were almost impossible to train with one popular choice became routine to train with another, and the explanation lies in a surprisingly simple property: what the function's slope does when its input is large.
This quiz surveys the main choices in the order they appeared. The smooth S-shaped functions, the logistic sigmoid and its cousin the hyperbolic tangent, were inspired by biological neurons and dominated the early years. You will see why they cause training to stall in deep networks, how the softplus function and the rectified linear unit, or ReLU, avoid the problem, and what ReLU's own weakness is and how variants repair it. The quiz also asks why ReLU became the default in practice, in terms of training speed, sensitivity to the starting weights and cost of computation.
The second theme is a curious property of networks: the same behaviour can be produced by many different settings of the weights. Flipping the signs of the weights around one hidden unit can be exactly compensated for elsewhere, and swapping two hidden units changes nothing in what the network computes. The quiz asks you to count such equivalent settings in a small example, and to say when, if ever, this matters in practice. It also touches on how linear units with a bottleneck connect to a classic technique for compressing data.
Typical misunderstandings include thinking that linear hidden units can add power, that sigmoid and tanh networks are interchangeable in every respect, that a unit with a zero slope still receives a learning signal, and that the many equivalent weight settings must make training impossible. The quiz clears them up with short scenarios. The story of activation functions is a good example of how a small change in a basic ingredient can unlock progress in a whole field, and it is worth remembering when someone claims that deep learning advanced only through bigger computers. Every function discussed here is cheap to compute and has a slope that is easy to evaluate, which is what makes training with millions of units feasible.
It suits students and practitioners who have used activation functions without knowing why one is preferred to another. No calculus is required. There are 10 questions, each with an explanation, and the quiz 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.
›Do I need to know the formulas of the activation functions?
No. The quiz describes each function by its shape: a smooth S, a bent line that is flat on one side, and so on. If you can picture those shapes and understand what the slope of a curve means, you can answer every question.
›Why do networks need nonlinear activation functions?
Because stacking linear steps gives another linear step. Without nonlinearity, a network with many layers could represent nothing that a single layer couldn't. The nonlinearity between layers is what lets depth build up complicated functions out of simple ones.
›What is the vanishing gradient problem?
Training adjusts weights using the slope of the error. For S-shaped activations, the slope becomes almost zero when the input is very large or very small, so the learning signal fades as it passes back through many layers. The early layers of a deep network then learn extremely slowly. If you ever see a network whose loss refuses to fall in the early layers, the activation function is one of the first things worth examining, along with the way the weights were initialised.
›What is ReLU and why is it popular?
The rectified linear unit outputs its input if it is positive and zero otherwise. It has a constant slope for positive inputs, is very cheap to compute, makes deep networks easier to train and is less sensitive to how the weights are initialised. It is the default choice in many applications. If you are building a network today, a reasonable default is ReLU or a close relative for the hidden units, with the output activation chosen by the type of target, and a change only when there is a clear reason to experiment.
›What are the weaknesses of ReLU, and how are they addressed?
For negative inputs its slope is zero, so a unit stuck in that region receives no learning signal. Variants such as the leaky ReLU give a small non-zero slope on the negative side. Another variant lets each unit learn its own slope, and the softplus function is a smooth version of the original.
›What are weight-space symmetries?
They are transformations of the weights that leave the function computed by the network unchanged. Swapping the roles of two hidden units is one, and changing the sign of the weights into and out of a unit with an odd activation is another. The result is that a single function corresponds to a huge number of weight settings.
›Do weight-space symmetries matter in practice?
Rarely for training, since the goal is to find one good setting and the existence of equivalent ones does no harm. They do matter in some Bayesian calculations, for example when comparing networks of different sizes, because the equivalent settings have to be accounted for.