Before you can read the parent note, you must be able to read its alphabet. Below is every symbol and idea the parent uses, built from nothing, each one leaning on the ones before it.
A sequence is just an ordered list of things, one after another, where the order carries meaning.
The picture: beads on a string. The first bead, the second bead, and so on. Swap two beads and you get a different string — order matters.
Why the topic needs it: language, audio, and time series are all sequences. If order didn't matter we could just throw everything in a bag and use an ordinary network.
Look at the blue beads on the top row: they are labelled x1,x2,x3. That subscript number is the position t.
The picture: t is your finger pointing at one bead; L is how many beads there are in total.
Why needed: the parent writes things like L1,L2,…,LB — those are the lengths of the 1st, 2nd, ... sequence. Different sequences have different L, and that difference is the whole problem.
The picture: a stack of index cards, each card one sentence. B = number of cards in the stack.
Why needed: hardware (GPUs) is fast when it does the same operation to many items at once. The parent's Lbatch=B1∑i=1BLi just says "average the loss over all B cards in the stack". (See Batch Processing.)
The picture: a brick wall where every row must be the same width — no jagged edges allowed.
Why needed: this is the villain of the whole topic. Sequences have different lengths (jagged), but a tensor demands equal lengths (rectangular). That clash is exactly what padding fixes.
The left picture (jagged) is what real data looks like. The right picture (rectangular) is what the computer demands. The grey cells are the fix — see the next section.
The picture: a stencil laid over the batch. Holes (1s) let real data through; blocked spots (0s) hide the fake padding.
Why needed: whenever we compute something (a loss, an attention score), we multiply by the mask so padding contributes zero. It's the memory of "which parts were fake".
Read mi(t) from the picture: row i is all 1s up to its true length Li, then all 0s. The green region is real, the dark region is padding.
The picture: a conveyor belt. t starts at 1, steps to 2, 3, ... up to Lmax; at each stop you drop the value at into a total.
Why needed: the parent's masked loss sums over all positions. Multiplying by mi(t) inside the sum means the padding positions add 0, so only real positions count.
The picture: reading a book and keeping a mental summary that you update after each word. ht = your summary after word t; ht−1 = your summary just before it.
Why needed: a sequence model must remember earlier elements to understand later ones. The parent's update ht=tanh(Whhht−1+Wxhxt+bh) says "new memory = blend of (old memory) and (new input)". See Recurrent Neural Networks and LSTM and GRU.
The picture: an arrow pointing somewhere in space; d is how many directions (axes) that space has. q∈Rdk means "q is an arrow with dk numbers".
The picture: two flashlight beams. Pointing the same way → strong overlap (large dot product); at right angles → no overlap (zero).
Why needed: attention uses qTkj to ask "how well does what I'm looking for (query) match what's here (key)?" See Attention Mechanism and Transformers.
Everything on the left builds the padding + mask machinery; the middle builds the RNN; the right builds attention. All three converge on the parent topic: Handling variable-length sequences.