Md. Asif Uddin

    Proposition 2I.9.P0231 of 100 in the corpus

    Backpropagation through time accumulates shared gradients through a product of temporal Jacobians.

    The recurrent matrix is shared, but each activation changes its local derivative. Long products can attenuate or amplify the backward signal; their norms and directions both matter.

    Constant scalar Jacobian factors over sixteen stepsThree curves show r to the power k, from zero through sixteen steps. On a logarithmic vertical scale, a fixed factor 0.7 decays, 1 stays constant, and 1.3 grows. All curves are shown without clipping. Varying factors and matrix Jacobians require the product analysis in the text.constant scalar factors · magnitude rᵏ0.0010.010.111010010000481216steps back, kr = 0.7r = 1.0r = 1.3
    Fig. 2 — Type G · Failure — Constant scalar Jacobian factors over sixteen steps, on a logarithmic scale. These examples isolate decay and growth; varying factors and matrices also depend on their order and direction.

    Start at the loss, not at a product sign

    Use the tanh cell of (I.9.1) and the summed loss of (I.9.2). Write et=∂ℓt/∂zt\vec e_t=\partial\ell_t/\partial\vec z_t and δt=∂L/∂at\vec\delta_t=\partial\mathcal L/\partial\vec a_t. If position tt has no local loss, set et=0\vec e_t=0.

    Two arrows leave ht\vec h_t: one to its readout, one to the next recurrent step. Reverse mode adds both returns. Since tanh⁡′(a)=1−tanh⁡2(a)\tanh'(a)=1-\tanh^2(a),

    qt=VTet+WTδt+1,δt=qt⊙(1−ht2),δT+1=0.\begin{aligned} \vec q_t&=\mat V^{\mathsf T}\vec e_t+ \mat W^{\mathsf T}\vec\delta_{t+1},\\ \vec\delta_t&=\vec q_t\odot(1-\vec h_t^2),\\ \vec\delta_{T+1}&=0. \end{aligned}
    (I.9.3)

    The current loss and the future loss meet before the activation derivative.

    Squares and ⊙\odot are coordinatewise. The backward sweep evaluates (I.9.3) from TT down to 11. A mean loss or a fixed padding mask is already included in the definition of et\vec e_t; do not average the gradients a second time.

    At one cell, a perturbation of W\mat W produces dat=dW ht−1d\vec a_t=d\mat W\,\vec h_{t-1}. The local contribution is the outer product δtht−1T\vec\delta_t\vec h_{t-1}^{\mathsf T}. Because all cells use the same matrix,

    ∇WL=∑tδtht−1T,∇UL=∑tδtxtT,∇bL=∑tδt.\begin{aligned} \nabla_{\mat W}\mathcal L &=\sum_t\vec\delta_t\vec h_{t-1}^{\mathsf T},\\ \nabla_{\mat U}\mathcal L &=\sum_t\vec\delta_t\vec x_t^{\mathsf T},\\ \nabla_{\vec b}\mathcal L&=\sum_t\vec\delta_t. \end{aligned}
    (I.9.4)

    Each occurrence contributes to one shared parameter gradient.

    The readout derivatives are ∇VL=∑tethtT\nabla_{\mat V}\mathcal L=\sum_t\vec e_t\vec h_t^{\mathsf T} and ∇cL=∑tet\nabla_{\vec c}\mathcal L=\sum_t\vec e_t. The input derivative is UTδt\mat U^{\mathsf T}\vec\delta_t. For a learned initial state, its derivative is WTδ1\mat W^{\mathsf T}\vec\delta_1. Regularisation would add another term to the parameter gradients.

    Equations (I.9.3) and (I.9.4) prove I.9.T1. There is no extra learning rule peculiar to time. There is a graph, reused parameters, and the chain rule. I.9.B02 works every scalar contribution by hand.

    Now isolate a distant loss

    Let At\mat A_t be the state-to-state Jacobian, holding inputs fixed:

    At=diag⁡(1−ht2)W,∂hT∂hs=ATAT−1⋯As+1.\begin{aligned} \mat A_t&=\operatorname{diag}(1-\vec h_t^2)\mat W,\\ \frac{\partial\vec h_T}{\partial\vec h_s} &=\mat A_T\mat A_{T-1}\cdots\mat A_{s+1}. \end{aligned}
    (I.9.5)

    The earliest Jacobian acts first, on the right of the forward product.

    For a loss only at TT, the column gradient at ss is the transpose of the product in (I.9.5) times ∇hTℓT\nabla_{\vec h_T}\ell_T. For losses at many positions, add the contribution of each later loss. A locally supervised position can therefore receive a useful gradient even when a much later loss has almost no influence on it.

    The weights repeat. The Jacobians generally do not: their diagonal activation factors depend on the actual inputs and states.

    By applying ∥AB∥2≤∥A∥2∥B∥2\|AB\|_2\leq\|A\|_2\|B\|_2 repeatedly,

    ∥∂hT∂hs∥2≤∏k=s+1T∥Ak∥2,∥Ak∥2≤r for all k  ⟹  ∥∂hT∂hs∥2≤rT−s.\begin{aligned} \left\|\frac{\partial\vec h_T}{\partial\vec h_s}\right\|_2 &\leq\prod_{k=s+1}^T\|\mat A_k\|_2,\\ \|\mat A_k\|_2\leq r\ \text{for all }k &\implies \left\|\frac{\partial\vec h_T}{\partial\vec h_s}\right\|_2 \leq r^{T-s}. \end{aligned}
    (I.9.6)

    A uniform bound below one proves contraction; a bound above one does not prove explosion.

    This proves I.9.T2. Since the tanh derivative is at most one, ∥W∥2<1\|\mat W\|_2<1 is a sufficient uniform contraction condition for this cell. It is not necessary: saturation may contract a trajectory even with a larger weight norm.

    The figure shows a deliberately scalar special case with a constant multiplier. Across thirty steps, 0.730≈2.2539×10−50.7^{30}\approx2.2539\times10^{-5} and 1.330≈2.6200×1031.3^{30}\approx2.6200\times10^3. The first is small, not numerically identical to zero. Whether it is useful depends on the other gradients, numerical precision and optimiser.

    A matrix needs more care than a scalar. Large singular values indicate directions of amplification, but the next matrix may contract those directions. Even eigenvalues strictly inside the unit circle do not exclude large finite-time amplification for a non-normal matrix. I.9.B03 constructs one. And alternating scalar factors 22 and 1/21/2 have a unit product every two steps, despite neither factor being one.

    What clipping repairs

    For a finite concatenated parameter gradient g\vec g and threshold τ>0\tau>0,

    gclip=gmin⁡(1,τ∥g∥2).\vec g_{\mathrm{clip}} =\vec g\min\left(1,\frac{\tau}{\|\vec g\|_2}\right).
    (I.9.7)

    One common scale factor preserves the direction across all parameter tensors.

    Define the zero-gradient case separately as zero. Equation (I.9.7) bounds the norm by τ\tau. With plain gradient descent, the update norm is at most ητ\eta\tau. That does not directly bound an Adam update or a step containing momentum, weight decay or other terms.

    Accumulate the intended gradient first, then clip, then apply the optimiser. Clipping each time step separately changes the sum. Clipping each tensor separately changes the direction of the concatenated gradient. I.9.X07 makes the difference numerical.

    Clipping can control a finite oversized gradient. It cannot reconstruct information that already vanished, and it cannot make a non-finite computation reliable. A NaN needs a diagnosis, not a smaller threshold.

    Truncation changes credit assignment

    Full backpropagation retains the whole unrolled dependency. Truncated backpropagation detaches a carried state at a chunk boundary: the next chunk receives the same value, but treats it as a constant for that backward pass.

    That omits cross-boundary derivatives. The forward model may still remember earlier inputs, but a later loss cannot teach the detached earlier computations what to retain across that boundary. The truncated gradient is generally not the full-sequence gradient.

    In I.9.B05, the prediction stays 2.52.5 and the loss stays 1.1251.125, while a one-step truncation changes ∂L/∂w\partial\mathcal L/\partial w from 99 to 7.57.5. For a finite-difference check of the truncated computation, freeze the boundary state. Recomputing it under every parameter perturbation checks the full graph instead.

    A practical chunk loop starts with the correct stream’s state, runs the chunk, computes the valid-position loss, backpropagates, clips if required, and updates the parameters. Before the next chunk, detach the state; when the stream ends, reset it. If weights change between chunks, the carried value was computed with earlier weights. That is part of this training procedure, not exact full-sequence differentiation at one fixed parameter setting.

    A different cell is a different path

    LSTMs and GRUs learn gates controlling what to retain and replace. For the modern LSTM carry expression ct=ft⊙ct−1+it⊙c~tc_t=f_t\odot c_{t-1}+i_t\odot\tilde c_t, holding the gate and candidate values fixed leaves a direct derivative diag⁡(ft)\operatorname{diag}(f_t). The total derivative can also include paths through those values.

    This direct path explains the motivation, not a promise of perfect memory: forget factors below one can still attenuate information. Chapter I.10 owns the gate equations and their full backward pass. Here the requirement is to understand the failure they were designed to address.

    Sources