Circuit Model — Nodes, Wires, Functions
To formalize backpropagation, we model computation as a circuit. Data enters on the left as input wires (collected as vector ). Values flow left to right. The circuit has a single output wire, and the whole thing computes .
A function node takes one or more input wires, applies some scalar function, and outputs a single wire. For example, , or , or . Each node is named after its output wire (so the node and its output wire share the same name).
A splitter node copies one input wire into two identical output wires. This is needed whenever a value is used in multiple downstream computations. The splitter for input with outputs behaves as .
Notice that every function node outputs exactly one scalar. The circuit as a whole also outputs a single scalar .
Formal View
Why This Matters
Any differentiable computation — loss functions, solvers, renderers — can be expressed as such a circuit, making backprop universally applicable.
- Neural network layers (linear transform + activation function) as function nodes
- Differentiable physics simulators expressed as large circuits
- PyTorch and JAX internally represent computations as circuit DAGs
- Compiler optimizations that exploit DAG structure
Learning Resources
What is backpropagation really doing?
3Blue1Brown
Builds up the circuit view of a neural network computation graph.
The spelled-out intro to neural networks and backpropagation: building micrograd
Andrej Karpathy
Implements function nodes as Python objects with stored values and backward methods.
Quiz
What does a splitter node do?
A function node can produce multiple output values.
If feeds into two different downstream nodes, the circuit must contain:
Node computes . What type of node is this?
Common Mistakes
- Forgetting splitter nodes when a value feeds multiple places — every fan-out requires one.
- Thinking function nodes can return vectors — each outputs exactly one scalar in this model.
- Confusing the circuit diagram (computation structure) with the graph of (input-output shape).