Hybrid attention and SSM models: different kinds of memory
Combine attention with state-space models (SSMs): some layers retain separate cache entries, while others carry a fixed-size state.
Linear attention, Gated DeltaNet and Mamba keep a fixed-size state. That saves memory as the conversation grows, but many tokens share the same storage. Their writes can interfere, and some information can be lost.
Attention keeps a separate key/value entry for each token. A later query can request information from those entries, at the cost of a growing KV cache.
Could we keep that cache in only some layers?
Mix the layers
Use fixed-state layers for most of the stack, with attention layers between them. Each reads the current token representation and adds its update to the residual stream:
Each layer keeps its own history: a fixed state or a KV cache. The token representation passes between layers; their memories stay with them.
For example, Qwen3-Next repeats three Gated DeltaNet layers followed by one full-attention layer. Only 12 of its 48 layers need a growing KV cache. With the same KV dimensions, that is a quarter of the cache an all-attention stack would need. The other layers still need their fixed states.
Attention gives the model places to consult separate history entries. It cannot recover information that was never preserved in its own cached representations. Adding more attention layers increases both those opportunities and the growing cache; the useful balance depends on the model and task.
Could both paths work in one layer?
Instead of alternating layers, we could give attention and a fixed-state mixer the same input, then combine their updates:
Falcon-H1 uses this arrangement. Both designs let a model use fixed-state memory and separately stored history; they differ in where those paths meet.
Explore how the layer mix changes the KV cache
The layer strips show each model’s actual order. The dotted line gives every layer attention with the same KV dimensions, to compare only the growing cache. It does not include fixed states, model weights or other memory, and it is not a speed comparison.
Sources and assumptions
- Jamba, Lieber and colleagues, 2024, and its released configuration: attention offset 4 and period 8, using zero-based layer indices.
- Granite 4.0 H Small configuration: attention at layers 6, 16, 26 and 36, using one-based indices.
- Qwen3-Next configuration: a full-attention interval of four across 48 layers.
- MiniMax-M1 and its configuration: seven Lightning Attention layers per softmax-attention layer.
- Falcon-H1: parallel attention and state-space paths.
The layer strip comes from the published architecture entries; KV head widths come from the shared model-dimension registry. The graph counts only full-attention KV values for one sequence. Recurrent state, convolution buffers, model weights, allocator overhead and numerical storage formats are not included in that count. The all-attention line is a same-dimension comparison, not a released checkpoint or a speed estimate.