mediumDeep Learning & Neural NetworksReviewed Jul 24, 2026

Why do neural networks need non-linear activation functions, and how do ReLU, sigmoid, tanh, and softmax differ?

Without non-linear activations, stacking layers collapses into a single linear transformation, so the network could only learn linear functions no matter how deep it is. Non-linearity lets it model complex, curved decision boundaries. ReLU, max(0, x), is the default for hidden layers: cheap, sparse, and it avoids saturation for positive inputs, though it can cause 'dead' neurons that always output zero. Sigmoid squashes to (0,1) and is used for binary output probabilities, but saturates and causes vanishing gradients. Tanh maps to (-1,1) and is zero-centered, which often trains better than sigmoid in hidden layers. Softmax converts a vector of logits into a probability distribution summing to 1, used in the output layer for multi-class classification. Choose the output activation to match the task and loss.

activationsrelusoftmaxnon-linearity

More Deep Learning & Neural Networks questions

See all Deep Learning & Neural Networks questions →