Forward hidden state |h_t| Backward gradient |dL/dh_t| Current backward step
drag to pan · scroll to zoom

Vanishing Gradients in RNN Backpropagation Through Time (2D)

Sequence models learn by pushing an error signal backward through every unrolled time step of a recurrent network, and each step multiplies that signal by the same local Jacobian — the recurrent weight times the activation's derivative. This 2D chart runs a real scalar RNN forward, then animates the backward pass step by step: a row of bars tracks the forward hidden-state magnitude while a second row tracks the live gradient magnitude, shrinking toward the vanishing regime or blowing up toward the exploding one depending on the recurrent weight and activation function you choose. Drag to pan across the sequence and scroll to zoom in on any window of time steps. Live readouts report the current step's gradient, the gradient that finally reaches the earliest time step, and how many steps the signal survives above a 10⁻³ threshold — the same exponential mechanism that motivated gated architectures like LSTM and GRU.