Proposition 2I.10.P0234 of 100 in the corpus
A gate slows the decay of a distant gradient; it does not abolish it.
The carry line is one path among many. Its own factor is a product of forget values, which still decays geometrically. The other paths bring the recurrent weights back, and can shrink the signal or amplify it.
The state is a pair
The LSTM’s state at step is the pair . A perturbation of either changes the next step, so the one-step Jacobian has four blocks. Differentiate (I.10.1) and (I.10.2) with and :
Only the top-left block is free of recurrent weights.
The rows are and ; the columns are and . The top-left block is the carry line of (I.10.3). The block collects the three ways the preceding hidden state reaches the cell: through the forget gate, the input gate and the candidate. The bottom row passes the cell through the output nonlinearity and adds the output gate’s own dependence on .
Now multiply and read the top-left block, which is . Expanding the product of block matrices gives a sum over paths, one block chosen per step. The path that stays in the top-left block at every step contributes . Any other path leaves the cell row at some step. Since it must end on the cell row, it has to return, and the only block from the hidden state to the cell is some . Every other term therefore contains at least one recurrent matrix. That proves I.10.T1.
The theorem guarantees that a weight-free path exists. It does not say that path dominates. When the gates and candidate are saturated, the factors , and are small, is small, and the carry line carries most of the signal. That is the regime the 1997 truncation assumed. Away from it, the other paths can be as large as the carry line or larger.
The carry line still multiplies
Even on its own, the carry line is a product. Suppose a coordinate’s forget value is the same number at every step. After steps its factor is . Define the memory horizon , the number of steps over which the factor falls by .
Apply , with equality only at , at and at . The first gives ; the second gives . Inverting,
A forget value sets a horizon within one step of 1/(1−f); a bias sets the forget value.
The second line uses . With the right-hand side is exactly . That proves I.10.T2.
The figure plots for , and over a thousand steps. The first is gone below before step ninety. The second keeps of its signal after a hundred steps and after a thousand. The third reaches near the right-hand edge. Each curve is still a straight line on the logarithmic scale: the decay is geometric, as in I.9. What changed is the rate. It is a learned quantity, set coordinate by coordinate, which can sit close to one without asking a weight matrix to have norm close to one and without asking any unit to stay unsaturated. I.10.B03 works the limit.
Where the forget bias starts
At initialisation the weights are small, so a forget gate’s value is close to . A zero bias gives : a horizon of steps, which forgets almost everything before training has started. A bias of one gives and .
Jozefowicz, Zaremba and Sutskever found that adding a bias of one to the
forget gate closed the gap they had measured between the LSTM and the GRU.
Keras adds one to the forget bias by default through unit_forget_bias.
PyTorch does not: it draws every weight and bias uniformly from
, and its two bias vectors both have a forget slice,
so the effective bias is their sum
(I.10.X02).
Tallec and Ollivier went further. Their chrono initialisation sets with drawn uniformly between and , and . By (I.10.5) the initial horizons then range from two steps to the longest dependency expected, and makes each cell coordinate an exponential moving average of its candidates (I.10.X08). All of these choices set where training starts, not where it ends.
Growth is still possible
The other paths of (I.10.4) can amplify. Take a scalar cell whose gates are constants, and , and whose candidate reads the hidden state through a weight of two. Then is a function of alone, and each step’s total factor is . Along the trajectory of I.10.B02 the factors are and , so . The carry line alone contributes . More than half the derivative came from paths through , and the total exceeds one although every forget value is three quarters.
The same mechanism can make a small perturbation grow. In I.10.X09 a cell with forget value one half amplifies a perturbation of the zero state by per step. Gating changes which paths exist; it does not bound their sum. Gradient norm clipping, (I.9.7), remains a standard part of training gated networks.
The cell value itself is not bounded by a squashing function. Since , each coordinate satisfies . If every forget value is at most , summing the geometric series gives
and with the bound is . That is the LSTM half of I.10.T3, and the reason for the forget gate. A large cell value also saturates , which makes small: the gradient from the output into the cell vanishes while the carry line remains open.
Backward through one cell
Write for the total derivative of the loss with respect to , including the local readout and everything returned from step , and for the total derivative with respect to . Then
The cell's gradient adds what it showed at this step to what it carried forward.
with . Each is the derivative with respect to a gate’s pre-activation. The hidden state one step back receives over the four blocks, plus its own readout term; the cell one step back receives . Shared weights accumulate exactly as in (I.9.4): , and likewise for with .
The first line of (I.10.6) is the carry line in the backward direction: the future’s cell gradient arrives multiplied by a forget value, with no matrix in between. I.10.B02 derives every line, and its script checks all twelve parameter blocks and both initial states of a two-unit cell against finite differences.
Reproduce the horizons
from math import log
for f in (0.9, 0.99, 0.999):
horizon = -1/log(f)
print(f"{f}: f^100 = {f**100:.6f}, horizon {horizon:.3f},"
f" bounds {f/(1-f):.1f} to {1/(1-f):.1f}")
It prints horizons , and , each just under , with hundred-step factors , and .
Sources
Depends on
Used by
Nothing yet.
Problems using this
- I.10.B02 — Backpropagation through one LSTM cellsymbolic▲▲▲
- I.10.B03 — How long a forget gate rememberslimit▲▲△
- I.10.X01 — A saturated gate still leakslimit▲△△
- I.10.X02 — Which slice is the forget gate?shape▲△△
- I.10.X03 — No forget gate, no boundnumeric▲▲△
- I.10.X08 — Chrono initialisationsymbolic▲▲△
- I.10.X09 — A forget gate of one half can still amplifycounterexample▲▲△
- I.BOOK.B02 — Three ways a gradient crosses many stepslimit▲▲△