hybrid-by-layer -- interleaved SSM + periodic full attention

A model is a stack of dozens of near-identical layers, and they do not all have to work the same way. Newer models make most of them the cheap kind that keeps a small fixed running summary, and place a full attention layer — the kind that stores notes on every past word and re-reads them — only every fourth or eighth position. Nearly all the memory a long conversation eats is those stored notes, so cutting how many layers keep any cuts the memory bill by about the same fraction. What is given up is exact recall: the summary layers work only from what they compressed, so the few attention layers carry the model's ability to quote the past precisely.

Interactive page: how hybrid models (Jamba, Zamba, Qwen3-Next, …) stack cheap SSM / linear-attention layers and sprinkle in full-attention layers every so often -- and exactly where the KV cache lives and where it doesn't. Anchor: N3 hybrid sequence architecture (Family E). Builds on ssm-scan / gated-deltanet (the SSM layers) and kv-cache (the attention layers).

What it shows

A stack of N layers. Most are SSM layers (recurrent constant-size state, O(L) per token, no KV cache); every P-th layer is a full-attention layer (O(L²), a KV cache [L × 2·d]). The interleave pattern -- e.g. one attention every 4th layer (Qwen3-Next and Kimi Linear both ship 3:1) to every 8th (Jamba's a:m = 1:7) -- is the whole design knob.

Drag the attention-period slider to steer the pattern (and the KV memory) live; click any layer to flip it SSM↔attention by hand; hover any layer to inspect its type, KV size, and cost.

Render tier

T1 (Canvas2D: the layer stack, the per-layer SSM-state lines / attention KV-cache strips, the forward-pass pulse, and the memory rollup).

Wiring

layout.mount + controls (N, P, L, d) + animate (the forward-pass pulse) + onPointer layer click-to-toggle + the period slider (drag-to-steer) hover. ?p / ?toggle / ?hover hooks. Source: page.js.