Answers · How models work
What is actually stored in the state that a model carries forward?
In shortIt is a fixed-size block of numbers rewritten at each step from its old value and the new input, not a stored copy of earlier inputs.
A model's carried state is a fixed-size block of numbers, not a stored transcript of what it has seen. At step it is a vector , the same length as , and it is produced by an update rule that reads only the old state and the current input: .
What the rule can read
Write the state as numbers. The update has no argument for , no argument for the position , and no separate store that the current input can be written into and left alone. Anything from step reaches step only by having been inside , then , and so on through every intermediate update. That is why the same function can run on a sequence of any length: it never needs to know how long it has been running, and the price is that it also cannot address an earlier position directly.
The fixed length is not a detail of notation. It means the model cannot defer the decision about what to keep: every input must be folded into the same numbers at the moment it arrives, and later inputs compete for the same coordinates. There is no growing buffer that can be sorted at the end.
Take the simplest update that mixes and forgets: , starting from , with inputs , , . Then
The first input is not sitting in a slot. At step 3 its contribution is , because it was multiplied by at step 2 and again at step 3; at step 4 it would be . After ten further updates its contribution is , which is still present in exact arithmetic and is far below what most downstream arithmetic will notice. After twenty further updates it is . This is the sense in which a state stands in for the past: the past is folded in, mixed with later items, and progressively attenuated unless the update rule is built to preserve it.
| step | state h | what happened |
|---|---|---|
| 1 | 0 | h_0=0. Nothing has been read. |
| 2 | 2 | h_1=0.5(0)+2=2. The input 2 is the whole state at this instant. |
| 3 | 5 | h_2=0.5(2)+4=5. The 2 has become 1 inside the state, and 4 has contributed 4. |
| 4 | 8.5 | h_3=0.5(5)+6=8.5. The 2 has become 0.5, while 6 contributed 6. |
Why the transcript picture fails
The natural picture is a compressed transcript: some record of each earlier item, shortened but still addressable. The update rule above has no place to put such a record. It has one block of numbers, and every coordinate is rewritten from the whole previous block and the current input. No coordinate is reserved for the third sentence, or for the item at position 900; after enough updates, the only thing that can be said about an earlier item is whatever is still detectable in the transformed block. A transcript can be compressed by dropping words, but it retains a correspondence between locations and earlier events. A state does not promise that correspondence, and a trained one typically has information spread across coordinates rather than stored in named slots.
That is why inspecting a state does not tell you a list of remembered items. You can ask what the state does on a task, but you cannot read the third item off coordinate seven. The coordinates are a code, not an index.
Where the fixed size bites
If the state has numbers, it has 512 numbers after one item and 512 after 10,000; the count is fixed before the sequence length is known. Keeping every position instead, at 128 numbers per item, gives numbers after 100 items and after 10,000. At 10,000 items that is 2,500 times the 512-number state, since . The fixed state is cheaper by a factor that grows with length, and the same fixed size is why something must be discarded: a summary of 10 items and a summary of 10,000 items have the same room, so the update rule has to decide what earns space while the sequence is arriving.
None of this says a fixed state must lose exact bits. If the update rule copies one coordinate straight through, that coordinate survives indefinitely, and gated rules can learn to hold a value for a long time. What the fixed size rules out is storing a separate entry for every past item. For a task that needs the gist, a fixed block is the right shape. For a question about a number in the fourth line of a table nine thousand words ago, a fixed summary is the wrong shape, and a design that keeps every position, or carries a fixed state plus a short exact window, is doing a different job.
Worth keeping
- A carried state has the same number of slots at the first step and after a million steps.
- The update at each step sees only the previous state and the new input, so an earlier item survives only by being transformed again and again.
- A fixed state is the right shape for a summary and the wrong shape for exact recall of an arbitrary earlier item.
Where this goes next
This question is one step of Models That Carry a Memory, a course that works through its subject from the beginning. The page that teaches this part of it is A Fixed Summary Carried Forward, and it reads the whole way through whether or not you have an account.
What an account changes is the practice: problems standing under every idea, marked with a reason rather than a tick, in a copy of the course that is yours.
Read that pageThe whole courseOther questions people ask about this
- Why does a transformer need a cache that grows with sequence length?A transformer stores the key and value for every token it has already seen so later tokens can look back at them, and that store grows with the conversation.
- Why can a linear recurrence be computed as a convolution?Because a linear recurrence adds up past inputs with fixed decaying weights, and that weighted sum is a convolution with the recurrence's impulse response.
- How can a model remember a sequence without keeping every past input?A model can remember a sequence by keeping a fixed-size block of numbers and rewriting it at every step from its old value and the new input.
- How does a gate let information pass through unchanged?A gate lets old information take a direct additive route through the steps, with a learned fraction deciding how much survives each step.
- Why does the model get stuck repeating the same sentence over and over?The model is not stuck in a memory loop: once it has written a phrase, that phrase is in its context and makes writing it again more likely, so a decoder that always picks the top word cannot leave.
- Why does diffusion add Gaussian noise instead of any random corruption?Diffusion adds Gaussian noise because Gaussian errors combine exactly: each step keeps the spread fixed and gives a closed-form noisy picture at any later step, which makes the reverse step learnable.