3.5.1 · D5Sequence Models
Question bank — Recurrent Neural Networks (RNN) architecture
This page is a misconception hunt. Every item below is a place where students of RNN architecture reliably slip. Read each prompt, commit to an answer out loud, THEN reveal. If your reasoning matched the justification, great — if only your verdict matched but your reason didn't, that's a trap you nearly fell into.
Before we start, one shared vocabulary reminder so no symbol is used unexplained:
Recall What each symbol means (tap to expand)
- — the input vector fed in at time step (one word, one character, one frame).
- — the hidden state: the network's "memory so far", a vector carried forward.
- — the output produced at step .
- — the three weight matrices (input→hidden, hidden→hidden, hidden→output). The same three are reused at every step.
- — the squashing function that keeps inside .
- — the length of the sequence.
True or false — justify
TF1. "An RNN has a separate set of weights for each time step."
False. The same are shared across all steps; that weight-sharing is exactly what lets one network handle sequences of any length with a fixed parameter count.
TF2. "Because weights are shared, an RNN cannot behave differently at step 1 versus step 50."
False. The weights are fixed but changes every step, so the same function produces different outputs — the memory, not the weights, carries the position-specific behaviour.
TF3. "The hidden state and the output are always the same thing."
False. is a separate linear projection, so the output dimension can differ from the hidden dimension , and the hidden state can stay richer than what is exposed.
TF4. "An RNN is a feedforward network — it just has more layers."
Partly, but the key difference is weight-tying. When you unfold it, it looks like a deep feedforward net, but every "layer" reuses identical weights and each layer also receives a fresh external input ; a plain deep net has independent weights per layer and one input.
TF5. "Using instead of sigmoid completely solves the vanishing gradient problem."
False. is zero-centered and has slightly healthier gradients, but its derivative is still , so long products of Jacobians still shrink. Solving vanishing gradients properly needs gated cells like LSTM or GRU.
TF6. "If the gradients will vanish."
False — it's the opposite. Repeated multiplication by a matrix with spectral norm above 1 makes gradients explode; norm below 1 makes them vanish. See Vanishing and Exploding Gradients.
TF7. "For a many-to-one classifier you must produce an output at every time step."
False. You compute every hidden state but only read out the final as the summary; intermediate outputs are simply not used for the loss.
TF8. "RNNs process a whole sequence in parallel like a fully-connected layer."
False. The recurrence makes step depend on step , so computation is inherently sequential — this is exactly what Transformers later remove with attention.
TF9. "Cross-entropy is the only valid loss for an RNN."
False. Cross-entropy suits classification/next-token prediction; regression targets use MSE. The loss just sums per-step contributions .
TF10. "One-hot inputs and word embeddings are interchangeable with no downstream effect."
False. One-hot vectors are sparse and orthogonal (no similarity notion); embeddings place similar words nearby, so the RNN starts from a far richer representation.
Spot the error
SE1. "I carried the last hidden state of training example A into example B as , so the net learns cross-example links."
Error: distinct training examples are independent; carrying state invents correlations that don't exist. Reset (or a learned init) at each new sequence.
SE2. "My BPTT gradient for only uses at the same step ."
Error: depends on , so the gradient must sum contributions back to through . Ignoring them drops all long-range learning. See Backpropagation Through Time (BPTT).
SE3. "To stop exploding gradients I lowered the learning rate a lot."
Error: a small learning rate hides the symptom but the gradient direction is still corrupted by huge magnitudes. The right tool is Gradient Clipping, which rescales the gradient vector while keeping its direction.
SE4. "I used a different at each time step to give the model more capacity."
Error: that breaks weight-sharing — parameters now scale with sequence length, generalization across positions is lost, and variable-length sequences become impossible.
SE5. "For sentiment analysis I applied softmax over the whole hidden-state vector to get the class."
Error: isn't a probability distribution over classes. You must first project it, e.g. , then interpret; softmaxing raw hidden units is meaningless.
SE6. "The recurrent matrix is ."
Error: maps hidden→hidden, so it is . The one that touches the input dimension is .
SE8. "I forgot the bias , but that's fine since anyway."
Error: without the pre-activation is forced through the origin, removing the network's ability to shift the activation threshold — a real loss of expressive power, not a harmless simplification.
Why questions
WHY1. Why is the same weight matrix reused at every time step instead of one per step?
So the model has a fixed parameter count independent of sequence length, and any pattern learned at one position transfers to all others — encoding the prior "the rules of the sequence don't change over time."
WHY2. Why does appear rather than a raw linear combination?
A pure linear recurrence would collapse to a single linear map no matter how many steps; the non-linearity lets the network represent complex, non-linear temporal patterns.
WHY3. Why do vanishing/exploding gradients arise specifically in RNNs and not obviously in shallow feedforward nets?
Because is a product of Jacobians ; repeated multiplication drives the magnitude toward or exponentially in the gap length.
WHY4. Why does this gradient problem cap vanilla RNN memory at roughly ten steps?
Once the Jacobian product has shrunk below numerical relevance, gradients from distant steps stop influencing the weights, so dependencies beyond that horizon simply can't be learned.
WHY5. Why prefer taking only for classification instead of averaging all ?
The final state has "read" the entire sequence and can act as a running summary; averaging is a valid alternative but the final-state design assumes the recurrence already accumulates the needed information.
WHY6. Why is computed as a separate projection rather than reusing directly?
To decouple the internal memory size from the required output size , letting the hidden state stay high-dimensional and rich while the output matches the task.
WHY7. Why is BPTT called through time rather than just backpropagation?
Because the network is unfolded across time steps and the error signal is propagated backward along the temporal chain of hidden states, not merely through stacked spatial layers.
WHY8. Why does gradient clipping fix explosion but not vanishing?
Clipping only caps large gradients; it cannot amplify a gradient that has already decayed to near zero. Vanishing needs architectural fixes (gates) instead.
Edge cases
EC1. What is at the very first step, and why?
Conventionally (or a learned vector) because there is no prior context; the first hidden state then depends on the input alone.
EC2. What happens if you feed a sequence of length ?
The recurrent term contributes nothing (with ), so the RNN degenerates into an ordinary feedforward layer on that single input.
EC3. What if two sequences in a batch have different lengths?
You typically pad to a common length and mask the padded positions out of the loss, so pad tokens don't contribute gradients — otherwise the model learns from meaningless filler.
EC4. In a one-to-many generator, where does the single input enter if there's only one ?
It initializes (or is fed at step 1); subsequent steps run autoregressively, feeding each generated output back in as the next input.
EC5. If were exactly the zero matrix, how would the RNN behave?
Memory is severed — depends only on the current input, making it a memoryless per-step feedforward net with no sequence modelling at all.
EC6. What does an all-ones input (or constant repeated token) reveal about the network?
The hidden state still evolves because each step re-applies to the previous state, so even identical inputs can produce changing outputs — the memory dynamics, not the input, drive the change.
EC7. What is the largest and smallest possible value of any component of , and why does that bound matter?
Strictly between and because of ; this bounded range is what keeps activations from blowing up forward, even though it does not by itself fix gradient vanishing backward.
Recall Fast self-test before moving on
Can you, without looking, state (a) which weight matrix is , (b) which condition on causes explosion, (c) why is zeroed between examples, and (d) which tool fixes exploding but not vanishing gradients? Answers: (a) , (b) , (c) examples are independent, (d) gradient clipping.