docscore conceptsconcept-autograd-tape
Core Concepts

Concepts: Iterative Tape Autograd

Dynamic execution tapes, reverse worklists, and avoiding recursion stack overflow.

Concepts: Iterative Tape Autograd

Dynamic execution tapes, reverse worklists, and avoiding recursion stack overflow.

Unlike classic recursive autograd implementations that traverse backward graphs via the execution stack, Dark Forest constructs an explicit topological worklist.

Algorithm

  1. Compute in-degree for all graph nodes reachable from the loss.
  2. Push terminal nodes with zero dependents to the FIFO worklist.
  3. Pop node, evaluate Vector-Jacobian Product (VJP), accumulate gradients to parents.
  4. Decrement parent in-degree; push parent once in-degree reaches zero.