3.5.2 · D5Sequence Models

Question bank — Backpropagation through time

1,352 words6 min readBack to topic

True or false — justify

The recurrent weight has one gradient per time step that you keep separate.
False. is shared across all steps, so you sum the per-step contributions into a single gradient .
Unrolling an RNN over steps turns it into a feedforward net whose layers have independent weights.
False. The unrolled layers all reuse the same , — that shared weight is exactly why gradients must be summed rather than treated separately.
In BPTT the gradient at step depends only on the loss produced at that step.
False. has two sources: the local loss and the future loss carried back through : .
The backward pass can be run left-to-right at the same time as the forward pass.
False. needs , which needs future hidden states. You must finish the forward pass, then sweep backward from down to .
The Jacobian equals alone.
False. It is — the derivative multiplies element-by-element before . Dropping it ignores the nonlinearity.
For a sequence of length , BPTT stores all hidden states in memory during the forward pass.
True. Each (and the pre-activations) is needed in the backward pass to compute local gradients, so memory grows linearly with — motivating truncated BPTT on long sequences.
(input weights) also needs its gradient summed over all time steps.
True. Like , is reused every step, so — same summation logic.
The factor can never make a gradient vanish because it is always positive.
Half-true, and dangerous. It is in , so positive — but values well below 1 multiply across many steps and shrink the product, one root cause of vanishing gradients.

Spot the error

A student writes . What is missing?
The factor. It must be is post-activation, so you still have to pass through the derivative to reach the pre-activation where lives.
Someone claims the local gradient at step multiplies by (the current hidden state). Correct partner?
Wrong state — it multiplies by , the incoming hidden state, because , so .
In the backward recursion a student uses (not transposed): . Fix?
Use . Forward multiplies by ; the backward (adjoint) direction transposes it, so gradients flow through .
A note says " is the gradient of w.r.t. at step 2." Diagnose.
That is only . To get the weight gradient you still multiply by and by : .
A learner applies the chain rule but forgets the direct effect of on , keeping only the path through . Consequence?
The gradient is under-counted. has a direct term (this step) plus the indirect term through ; dropping the direct term loses this step's own contribution.
Someone computes as the true value in Worked Example 1 ( instead of ). Likely cause?
They omitted the factor. Since it was near here, dropping it roughly doubled the result — the classic BPTT bug.

Why questions

Why do we sum over time instead of averaging or taking the last step?
Because the same parameter influences the loss at every step; the total derivative is the sum of all these separate influences (multivariate chain rule), not one representative.
Why is "backpropagation through time" the same algorithm as ordinary backpropagation, not a new one?
Once you unroll the RNN, it is a deep feedforward graph; you run standard backprop on it. The only twist is weight sharing forces the gradient summation.
Why does the Jacobian use a diagonal matrix for the term?
acts elementwise — output component depends only on input component — so its derivative is a diagonal matrix, with no cross-terms between hidden units.
Why does a long sequence make gradients tend to vanish or explode?
The backward chain multiplies once per step; over many steps this repeated product shrinks toward zero (spectral norm ) or blows up (), the vanishing/exploding problem.
Why do LSTMs and GRUs help BPTT compared to a plain RNN?
They add a gated, near-additive memory path so the backward product stays near 1 across steps, avoiding the repeated shrinking factors that kill vanilla-RNN gradients.
Why is called the pre-activation gradient?
Because it is — the gradient at the linear sum before the — obtained by pushing the post-activation back through the derivative.

Edge cases

What happens to the gradient contribution at when ?
It vanishes: the step-1 term is . With a zero initial state the first step contributes nothing to .
If a hidden unit saturates so , what does do to its gradient?
It approaches , so that unit's gradient is squeezed to near zero — the neuron stops learning ("dead" saturated ), a local cause of vanishing gradients.
For the very last step , why is there no future term in ?
There is no or , so the recursion has no future contribution: alone. It is the base case of the backward sweep.
If the output uses identity () instead of a layer, does BPTT change?
Only the local term simplifies (no extra factor). The recurrence through time and the weight-summation are unchanged.
For a length-1 sequence (), does BPTT reduce to ordinary backprop?
Yes. With one step there is no time chain — and — identical to a single-layer feedforward backprop.
In a bidirectional RNN, is there one backward sweep or two?
Two independent BPTT sweeps — one for the forward-direction chain and one for the backward-direction chain — since each direction has its own hidden states and shared weights.
Recall Quick self-test

Name the two sources that feed . ::: The local loss and the future gradient . Which hidden state multiplies the gradient at step ? ::: (the incoming one). What single factor turns into ? ::: , the derivative.