4.1.1 · D1Transformer Architecture

Foundations — Limitations of RNNs motivating transformers

2,163 words10 min readBack to topic

Before you can understand why Recurrent Neural Networks (RNNs) struggle, you need to be fluent in the symbols the parent note throws at you. This page builds each one from nothing — plain words first, a picture second, and a reason it matters third. Nothing here assumes you have seen the notation before.


1. A sequence and its tokens:

Picture it. Imagine beads threaded on a wire, left to right. Each bead is a token; its position on the wire is its subscript.

Figure — Limitations of RNNs motivating transformers

Why the topic needs it. Every complaint about RNNs is really a complaint about how they walk along this wire. If is small (a 3-word phrase) nothing goes wrong; the trouble only appears when is large. So we must name the position and the length before we can say "the memory of fades by the time we reach ".


2. A vector and the space

Each token isn't fed to the network as a word — it's turned into a list of numbers called a vector.

Picture it. A vector in is an arrow in 3-D space. We can't draw , but the idea is the same: a point whose location is given by coordinates. Think of it as dials, each turned to some value.

Why the topic needs it. The parent note says the RNN's memory is a vector . The whole "compression bottleneck" argument compares how many numbers we have ( of them) to how much information we must store. You cannot follow that argument until " = a box holding exactly numbers" is second nature.


3. The hidden state — the memory

Picture it. A single sticky note the network keeps rewriting. Read a word → cross out the old note → write a new summary. The sticky note is always the same size ( numbers), no matter how long the sentence.

Figure — Limitations of RNNs motivating transformers

Why the topic needs it. "Information loss" and "fixed compression bottleneck" both come from the fact that this one sticky note has a fixed size and gets overwritten every step. Name the sticky note and the arguments become concrete.


4. The recurrence

This is the single most important line in the whole parent note. Let us earn every piece.

Picture it. A machine with two input chutes — old memory drops in one chute, the new word drops in the other — and one output chute producing the new memory. Then you feed that output back into the old-memory chute for the next word. That feed-back loop is what "recurrent" means.

Figure — Limitations of RNNs motivating transformers

Why this notation and not a plain formula? Writing it as hides the internal details of so we can focus on the dependency: to get you must already have . That dependency — one step chained to the last — is exactly the "sequential bottleneck". The notation was chosen to make the chain visible.


5. The concrete update:

The parent note replaces the abstract with a specific formula. Let's decode each symbol.

Picture it. Each matrix is a mixing board: sliders that decide how much each old number contributes to each new number. mixes memory-with-itself; stirs in the new word; nudges the result.

Figure — Limitations of RNNs motivating transformers

Why and not just leave the numbers? Without squashing, repeatedly multiplying by every step would let the memory numbers blow up to infinity. keeps every memory value politely between and . But — and this is the seed of the vanishing-gradient problem — its slope is almost always less than (steepest, slope , only at ; nearly flat at the edges). That slope-below-one is what shrinks gradients later.

Recall Why does

cause trouble later? Its slope lies in . ::: When gradients pass through many steps, each step multiplies by this small slope, so the signal shrinks exponentially — the vanishing gradient.


6. "Big-O" time: and

The parent note keeps writing and . These are just size labels.

Picture it. is a line of people passing a bucket one to the next — a chain of hand-offs. is everyone dunloading their own bucket at the same moment.

Why the topic needs it. "Cannot parallelize" is precisely the claim that the RNN forward pass is sequential steps, while a transformer is sequential depth. The notation is the shorthand that lets us compare them in one glyph.


7. Gradients and the derivative

Picture it. Imagine the loss as the height of a hill and as a knob you can turn. The gradient is the steepness you feel when you wiggle the knob — which way, and how strongly, is downhill.

Why the topic needs it. Learning happens by sending these steepness-signals backward through the chain (this is Backpropagation Through Time). Because the chain multiplies many small slopes together, the signal reaching early tokens becomes microscopic — the vanishing gradient. You need the derivative symbol before that story makes sense. See Vanishing and Exploding Gradients and Backpropagation Through Time for the full mechanics.


8. Information in bits, and

The compression argument needs one more tool.

Why the topic needs it. The bottleneck argument compares the bits needed to store a sentence () against the bits a vector holds. You can't weigh those two without knowing what a bit and mean.


How these foundations feed the topic

tokens x1 to xT

vectors in R d

hidden state h t

recurrence h t = f of h prev and x t

tanh and weight matrices

Big-O time O of T

derivative and gradient

bits and log2

compression bottleneck

Cannot parallelize

Vanishing gradient

Fixed compression

Limitations of RNNs

Each foundation on the left is a prerequisite for one of the three limitations in the parent topic. Related deep vault notes: LSTMs and GRUs, Self-Attention Mechanism, Positional Encoding, Encoder-Decoder Architecture, Computational Complexity of Sequence Models.


Equipment checklist

Cover the right side and answer each before moving on.

What does the subscript in mean?
The position of the token in the sequence — is the -th token.
What is ?
The length of the sequence — the total number of tokens (varies per input).
What does denote?
The set of all vectors holding exactly real numbers.
In plain words, what is the hidden state ?
The network's memory after reading the first tokens; a fixed-size vector it overwrites each step.
Why can't we compute without and ?
The recurrence makes each state depend on the previous one — a forced chain.
What does do and why is it used?
Squashes any number into to keep memory bounded; its slope below 1 later shrinks gradients.
What does mean?
The work grows in direct proportion to sequence length — sequential steps.
What does measure?
How much the loss changes when you nudge the memory — the sensitivity used for learning.
Why does appear in the bottleneck argument?
It counts the bits needed to identify one word out of , letting us weigh information stored vs. capacity.