State Space Models for Language › Two Memory Systems
Language AI HandbookAll chapters Efficient Attention introduced methods for evaluating attention more cheaply. Here we compare one conventional full causal attention layer to a recurrent state space layer.
For one attention head, let be the query at position . The cache holds the matching keys and values for already processed positions. A causal attention output is , with . For a completed prefix of length , the cache of this head uses scalars. With equal key and value widths , that becomes .
A scalar-input state space layer updates from and its input at position . It reads an output from the resulting state. With parallel channels of this type, the recurrent state uses scalars per sequence.
An attention query can assign different weights to two occurrences of a name if their keys give it different scores. A recurrent state can track a statistic such as how often a specified name appears. That count alone cannot tell you where a particular occurrence appeared.
The recurrence introduces another practical question. Evaluating one update at a time creates a dependency chain of length . When the transition, write, readout, and direct-path coefficients are fixed and the initial state is zero, the layer's input contribution can be evaluated as a causal convolution. The rest of this chapter develops that equivalence and shows what to compute when the weights vary with the input.
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!