01The hidden state: memory as a recurrence
An RNN processes a sequence one element at a time, maintaining a hidden state vector that is updated at each step: hₜ = tanh(W_hh·hₜ₋₁ + W_xh·xₜ + b). The new state is a function of the previous state and the current input, so in principle it summarises everything seen so far.
Crucially, the same weight matrices are used at every timestep. That's parameter sharing across time, exactly analogous to a CNN's sharing across space, and it's what lets a single small model process sequences of any length.
That flexibility gives the classic RNN configurations: one-to-many (image → caption), many-to-one (review → sentiment), many-to-many aligned (per-token tagging), and many-to-many via encoder-decoder (translation, where input and output lengths differ).