Cheat sheets
Activation functions
ReLU, GELU, sigmoid, tanh, and softmax, their derivatives, and where each is used.
| Activation | Formula | Range | Derivative | Typical use |
|---|---|---|---|---|
| ReLU | 1 if , else 0 | hidden layers (default) | ||
| Leaky ReLU | 1 or | avoids dead units | ||
| GELU | about | smooth | transformers | |
| Sigmoid | binary output probability, gates | |||
| Tanh | RNNs, zero-centered outputs | |||
| Softmax | probabilities summing to 1 | multiclass output, attention weights |
Why nonlinearity: without it, stacked linear layers collapse into one linear map ().
Gradient behavior: sigmoid and tanh saturate (tiny derivatives for large ), contributing to vanishing gradients. ReLU's gradient is exactly 1 for positive inputs, but units stuck negative are "dead."
Output layer by task: regression, none; binary, sigmoid; multiclass, softmax; multi-label, one sigmoid per label.
Lessons: The forward pass · Backpropagation · Lab: forward pass