How do you express the derivatives of and purely in terms of and , what are their maximum values, and why is generally preferred over in hidden layers?
Deep learning, Neurons and activations
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you can differentiate both saturating activations cleanly and explain the optimisation benefit of zero-centred outputs.
Key idea
with maximum at , and with maximum at . Unlike , is zero-centred, so weights feeding from a hidden layer can receive mixed-sign gradients.
Steps
- Sigmoid derivative: write . Differentiating gives . At , , giving the maximum .
- Tanh derivative: write . By the quotient rule, (using ). At , , giving the maximum .
- Why trains better: for a weight vector receiving strictly positive inputs and upstream error signal , the gradient has the same sign on every coordinate, forcing zig-zagging updates. Zero-centred inputs avoid this bias and also have a larger peak derivative.
- Note the shared limitation: both activations still saturate when is large, so neither prevents vanishing gradients on its own in very deep networks (which is why ReLU variants are preferred in deep hidden layers).
Common mistakes
- Writing by analogy with sigmoid.
- Forgetting that both still saturate when is large, so neither prevents vanishing gradients on its own in very deep nets.
How long your answer should be
About half a page; 2–3 minutes covering both derivations, their maxima and the zero-centring reason.
Read this
Previous in Deep learning: For a mini-batch of examples stacked as rows in , a two-layer network computes , and , where , , , and is the all-ones vector. Given the batch-averaged loss gradient , what are the gradients with respect to , and how do matrix dimensions verify the transposes?
Next in Deep learning: For , how do you derive the full Jacobian matrix for both diagonal () and off-diagonal () entries, and why does shifting every logit by a constant leave unchanged?