Activation Functions
The Need for Non‑linearity and Early Choices
A neural network is built from perceptrons that apply a non‑linearity to a linear combination of inputs. Without a non‑linearity, a composition of linear maps remains linear and the whole network collapses to a single perceptron.
Early models (McCulloch–Pitts, Rosenblatt) used step (threshold) functions:
Although universal approximation exists, gradient‑based training is impossible because the derivative is zero almost everywhere.
To obtain a smooth, differentiable alternative, the field adopted sigmoid functions, which are monotonic with horizontal asymptotes on both sides:
- Logistic sigmoid: (range ).
- Hyperbolic tangent: (range , symmetric around zero, preferred for internal layers because it avoids saturation near zero).
These served as the standard activations until about 2011–2012. Their main drawback is saturation: derivatives vanish on both tails, halting learning once a neuron is strongly activated.

Rectified Linear Unit (ReLU)
Introduced around 2011–2012, ReLU is zero for and equal to for . It does not saturate on the positive side, so gradients keep flowing for strongly active neurons; on the negative side it produces exact zeros, which can introduce sparsity — often acceptable in convolutional networks where weights are reused.
A mathematical observation: a sum of shifted sigmoids approximates a soft ReLU:
Biologically, a simple integrate‑and‑fire neuron with a refractory period yields a response curve that resembles ReLU.
When a neuron’s input is negative, the gradient is strictly zero and no learning occurs on that sample.
Leaky ReLU, ELU, and Beyond
To preserve gradient flow on the negative side, Leaky ReLU adds a small slope :
It is still a single‑hinge function but never kills gradients completely.
Exponential Linear Unit (ELU) smooths the negative part with an exponential:
ELU can produce negative outputs and a non‑zero mean, which sometimes speeds up learning.
Automatically Discovered Activations: Swish and Mish
An evolutionary search over computational graphs of elementary operations produced the Swish activation (Ramachandran et al. 2017):
Swish is non‑monotonic: on the negative side it first dips below zero and then returns to zero. Empirically it often outperforms ReLU.
Mish (Misra 2019) is a related variation:
Gaussian Linear Unit (GELU)
In present‑day large models (e.g., transformers, LLMs) the Gaussian Linear Unit (GELU) is common. It multiplies the input by the cumulative distribution function of a standard normal:
Its shape resembles Swish but often works slightly better in modern architectures. A practical trial order is ReLU, then Swish or GELU, and perhaps Leaky ReLU.
ACON: A General Framework
A smooth generalisation of the maximum (Ma et al. 2020) unifies many activations. For two functions and a smoothness parameter ,
Different choices yield known activations:
- ACON‑A: → Swish (soft); recovers ReLU.
- ACON‑B: () → soft LReLU; hard limit is ordinary Leaky ReLU.
- ACON‑C: , with learnable that set the asymptotic slopes:
Even on standard tasks, tuning these learnable parameters can give improvements, showing that the design space of activation functions is still far from exhausted.
Computational Graphs and Backpropagation
A neural network is a huge differentiable function that computes a loss from inputs , labels , and weights . To minimise we need its gradient with respect to every weight — millions of parameters. The only practical way is to exploit that is a composition of simple operations.
Computational Graph
We represent the function as a directed acyclic graph where each node is an elementary operation (addition, multiplication, activation, etc.) for which we know the local value and derivative.
For an example , the graph is:

Given concrete numbers, forward propagation (inputs → output) computes the function value in one pass. At we get .
Why Forward‑Mode Differentiation Does Not Scale
We can compute during the same forward pass by carrying derivatives alongside values, obtaining e.g. . But if we need the full gradient with respect to every input (millions of weights), forward‑mode requires either:
- a separate graph traversal per variable ( passes),
- or storing a vector of all partials at every node, exploding memory.
Real neural networks have one scalar loss and millions of parameters, making forward‑mode impractical.
Backpropagation
Backprop reverses the computation: start from the output and propagate derivatives backward using the chain rule.
Induction base: .
For any node with children ,
In the example:
- ,
The values are available because they were stored during a forward pass. In a single backward pass we obtain all partial derivatives simultaneously.
Backpropagation = forward pass (store intermediate values) + backward pass (propagate derivatives).
This two‑pass procedure is the core engine of every deep learning framework (PyTorch, TensorFlow, Theano). The rest of the framework — layer classes, optimisers — is syntactic sugar built around automatic differentiation.
(Biological neurons cannot implement backprop because they would need separate output pathways for the value and the derivative.)
Gradient Descent and Stochastic Gradient Descent
The loss we minimise is the average over the training set:
Full gradient descent computes the exact gradient on every step, which is prohibitively expensive. Instead, we sample a mini‑batch of examples and use the stochastic estimate.
Stochastic Gradient Descent (SGD)
is an unbiased estimate of , where is the empirical risk. Mini‑batches are easy to parallelise and smooth out excessive stochasticity.
Why Classical Optimisation Tools Fail
Deterministic gradient descent can use step‑size rules like the Wolfe conditions to select :
- Armijo rule: , .
- Strong Wolfe: additionally .
These require exact function and gradient evaluations — impossible with noisy SGD estimates.
Newton’s method takes the second‑order Taylor expansion, scaling the step by the inverse Hessian:
It automatically adjusts the step per coordinate and eliminates hand‑tuning of the learning rate. For deep networks would be a million‑by‑million matrix — impossible to compute, store, or invert.
Quasi‑Newton methods such as L‑BFGS maintain a low‑rank approximation of from stored gradients and updates, achieving second‑order‑like behaviour with modest memory. However, they critically depend on accurate gradients. Replacing exact gradients with noisy mini‑batch estimates breaks them. Making quasi‑Newton methods work with SGD remains an open problem.
Convergence Analysis of SGD
Assuming convexity, bounded initial distance , and bounded variance , one obtains for a weighted average :
Key consequences:
- Constant step size : the bound tends to — SGD converges to an uncertainty ball of radius proportional to .
- To drive the error to zero, step sizes must satisfy and , e.g., .
- The variance term introduces convergence instead of the of full GD, but each iteration is orders of magnitude cheaper.
- Mini‑batch sizes are often tiny (4–8), so the variance remains large. This noise is the root cause that kills line‑search and quasi‑Newton methods.

