Learning by Directional Gradient Descent

David Silver, Anirudh Goyal, Ivo Danihelka, Matteo Hessel, Hado van HasseltICLR 2022

Training recurrent neural networks (RNNs) has always presented a fundamental trade-off. Practitioners typically must choose between the massive memory requirements of Backpropagation Through Time (BPTT), the crushing computational cost of Real-Time Recurrent Learning (RTRL), or the instability of biased approximations.

In a compelling ICLR 2022 paper, researchers from DeepMind and UCL propose DODGE (Deep Online Directional Gradient Estimate). This novel algorithm offers a clever middle ground, utilizing directional derivatives to provide stable, online updates with the same computational complexity as a standard forward pass.

The Challenge of Credit Assignment Over Time

The core difficulty in training recurrent systems is credit assignment: determining how a parameter change at the current step affects the loss many steps later. Traditionally, this requires one of two approaches:

  1. BPTT: Storing the entire history of states and backpropagating through them. This is highly memory-intensive. To save space, it is often "truncated" (TBPTT), which introduces significant bias and can lead to divergence.
  2. RTRL: Computing the gradient forward in time. While memory-efficient, it is computationally prohibitive—scaling at $O(pn^2)$ where $p$ is the number of parameters and $n$ is the state size.

Existing efficient alternatives often suffer from high variance (e.g., random search) or high bias (e.g., synthetic gradients). The authors sought a method that is fully online, memory-efficient, and mathematically guaranteed to descend the loss.

The DODGE Algorithm

The key insight of DODGE is that while computing the full gradient vector is computationally demanding, computing the directional derivative along an arbitrary candidate direction $u$ is highly efficient.

Instead of calculating the exact steepest descent direction (the true gradient $g$), DODGE selects a candidate direction $u$ and computes the scalar product $g \cdot u$ (the directional derivative). The parameter update is then proportional to this derivative along the chosen direction: $$\Delta w \propto (g \cdot u) u$$

Why is this approach advantageous?

  • Efficiency: Using the Jacobian-vector product trick, this directional derivative can be computed during a forward pass with $O(p)$ complexity—matching the network's standard forward computation cost.
  • Guaranteed Descent: Mathematically, the dot product of the DODGE update with the true gradient is $(g \cdot u)^2$. Because a squared value is always non-negative, DODGE is guaranteed to be a valid descent direction, regardless of how poor the initial choice of $u$ might be.
  • Flexible Directions: The algorithm can utilize various candidate directions, such as random directions (unbiased but high variance), truncated BPTT gradients (using a biased gradient as a directional "hint"), or synthetic gradients (using a learned critic).

Key Insights and Performance

DODGE acts as a powerful stabilizer. If a biased gradient estimate (like one from a very short BPTT unroll) is used as the direction $u$, DODGE effectively "projects" it back into a valid descent space, fixing the sign errors that typically cause biased methods to diverge.

While a single random direction works, it can be slow. The authors demonstrate that partitioning directions—splitting the parameter vector into parts and using different random signs for each—significantly reduces variance without increasing the $O(p)$ cost.

Training accuracy improves significantly as the number of candidate directions (D) increases.

Experimental Results

The authors evaluated DODGE across several synthetic and classic benchmarks:

  • Stability in Influence Balancing: On a toy problem designed to make truncated BPTT fail due to short-horizon bias, DODGE with a single random direction achieved the same near-zero loss as the expensive RTRL.
  • Learning with Noise: On MNIST, the authors proved that learning is possible even with just one random direction per update. However, as shown in the experiments, using more directions drastically speeds up convergence.
  • Long-term Memory (Copy Task): In the standard Copy Task, which requires the model to remember a sequence over many time steps, DODGE successfully minimized loss. Increasing the number of random directions (from 1 up to 64) yielded progressively faster convergence, outperforming standard TBPTT by handling longer dependencies more effectively.
In the Copy Task, increasing the number of random directions in DODGE leads to faster convergence and lower overall loss.
  • Meta-Learning: When combined with the Reptile algorithm for NeRF tasks (representing images from the CelebA dataset), DODGE-stabilized updates led to faster initial adaptation compared to standard Reptile.

Limitations and Future Work

While DODGE provides a stable and efficient alternative to traditional methods, it is not without limitations:

  • Credit Assignment Depth: DODGE does not magically solve the vanishing gradient problem for extremely long sequences (e.g., thousands of steps) common in complex Reinforcement Learning.
  • Direction Selection: The algorithm's performance heavily depends on the quality of the candidate direction $u$. While random directions are a safe fallback, finding better online methods to generate $u$ remains an open frontier.
  • Computational Overhead: Although it scales at $O(p)$, a DODGE update still requires roughly twice the computation of a simple forward pass. For highly constrained real-time applications, this overhead might still be a factor.

Ultimately, DODGE represents a significant step forward in online RNN training, offering a mathematically sound way to bypass the traditional memory and computational bottlenecks of backpropagation through time.

Summary updated

BibTeX
@inproceedings{silver2022learning,
  author = {David Silver and Anirudh Goyal and Ivo Danihelka and Matteo Hessel and Hado van Hasselt},
  title = {{Learning by Directional Gradient Descent}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=6H2nfvhoEo},
}
Figure