# Backpropagation reference

Run `python examples/backprop.py`, or add `--json` for the forward/reverse/finite-difference payload. Python 3.10+; standard library only.

Source: Rumelhart, Hinton and Williams, _Learning representations by back-propagating errors_, Nature 323, 533–536 (1986), Equations 1–8. The canonical regions are `forward`, `output`, and `reverse`. The paper uses x for preactivation; the reference uses z to distinguish it from the network input.

An authored 2→2→2 sigmoid network has twelve supplied parameters: W1 (2×2 row-major), b1 (2), W2 (2×2 row-major), b2 (2). Loss is ½ sum of squared errors for one case, without a mean-over-output factor. Both output paths contribute to each hidden derivative. Parameters are updated only after all derivatives are computed.

The example checks all twelve analytic derivatives against central differences and checks one small gradient-descent step. It does not reproduce the paper's mirror-symmetry or family-tree experiments, train a model, save a checkpoint, or measure performance. No autodiff package is used.

Run `node --test test/backprop.test.mjs` for JS/Python parity, finite differences at multiple inputs/targets, zero and saturated boundaries, path-sum invariants and local descent. Source images and PDF hashes are recorded in `public/images/papers/backpropagation/source-crops.json`.
