Training a neural network comes down to one question repeated millions of times: how should we nudge each weight to reduce the loss? The answer requires a derivative â the gradient â of a function that can have billions of inputs and layers of nonlinearities stacked on top of each other.
Symbolic differentiation (the kind taught in calculus class) produces exact formulas, but applied to code it generates expressions that explode in size. Finite differences approximate derivatives by evaluating f(x+Îľ) and f(x), but they are slow (one extra pass per parameter) and numerically fragile. Neither scales.
Automatic differentiation (autodiff) threads a third path. It does not manipulate formulas. It does not perturb inputs. Instead it applies the chain rule mechanically to each arithmetic operation the program performs, accumulating exact derivatives as a by-product of a normal execution. The result is exact (up to floating-point rounding) and costs only a small constant multiple of the original computation â regardless of how many parameters there are.
This idea, developed in its modern form through the 1960sâ1980s, is the algorithm that makes deep learning tractable. Every major framework â PyTorch, TensorFlow, JAX â runs autodiff under the hood.
Comments
Loading comments...