Why does a neural network need non-linear activation functions, and how did the field move from sigmoid to ReLU to GELU-style activations?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Without a non-linearity, stacking layers buys nothing: W₂(W₁x + b₁) + b₂ is still one affine map, so a 100-layer network has the expressive power of a single linear layer. The activation is what lets depth compose simple features into functions that are not linear in the input, and it is what the universal approximation results rely on.
Full worked answer
Without a non-linearity, stacking layers buys nothing: W₂(W₁x + b₁) + b₂ is still one affine map, so a 100-layer network has the expressive power of a single linear layer. The activation is what lets depth compose simple features into functions that are not linear in the input, and it is what the universal approximation results rely on.
The history since then is a story about gradients:
- Sigmoid and tanh were the defaults through the 2000s. Both saturate: for large |z| the derivative goes to zero, and sigmoid's maximum derivative is only 0.25, so gradients shrink with every layer. Sigmoid is also not zero-centred, which makes updates zig-zag. Both survive today as gates (LSTM, GLU variants) and as output layers, where squashing into a range is the point.
- ReLU, max(0, z), made deep supervised training practical in the AlexNet era. Its derivative is exactly 1 on the active side, it is cheap, and it gives sparse activations. Its failure mode is dead units: a neuron whose pre-activation is negative for every input gets zero gradient forever, often after a too-high learning rate knocks its bias negative. Leaky ReLU and PReLU keep a small negative slope to avoid that.
- GELU (z·Φ(z)) and SiLU/Swish (z·σ(z)) are smooth ReLU-like curves with a small negative dip. Smoothness tends to optimise better at scale, which is why BERT and GPT-2 used GELU.
- Gated variants (SwiGLU, GeGLU) multiply two linear projections, one passed through the activation, and are the standard choice in current LLM feed-forward blocks.
What an interviewer listens for: the linear-collapse argument stated crisply, saturation tied to vanishing gradients, and the link to initialization (He init assumes ReLU zeroes half its inputs). For a new MLP on tabular or embedding inputs, ReLU or GELU is fine. The choice rarely matters as much as normalization, init and learning rate.
What a good answer covers
- Without a non-linearity, stacking layers buys nothing
- The activation is what lets depth compose simple features into functions that are not linear in the…
- Sigmoid and tanh were the defaults through the 2000s
- ReLU, max(0, z), made deep supervised training practical in the AlexNet era
- GELU (z·Φ(z)) and SiLU/Swish (z·σ(z)) are smooth ReLU-like curves with a small negative dip
Key terms: Sigmoid and tanh · ReLU · dead units · GELU · SiLU/Swish · Gated variants
Interviewer follow-ups to expect
How would you detect dead ReLUs in a trained network?
Why does SwiGLU usually use a hidden size of about 8/3 × d instead of 4 × d?
Why is sigmoid still the right output for a multi-label classifier?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep