State Space Models for Language
Language AI HandbookAll chapters When you generate the next token after a long document, a full causal attention layer can compare its query with the keys at every processed position. The layer keeps separate key and value vectors for those positions, so both the cache and the work to read from it grow with the prefix. At 100,000 positions, the same cache calculation that was cheap for a short prompt can dominate a memory budget.
A state space layer keeps a fixed-size state per sequence. Each new input updates that state, and a readout produces the layer's output. With the layer sizes and batch size fixed, the amount of recurrent state and the number of arithmetic operations for one recurrent update are independent of how many positions came before. A layer that needs to recall an old detail must recover it from the state its updates have retained. This chapter derives the update, computes a fixed system in two equivalent ways, then uses a small experiment to show how the history can fade when the update retains only a fraction of the previous state.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!