An automatic differentiation engine that computes gradients for training machine learning models.
Autograd refers to automatic differentiation systems embedded in machine learning frameworks that compute gradients of mathematical functions with respect to their inputs. These gradients are the backbone of optimization algorithms like stochastic gradient descent, which iteratively adjust model parameters to minimize a loss function. Without autograd, practitioners would need to derive and implement gradients by hand — a tedious, error-prone process that becomes practically infeasible for modern neural networks with millions of parameters.
The core mechanism behind autograd is reverse-mode automatic differentiation, also called backpropagation when applied to neural networks. As a model performs a forward pass — computing predictions from inputs — the autograd engine records each mathematical operation in a computational graph, sometimes called a "tape." During the backward pass, the engine traverses this graph in reverse, applying the chain rule of calculus at each node to accumulate gradients efficiently. This approach is especially well-suited to deep learning, where models typically have far more parameters than outputs, making reverse-mode differentiation orders of magnitude cheaper than forward-mode alternatives.
The term gained widespread recognition with the rise of dynamic computation graph frameworks in the mid-2010s. PyTorch, released in 2016 by Facebook's AI Research lab, made autograd a first-class feature and popularized the "define-by-run" paradigm, where the computational graph is constructed dynamically during execution rather than compiled statically in advance. This made debugging and experimentation significantly more intuitive compared to earlier frameworks like Theano. TensorFlow later adopted eager execution and its own gradient tape mechanism, converging toward a similar model.
Autograd has become so foundational that most practitioners interact with it implicitly — calling a single method like loss.backward() triggers the entire gradient computation pipeline. Beyond standard neural network training, autograd enables advanced techniques such as gradient-based hyperparameter optimization, meta-learning, and differentiable programming, where entire algorithms are made end-to-end trainable. Its availability as a reliable, high-performance primitive has dramatically lowered the barrier to developing novel model architectures and research ideas.