5.6.12 · D1Machine Learning (Aerospace Applications)

Foundations — Recurrent neural networks — hidden state, BPTT

2,593 words12 min readBack to topic

This page is the toolbox. Before you can read the parent note (RNN — hidden state & BPTT) you need to own every symbol it throws at you. We build each one from zero: plain words → a picture → why the topic needs it. Nothing is used before it is defined.


0. The characters, in reading order

We meet the symbols in the exact order the parent note uses them, so each rests on the last.


1. A subscript with time: , ,

Think of a filmstrip: each frame is one .

Figure — Recurrent neural networks — hidden state, BPTT
  • = the input at step — the thing the network reads right now (e.g. this second's sensor reading). It is a bundle of numbers; the precise word for "a bundle of numbers," and the notation for how many, come next in Section 2.
  • = the hidden state at step — the memory note after reading .

Why does the topic need specifically? Because the answer to "what will happen next?" depends on the history, not just the current frame. is where that history is compressed into a fixed-size summary.


2. Vectors and

Figure — Recurrent neural networks — hidden state, BPTT

Now we can be precise about Section 1: is a vector too (say , inputs per step), and is a -slot memory vector.

Why does the topic need this? The memory note isn't one number — it's a bundle of features ("airspeed trend", "attitude drift", ...). Storing numbers lets the state remember several things at once. The picture: a small stack of dials, each dial one component of the vector.

Building block — the humble arrow view first appears in Feed-forward Neural Networks, where every layer's activation is such a vector.


3. The output vector and the initial state

Why the topic needs : the loss compares to a target, so is the thing that gets judged. Without naming it there is nothing to be "wrong," and no gradient to send back.

Figure — Recurrent neural networks — hidden state, BPTT

Why the topic needs it: in the parent's worked example is plugged straight into . Every recurrence needs a seed; is that seed.


4. Weights, matrices and the subscripts

The double-letter subscript is a from→to label, read right-to-left in the product:

Figure — Recurrent neural networks — hidden state, BPTT

Why does the topic need three separate matrices? Because three different journeys happen at each step: the old memory must be reshaped, the new input must be folded in, and the memory must be turned into the output . Each journey gets its own tunable grid. The picture: three arrows arriving at the memory dial-stack, each arrow a matrix.

Matrix–vector multiplication is the workhorse of Feed-forward Neural Networks; here the same grids reappear at every step (Section 7).


5. Biases , and the pre-activation

Why the topic needs the name: in the derivation we differentiate "through " and "through the linear part" separately. Naming the boundary point makes those two steps readable.


6. The squashing function , its slope — and why this one

Figure — Recurrent neural networks — hidden state, BPTT

You do not need to compute by hand — recognise the S-curve, and remember: forward uses , backward uses .

The reason the slope matters for training is Vanishing and Exploding Gradients: it controls how signal shrinks going backward (Section 9).


7. Weight sharing — the same every step

Why the topic needs it: aerospace signals have no fixed length, and the laws of motion don't change between second 3 and second 4. Sharing bakes that fact in as a built-in assumption (a "prior"). This idea is what makes an RNN different from just stacking many Feed-forward Neural Networks layers with separate weights.


8. The gradient symbol and the chain rule

Why the topic needs it: the whole of Section 3 in the parent is one long, careful application of these two facts. Everything else is bookkeeping. This machinery is developed for plain nets in Backpropagation.


9. Two small pieces of matrix shorthand: , , and

Why the topic needs these: the backward formulas are literally "-slope signal, then push through ." Recognising the three symbols makes the boxed BPTT equations readable at a glance.


10. Putting the vocabulary together

Now every symbol in the update rule is earned: Read it aloud: "mix the old memory and the new input with two grids, add a shift, squash to keep it bounded — that's the new memory; then read the prediction off it." Every word links to a section above.


Prerequisite map

Vectors and R to the d

Weight matrices Wxh Whh Why

Hidden state h at time t

Output y at time t

Time index t and sequence length T

Initial state h0

Pre-activation a at time t

Biases bh and by

tanh squashing

Weight sharing same W every step

RNN update rule

Partial derivative and chain rule

BPTT

tanh slope 1 minus h squared

Hadamard diag transpose

Vanishing exploding gradients

RNN topic 5.6.12

Related destinations once you own these: LSTM and GRU, Time Series Forecasting, Sequence Modeling in Flight Data, and the classical cousin Kalman Filter.


Equipment checklist

Cover the right side and answer out loud before opening the parent note.

What does the subscript mean, and what is ?
counts which step of the sequence you're on; is the total number of steps (sequence length).
What does say in plain words?
The hidden state at step is a list (vector) of real numbers — the memory summary so far.
What is , and what produces it?
The prediction at step , a vector in , read off the memory via .
What is and how is it usually set?
The initial hidden state (the seed the recurrence needs at ); usually the zero vector, sometimes learned.
Decode the subscripts in , , .
from→to grids: memory→memory, input→memory, memory→output.
What are and ?
The hidden bias (, added inside ) and the output bias (, added to form ).
What does a matrix–vector product do geometrically?
Transforms/reshapes vector into a new vector, each output slot a weighted mix of all inputs.
Why is chosen over sigmoid or nothing?
It bounds each state component to so recirculating memory can't blow up, and it's centred at 0 for healthier gradients.
What is and its handy identity?
The slope of the curve; , i.e. when .
What is the pre-activation and why name it?
The raw sum before ; naming it gives the chain rule a clean handle.
State weight sharing in one sentence.
The same weight matrices are reused at every time step, allowing any-length sequences and encoding time-invariance.
What does measure?
How much the total loss changes when you nudge the single knob a tiny bit.
When a weight feeds several paths, what does the chain rule do with them?
It ADDS the contribution from every path — the reason BPTT sums a shared weight's gradient over all steps.
What does do, and how does relate?
Slot-by-slot multiply; is the matrix form that produces the same scaling.
Why does (transpose) appear in the backward pass?
Gradients flow backward through a linear layer by multiplying by the matrix's transpose.