Abstract
Using backpropagation to compute gradients of objective functions for optimization has remained a mainstay of machine learning. Backpropagation, or reverse-mode differentiation, is a special case within the general family of automatic differentiation algorithms that also includes the forward mode. We present a method to compute gradients based solely on the directional derivative that one can compute exactly and efficiently via the forward mode. We call this formulation the forward gradient, an unbiased estimate of the gradient that can be evaluated in a single forward run of the function, entirely eliminating the need for backpropagation in gradient descent. We demonstrate forward gradient descent in a range of problems, showing substantial savings in computation and enabling training up to twice as fast in some cases.
Introduction
Since the mid-1980s, backpropagation—specifically reverse-mode automatic differentiation—has served as the foundational algorithm for training neural networks. Despite its success, backpropagation imposes significant constraints on modern hardware and biological modeling.
First, it is memory intensive; to compute gradients, the system must store all intermediate activations from the forward pass to utilize them during the backward pass. This "computation tape" grows linearly with network depth and complexity. Second, the computational overhead of the backward pass is often significantly higher than the forward pass. Finally, backpropagation is biologically implausible. The human brain lacks a mechanism for a perfectly synchronized backward pass that mirrors forward connections, leading neuroscientists to seek alternative learning rules. This paper explores whether we can achieve the benefits of gradient descent using only the forward pass.
The Forward Gradient Method
The proposed solution centers on the Forward Gradient, an alternative to the traditional gradient computed via forward-mode automatic differentiation (AD). The methodology relies on three core components:
1. Directional Derivatives
Standard forward-mode AD can compute a "directional derivative"—a scalar value representing how much the output of a function $f(\theta)$ changes if the inputs are perturbed in a specific direction $v$. Unlike the full gradient, which requires a backward pass, this scalar is computed simultaneously with the forward pass.
2. The Unbiased Estimator
The authors demonstrate that if a random perturbation vector $v$ is sampled from a distribution with zero mean and unit variance (such as a multivariate standard normal), the product of the directional derivative and the vector $v$ provides an unbiased estimator of the true gradient: $$\hat{g} = (\nabla f(\theta) \cdot v)v$$ While this estimate is noisy for a single sample, its expectation is exactly the gradient $\nabla f(\theta)$.
3. Forward Gradient Descent (FGD)
The resulting algorithm, Forward Gradient Descent (FGD), simplifies the training loop. Instead of the standard forward-backward cycle, the optimizer samples a random direction $v$, runs the model once using forward-mode AD to obtain the output and the directional derivative, and updates the weights using the estimated forward gradient. Because the estimator is unbiased, the optimization process averages out the noise over many iterations, behaving similarly to Stochastic Gradient Descent (SGD).
Experimental Evaluation
The researchers evaluated FGD across mathematical benchmarks and image classification tasks:
- Mathematical Benchmarks: Optimization of the Beale and Rosenbrock functions.
- Image Classification: MNIST dataset using Logistic Regression, Multi-Layer Perceptrons (MLP), and Convolutional Neural Networks (CNN).
Key Results
- Computational Speedups: In CNN architectures on MNIST, the forward gradient method reached target validation loss in approximately half the time ($T_f/T_b = 0.514$) compared to traditional backpropagation.
- Scalability: Testing on MLPs with up to 100 layers showed that while the relative advantage of forward gradients narrows as depth increases, the method remains consistently faster than backpropagation across the tested range.
- Beneficial Noise: In several experiments, FGD reached lower loss values faster than backpropagation. The authors suggest that the inherent variance in the forward gradient estimator may act as a regularizer, helping the optimizer escape local minima and explore the loss surface more effectively.
Discussion and Limitations
While the forward gradient offers a compelling alternative to backpropagation, several challenges remain for large-scale adoption.
Variance in High Dimensions: As the parameter count enters the billions, the variance of the estimator may increase, potentially slowing convergence. The authors suggest that "local" forward gradients—applied per-layer or per-module—might mitigate this in massive models.
Software and Hardware Optimization: Current deep learning frameworks like PyTorch and TensorFlow are heavily optimized for reverse-mode AD. To realize the theoretical 5x-10x speedups suggested by AD theory, forward-mode AD must be integrated into low-level CUDA kernels.
Biological Implications: The use of a global scalar feedback (the directional derivative) to update local weights provides a potential bridge to understanding how biological systems perform gradient-like optimization without the need for a complex backward architecture.
In conclusion, the forward gradient method demonstrates that backpropagation is not the only path to efficient neural network training. By embracing noisy but computationally efficient estimators, we can potentially unlock faster, more memory-efficient, and more biologically grounded machine learning models.
Summary updated