SGD with Momentum
A central problem is ill‑conditioning: different parameter dimensions have vastly different scales. In the quadratic with , changes much slower than , yet the maximum stable learning rate is limited by the steep ‑direction. Plain gradient descent either diverges on or crawls on .
Classical Momentum
To maintain velocity and damp oscillations, we keep a fraction of the previous update:
With near –, the optimisation behaves like a rolling ball with friction: it keeps moving in directions where the gradient consistently points, stabilising orthogonal oscillations and accelerating along shallow ravines.

Nesterov Accelerated Gradient
Nesterov’s method looks ahead to the point where momentum would carry the parameters:
Intuition: it anticipates the upcoming curve and starts slowing before the turn, like a good driver — rather than a passive ball that overshoots. Mathematically, it improves asymptotic convergence rates and damps oscillations more effectively.
Adaptive Gradient Descent
Even momentum does not solve the fundamental scaling problem: each coordinate may need a different learning rate. Adaptive methods maintain per‑parameter rates, increasing them for parameters with small, consistent gradients and decreasing them for those with large, rapidly changing gradients.

AdaGrad
AdaGrad accumulates squared gradients in a diagonal matrix :
On steep dimensions grows quickly, shrinking the effective learning rate; on shallow slopes it grows slowly, allowing larger steps. The drawback is that only grows, so the learning rate decays monotonically and never recovers.
RMSprop
RMSprop replaces the cumulative sum with an exponential moving average (EMA) of squared gradients:
Old history is exponentially forgotten, so the learning rate can speed up again when the landscape flattens.
AdaDelta and Unit Matching
A physical insight: gradient descent subtracts a velocity (, units ) from a parameter (units ), which is dimensionally inconsistent. Newton’s method fixes this because has units .
AdaDelta approximates the RMS of parameter updates with another EMA and uses it to normalise the step:
The idea is elegant, though AdaDelta did not become widely used.
Adam
Adam combines RMSprop’s adaptive scaling with momentum, smoothing both the gradient and its square:
The moving average reduces gradient variance across mini‑batches; adapts the learning rate per coordinate. Bias correction compensates for zero‑initialised EMAs. Recommended defaults (, , ) work well without tuning, making Adam the de facto default in many projects.
Nadam further incorporates Nesterov momentum into Adam. A unified framework treats all these variants as diagonal rescaling of the gradient with optional momentum and momentum‑lookahead.
AdamW, Regularisation, and Practical Remarks
Weight Decay vs. Regularisation
Classical weight decay multiplies weights by a factor before adding the gradient step:
For plain SGD this is equivalent to minimising . With momentum or adaptive methods, the equivalence breaks — the regularisation term interacts with the adaptive scaling, coupling the hyperparameter to the learning rate.
AdamW decouples weight decay from the adaptive update:
This restores the original weight‑decay behaviour, simplifies hyperparameter tuning, and often improves generalisation compared to standard Adam with .
Generalisation and Adaptive Methods
Evidence shows that adaptive methods (Adam) can converge to minima that generalise worse than plain SGD (Wilson et al. 2017). Switching from Adam to SGD mid‑training has been proposed as a compromise. Nonetheless, properly tuned AdamW remains a strong, widely used choice.
Super‑Convergence and Cyclical Schedules
A 2017 paper on Super‑Convergence showed that cyclic learning rate schedules (alternating fast and slow phases) can accelerate training 10–20× and yield models of comparable quality. The idea generated excitement but never became a universal standard; cyclical schedules are used in some contexts but are not a default.

AMSGrad: Theory vs. Practice
The original convergence proof of Adam contained a mistake. AMSGrad (Reddi et al. 2018) corrected it by replacing the EMA of squared gradients with the maximum over past values, guaranteeing convergence. Despite winning the ICLR 2018 Best Paper Award, AMSGrad does not consistently outperform Adam in practice and is rarely used — a reminder that theoretical correctness alone does not displace empirically successful methods.
Current Practice
Today, standard training algorithms are Adam, AdamW, and plain SGD with momentum (the latter still very effective when combined with careful learning-rate tuning). Newer algorithms like Lion and Muon have appeared, but the mainstays remain Adam‑family optimisers. For activations, GELU is prevalent in large language models, while ReLU and Swish are common in vision.