Efficient Hybrid Models

Long-context AI is hitting a quadratic wall.

I research the architectures that break through it — state-space models, linear attention, hybrids, and latent-reasoning loops that could make long-document AI affordable for hospitals, labs, and researchers who don't own a GPU cluster.

Every new token, replayed vs. remembered

Both models read the same sentence. Self-attention re-reads every previous token, every step. A selective SSM asks one question per token — worth remembering? — writes “keys” into its fixed-size state, and lets “the” pass straight through.

Transformer · KV-cache grows with every token Selective SSM · fixed state — keeps meaning, skips filler

The problem

Attention pays for context twice — in compute and in memory.

Self-attention compares every token with every other token, so compute grows with the square of context length — and the key–value cache it keeps grows linearly on top of that. Pick a model and drag the slider out to a million tokens: the numbers below are computed live from each model's published configuration, against a Mamba-2-class model whose recurrent state never grows at all.

Model
32K tokens
1.1B
token-pair comparisons (N²) per attention map
4.00 GB
KV-cache — Llama-3-8B, BF16
0.13 GB
Mamba-2-class recurrent state — constant at any length
×32
this cache ÷ the fixed state, at this length

Inference memory vs. context length

Cache memory of the selected model vs. the fixed recurrent state of a Mamba-2-class 7B model, one sequence, batch 1. Context axis is logarithmic, 1K to 1M tokens. Hover, tap or focus the chart for values (arrow keys move along it); the marker tracks the slider.

Llama-3-8B KV-cache Mamba-2-class recurrent state
How these numbers are computed

KV-cache per token = 2 (K and V) × attention layers × KV heads × head-dim × 2 bytes (BF16), read from each model's published config.json: Llama-3-8B — 32 layers × 8 KV heads × 128 = 128 KiB/token; Llama-3-70B — 80 layers × 8 KV heads × 128 = 320 KiB/token (both use grouped-query attention; head-dim = hidden size ÷ attention heads); Nemotron-H-8B — only 4 of its 52 layers are attention (8 KV heads × 128) = 16 KiB/token, plus a fixed state in its 24 Mamba-2 layers of 24 × 128 heads × 64 head-dim × 128 state-dim × 2 bytes = 48 MiB (convolution buffers add ≈2 MiB). The Mamba-2-class reference: ≈64 layers × 8192 inner-dim × 128 state-dim × 2 bytes ≈ 128 MiB, independent of context length. GB here means 230 bytes. Attention scores: N² comparisons per layer-head pass. Sources: Llama-3-8B ↗, Llama-3-70B ↗, Nemotron-H-8B-Base-8K config ↗. Weights, activations and serving overheads are excluded; this is the part that grows with context. The lines are memory arithmetic, not a claim about quality: Llama-3 ships with an 8K window and that Nemotron-H checkpoint with 8K, so the curves past that show what the cache would cost.

And even with the compute…

Models lose the middle of long documents.

Even when a document fits in the context window, retrieval accuracy dips sharply when the relevant passage sits in the middle — the lost-in-the-middle failure documented by Liu et al. (2023). In clinical records, legal texts, and dense academic literature, the middle is where the evidence lives. My research plan measures exactly where this degradation begins, then tests whether selective state-space models can avoid it.

Retrieval accuracy vs. position of the relevant passage

Measured, not illustrative: GPT-3.5-Turbo (0613) on multi-document QA with 20 retrieved documents (~4K tokens), the answer-bearing document moved from first to last. Values from Table 6 of Liu et al. (2023), arXiv:2307.03172 ↗; the dashed line is the same model answering with no documents at all (closed-book, Table 1). Hover, tap or tab to the points.

The pragmatic answer

Hybrids: keep a sliver of attention, make the rest linear.

Pure SSMs are cheap but fuzzy at verbatim recall; pure attention recalls perfectly but pays the quadratic tax on every layer. Production models now split the difference — a thin slice of real attention for precise, needle-in-haystack lookups, riding on a linear-state backbone that does the bulk of the work. Hover or tap the stacks (or tab to one and use the arrow keys): orange layers are the only ones that keep a KV-cache.

≈8%
attention layers in Nemotron-H — the rest is Mamba-2 + FFN
6 / 52
attention layers in Nemotron 3 Nano 30B — 23 Mamba-2, 23 MoE
1 : 7
attention : Mamba ratio that Jamba shipped first
1M
token context window Nemotron 3 runs on this recipe

Where the attention actually is

Layer-by-layer composition, drawn to each model's real layer counts. The hybrid recipe: replace almost every attention layer with a constant-memory Mamba-2 layer, keep a few for high-fidelity recall.

Attention (keeps KV-cache) Mamba-2 (constant state) FFN (dense) MoE (sparse experts)
Aug 2025 · Jet-Nemotron

“Gated DeltaNet achieves the best accuracy.”

NVIDIA's PostNAS ran six linear operators head-to-head — RWKV-7, RetNet, Mamba-2, GLA, DeltaNet, Gated DeltaNet — inside a frozen Transformer. Gated DeltaNet won; they built JetBlock on top of it.

My deep-dive: Inside Jet-Nemotron →
Dec 2025 · Nemotron 3

The frontier family ships on Mamba-2.

Four months later, the same lab bet its flagship open models — Nano, Super, and the 550B Ultra — on Mamba-2, not Gated DeltaNet, not JetBlock. What wins a 2B-scale search isn't what gets trusted at 550B.

My deep-dive: Nemotron 3's Mamba-MoE engine →

Same lab. Same year. Two different winners. The field agrees on the hybrid recipe but not on the linear operator inside it — or where the attention layers belong, or whether any of it holds at the next order of magnitude. Nobody has a settled theory yet. That open question is precisely where my 24-month research plan and survey sit: put the operators under one notation, then measure — at kernel level — what the state actually remembers.

The third answer

Don't replace attention — give it a lower-resolution memory.

Hybrids delete most attention layers and hand the work to a recurrent state. DeepSeek-V4 takes a different route: keep attention in every layer, but let most of what it reads be compressed. Each layer attends over a short local window at full resolution and a long history at reduced resolution, concatenated into a single softmax. Two new layer kinds do this — CSA with light compression and a learned indexer that keeps only the top-scoring entries, and HCA with heavy compression and no indexer at all.

swa — local only

A causal sliding window and nothing else. Cheap bootstrap layers that resolve local structure; anything older is simply invisible to them.

csa — compressed sparse

Light compression, overlapping blocks, and a Lightning Indexer that ranks the pool and keeps the top-k. It ranks after the causal mask, so its selection is always a subset of what dense attention would have seen.

hca — heavily compressed

Aggressive non-overlapping compression, every closed block visible, no indexer to train. Only complete blocks are emitted — a partial one would summarise fewer tokens than its siblings and make the entries incomparable.

Two ways to compress the past

Schematic. Sixteen past tokens and one new query (right). On the left, every token was written into one fixed state and the query can only read that state. On the right, blocks of four tokens become one compressed key each, and the query can still jump to any of them.

now state S fixed d × d write y read S only past folded in — no path back to any one token
Fixed state · Mamba-2, KDA, Gated DeltaNet — O(1) memory, lossy, no random access
k₁k₂k₃k₄ now query can reach any key (solid = kept by CSA’s indexer) 16 tokens → 4 keys — fewer, but still addressable
Compressed keys · DeepSeek CSA / HCA — memory shrinks by the block size, random access kept

Why this matters for the hybrid debate. A Mamba-2 or KDA layer buys constant memory by compressing the past into a fixed-size state and giving up random access to it. A CSA or HCA layer compresses the past into fewer keys and keeps random access over them. Those are genuinely different bets about what long-context memory is for. QUANTA asks the neighbouring question under identical ternary weights: one fixed-state stack (GDN-2), with a dense or a sparse global read on top.

Read further: the fixed-state side is the gated recurrence St = Gt ⊙ St−1 + kt⊤vt that the survey uses as its unifying notation; the production layer schedules that mix exact attention with a cheaper memory live in the Hybrids node of the Atlas.

The map so far

Four separate bills — and each technique pays down one.

Decoding is mostly memory traffic: every forward pass streams the active weights and the whole cache. To a first order, bytes moved per answer ≈ forward passes × (active params × bytes per weight + context × KV bytes per token). Every idea on this page shrinks one factor of that product, which is why they can stack.

Dot colour = Atlas phase (Phase 1 · Phase 2 · Phase 3); grey = an engineering lever, not a separate Atlas node.

Two other levers

Spend fewer bits per weight, or fewer steps per answer.

Replacing attention with a fixed-size state is only one way to make long-context AI affordable. Three Atlas nodes attack the cost from completely different directions: 1-bit models shrink what a weight costs to store and multiply, while multi-token prediction and diffusion language models shrink how many forward passes an answer costs to produce. All three are in the survey; none needs a bigger GPU.

1-bit / MatMul-free is a Phase-1 node in the Atlas. Deep-dive on the ternary side: How BitNets Run a Transformer With (Almost) No Multiplication →

Fewer steps per answer

NVIDIA's Nemotron 3.5 Lightning (August 2026) is the clearest production case. It is a 30B mixture-of-experts with just 3B active parameters, on the same interleaved Mamba-2 + MoE backbone with a few attention layers — and its headline “up to 4× the output speed of similar-sized models” is credited to what happens around the backbone, not to the backbone itself: speculative decoding — multi-token prediction trained in (with a dedicated MTP-boosting phase), plus two draft models, DSpark and DFlash — and an NVFP4 quantized checkpoint. NVIDIA doesn't say how much of the 4× each one contributes. There is no technical report on arXiv yet; the details are from the NVIDIA announcement ↗. Multi-token prediction is a Phase-2 node in the Atlas, and I wrote about it in Why Your LLM Should Be Guessing ↗. The race below shows why guessing ahead works.

Why Lightning is fast: guess four, check once

Schematic. Both lanes decode the same sentence. Autoregression pays one full forward pass per token. Speculative decoding lets a tiny draft model propose four tokens, then the big hybrid verifies them all in a single pass — wrong guesses get thrown out and redrafted, and it still finishes ~3× sooner.

Verified one at a time — 1 token per pass Drafted then verified — up to 4 tokens per pass

Diffusion language models pull the same lever harder: they drop strict left-to-right decoding and refine many positions in each forward pass — a Phase-3 node in the Atlas.

All three are tracked in the survey's coverage map.

Putting it together

Everything above upgrades a different part of the same block.

Four slots, rebuilt by different labs on separate timelines — and, until 2026, almost never in the same model.

Step back from the individual papers and something odd shows up. The 2017 Transformer block has four swappable slots — a token mixer, a channel mixer, the precision the weights are stored in, and the residual pathway that carries information between layers. NVIDIA's Mamba-2 hybrids, Moonshot's delta attention, DeepSeek's compressed attention and Qwen's Gated DeltaNet have all been rebuilding the first. Mixture-of-experts rebuilt the second. BitNet rebuilt the third. They are largely orthogonal upgrades, and the fourth slot went nine years untouched — then got three incompatible replacements in a single year.

The original block — and its four slots

Vaswani et al. (2017). Every model on this page is still this diagram with one or two slots replaced. Slot 4 — the residual stream and Add & Norm skeleton — went unchanged for nine years, which is why it is drawn dashed. It is no longer empty: three labs moved it in 2026, in three different directions.

Who upgraded which slot

Model 1 · Token mixer 2 · Channel mixer 3 · Precision 4 · Residual Slots left original
Transformer 2017 Multi-head attention Dense FFN FP16/FP32 Add & Norm 4 of 4
BitNet b1.58 2025 Full attention + RoPE Dense FFN (squared ReLU) Ternary, 1.58-bit Add & Norm 3 of 4
Nemotron-H / 3 2025 Mamba-2 hybrid (6 of 52 attn; 1M ctx) Sparse MoE (23 of 52 layers) FP/BF16 Add & Norm 2 of 4
Kimi Linear 2025 KDA 3:1 hybrid (delta rule) Sparse MoE (3B of 48B active) FP/BF16 Add & Norm 2 of 4
DeepSeek-V4 2026 SWA + CSA + HCA (local window kept in every layer) Sparse MoE (61 layers) FP8/FP4 storage mHC (manifold-constrained hyper-connections) 0 of 4
Qwen3.8-Flash-Next 2026 GDN 3:1 QSA (fixed state + block-indexed sparse retrieval) Sparse MoE (multimodal) FP/BF16 Gated Residual (4 branches, read/write gated) 1 of 4
Kimi K3 2026 KDA + global MLA (joint language/vision context) Sparse MoE FP/BF16 Attention Residuals (softmax over depth) 1 of 4
QUANTA this work · pre-registered GDN-2 3:1 Gated MLA or GDN-2 3:1 QSA (vs softmax, each with an FP twin) Dense Ternary, 1.58-bit (MLP-only, W1.58A16) R0 baseline + five residual families — bypass, GR, mHC, single-pass mHC, AttnRes; exploratory 1 of 4

In 2026 the empty corner got occupied, from three sides at once. DeepSeek-V4 was first to move all four slots together: a three-way hybrid attention schedule, sparse MoE, FP8/FP4 storage, and manifold-constrained hyper-connections in place of plain Add & Norm. Within months Qwen3.8-Flash-Next and Kimi K3 did the same thing with different answers in every slot — Qwen with Gated DeltaNet plus block-indexed sparse retrieval and a four-branch gated residual, Kimi with delta attention plus global MLA and a residual that attends over depth. Between them the “can these compose?” question is settled at frontier scale and in the affirmative. But each answer arrives by changing everything simultaneously, so none of them can tell you which slot bought which gain — and none was tried at low precision. That is the gap QUANTA works in: the same components, one at a time, at the ~596M Qwen3-0.6B scale where an ablation is affordable.

One honest correction, because it changes the argument. It's tempting to say BitNet's FFN is “the old part” — but BitNet ternarizes every linear layer, FFN included. The slot it actually left untouched is the token mixer: BitNet b1.58 2B4T still runs full softmax attention with RoPE, and its own technical report names extending sequence length and “investigating efficient attention mechanisms suitable for low-bit models” as future work. So the gap isn't a stale FFN — it's that the cheapest weights in the field are still attached to the most expensive sequence mixer, and the FFN, while ternary, is still dense.

That is what makes the corner interesting rather than merely unbuilt. The shipped savings multiply against different bottlenecks — ternary weights cut memory and bandwidth per parameter, hybrid and compressed attention cut the cache that grows with context, MoE cuts how many parameters run per token (the four cost axes above). Whether they actually compose at low precision, or interfere, is still an experimental question: no frontier model has taken the ternary route, ternary experts may not specialize, and a compressed recurrent state may not survive 1.58-bit weights.

Slot 4: shut for nine years, then opened three ways at once

Slot 4 is now a crowded slot, not an empty one — and that is the more interesting problem. Nine years with one fixed addition, then three incompatible replacements in a single year. Qwen widens the stream and gates the reads. DeepSeek widens it too but pins the mixing matrix to the doubly-stochastic manifold so it keeps behaving like an identity map. Kimi leaves the stream alone and instead lets a layer run softmax attention over the outputs of every layer beneath it. Those are three different mechanisms — widening, constraining, and reaching along depth — routinely lumped together as “better residuals.” QUANTA treats them as an R0 baseline + five residual families with separate predicted signatures, because a win for one implies nothing at all about the others. The background — from static skips to hyper-connections — is in my piece Why Residual Connections? ↗

Every block above except the 2026 three still moves information between layers the way it did in 2017 — one addition, from the layer directly beneath:

xl+1=xl+F(xl)x_{l+1} = x_{l} + F(x_{l})

That is a write, not a read. Layer 20 sees layer 19's output and nothing else; anything layer 4 computed has to survive sixteen rounds of being overwritten to still be there. In a full-precision network that is usually fine. Under ternary weights, every one of those sixteen transformations is lossy by construction — which is exactly why this slot becomes worth reopening at 1.58 bits and not before.

Attention residuals make the pathway a retrieval instead of an addition. A layer attends back over the earlier states in the stack and pulls what it needs — which is exactly what Kimi K3 shipped in 2026:

xl+1=xl+F(xl)+Attn ⁣(xl, {x0,…,xl−1})x_{l+1} = x_{l} + F(x_{l}) + \mathrm{Attn}\!\left(x_{l},\, \{x_{0}, \dots, x_{l-1}\}\right)

The hypothesis: if ternary transformations shed information layer by layer, letting a layer read earlier states directly may recover some of it — at a cost, since those states have to be kept and attended over. Toggle slot 4 in the builder above to see the pathway change. Three shipped mechanisms now occupy this slot and they are not variants of one idea: DeepSeek's mHC and Qwen's Gated Residual widen the stream, and only Kimi's AttnRes retrieves over depth. QUANTA sweeps them — R0 baseline + five residual families — at ternary precision, where none has been tried.

How I'm testing it — QUANTA See the operators in the Atlas

Research direction I · proposal

Can state-space models make long-context reasoning affordable?

A 24-month empirical program: map the exact degradation curve of Transformer long-context retrieval, then test whether Mamba-2-class architectures can match it at a fraction of the memory — with hardware-level profiling on dedicated HPC infrastructure, and falsifiable success criteria fixed in advance.

≤ 5 pts
target retrieval-F1 gap vs. Transformer baseline beyond 32K tokens
≥ 40%
target reduction in peak KV-cache memory
3
phases: baseline · build · validate
O(N)
the complexity claim to be verified at kernel level

Read the research plan

Want the full formal proposal, or to collaborate on this direction? Email [email protected] or reach me on LinkedIn ↗.

Research direction II · pre-registered design · November 2026

If a model's MLP weights can only be −1, 0 or +1, what does the rest of the network do about it?

A separate line of work. Ternary weights make a language model much smaller but cost quality. QUANTA (Quantized Architectures for Neural Token-flow Analysis) uses them as a controlled lesion: only the MLP (feed-forward) weights go ternary, and everything else stays at full precision. The question is how the rest of the network adapts, and whether a standard transformer or a hybrid — mostly Gated DeltaNet-2 recurrent layers with an attention layer every fourth layer — pays less for the damage. Every model is trained from scratch at the Qwen3-0.6B size on 1B tokens. The tests and what counts as a result were frozen before the first run; no study run has started yet.

6
main models — a transformer and two hybrids, each with and without ternary MLP weights — at three seeds each
5
families of pre-registered tests, from the lesion's cost to a knowledge-vs-context token split
0.15%
shared core matched across models within this band; what a design adds is counted separately
0.02
nats (about 2% perplexity) — the smallest difference the study treats as meaningful

What it tests. How much the lesion costs the transformer; whether each hybrid pays less, measured against its own full-precision twin; whether the damaged models lean more on their attention layers and recurrent memory; and whether the lesion hurts most on tokens the context cannot predict, as it should if the MLPs hold stored knowledge. A second, exploratory stage — reported in a separate paper — tries five alternative residual-stream designs on whichever hybrid looks more promising. The earlier, broader plan (Mamba-2, DeepSeek, Kimi K3 and Qwen3.8 lines, multi-token prediction, mixture-of-experts) stays implemented but untrained.

Deliberately kept apart from the survey work. Direction I and the survey ask whether the sequence mixer can be replaced. This one leaves that open and asks a different question at a different precision. Different hypotheses, different baselines, no shared claims — and any result from one does not transfer to the other.

Read the QUANTA experiment design

Research direction III · experiments running · November 2026

An agent should be able to forget the context without forgetting the facts.

MnemoRoute (Topic-Routed Recurrent–Episodic Memory for Long-Horizon Conversational Agents) takes the recurrent state from the architecture work up one level, to an agent's memory across turns. A controller routes each turn to a topic and picks one action — continue, create, revisit, cross-link, retrieve, update, compact, or defer; a Gated DeltaNet-style state holds each topic's working context; an append-only episode log and a temporal fact index keep the exact values, every correction, and where each came from. It also asks how to find the right existing record without a vector-first assumption, and when a new claim should change it. First development results are in: on a benchmark with gold memory slots, corrections fail mainly at addressing (finding the right record), not at the update decision.

0.34 → 0.16
correction accuracy lost to addressing, from rule-based to frontier-LLM addressing; update rules lose 0.00
+17.6
points a perfect write path adds over tuned hybrid retrieval end to end
2 → 40
interleaved topics in the Topic-Interleaving Set (development data only so far)

Built to be falsified, and already narrowed. The learned memory pipelines tie with plain hybrid retrieval end to end. The best one, MR-LB3, is +1.9 points over the tuned baseline, which is not significant. So Paper 1 measures where memory fails, and the recurrent state waits until that is understood.

See the MnemoRoute findings and design

Research direction IV · first verdict in · November 2026

Some layers need the whole past, some need none of it, and most only need the gist.

AMTR-KV (Adaptive Multi-Timescale Recurrent KV compression) works on the memory a pretrained transformer uses while it reads a long input: the KV cache, which stores a key and a value for every token in every layer. Most ways of shrinking it without retraining keep a layer's cache in full or throw away everything older than a recent window. AMTR-KV adds a third option, fold: compress a layer's old tokens into a small bank of Gated DeltaNet-2 memories with short, medium and long horizons. A measured profile of each layer decides which of the three modes it gets under a memory budget; the model itself stays frozen. First measurements on Qwen3-0.6B: most KV heads need their old context, but only in aggregate.

59%
of Qwen3-0.6B's KV heads need old context spread thinly over many tokens: the ones a fold is for
0.77 vs 0
rank correlation with the damage of dropping a layer's old tokens: headroom against attention entropy
≈ 1%
lost by one fixed plan against a fresh plan for every input, so the plan is computed once

Not proven yet. The pre-registered go/no-go test first said no: with each memory trained on its own layer, folding six layers did no better than spending the same bytes on a longer window. Training the six folded layers together turned that around (loss on the tokens that need long context: 1.56 against 1.79 nats). Both runs used a small 256-token window, so a test at a 2,048-token window, with its rules written down before any result, now decides. If the fold fails there, it is declared dead.

See the AMTR-KV findings and design

Collaborate

Working on long-context or low-bit models? Let's talk.

For the full formal research proposal, collaboration on either direction, or notes on anything in the Atlas — email is the fastest way to reach me.

The Architecture Atlas

Nineteen architectures. Three phases. One story.

Every post-Transformer architecture answers a specific failure of the one before it. The Atlas maps that evolutionary chain from LSTM (1997) to Meta's Context Language Models (2026) — each node with its motivation, key equation, complexity, and the paper behind it.

Phase 1

The Linear-Sequence Revolution

Replace the KV-cache with a fixed-size state — RNNs, 1-bit LLMs, linear attention, hybrids, and Mamba.

Phase 2

Latent Reasoning Loops

Spend adaptive test-time compute inside a latent state — TTT, multi-token prediction, HRM, TRM, recursive LMs, and context LMs that edit their own window.

Phase 3

Beyond Causal Autoregression

Abandon next-token prediction — energy-based Transformers, diffusion LLMs, variational autoencoders, normalizing flows, flow matching, JEPA, world models, and typed System One models.

Open the Atlas

Writing

Deep-dives, published in Towards AI.

Selected articles — the full list, mapped to Atlas nodes, is on the Writing page.

Phase 1 · SSMs

Mamba: From Intuition to Proof

How delta-gated state-space models challenge the Transformer — from the intuition of selective memory to the parallel-scan proof.

Towards AI·Jan 9, 2026
Phase 1 · Linear attention

Gated Attention & DeltaNets

The missing link for long-context AI: fusing Mamba's forgetting with DeltaNet's precise memory writes.

Towards AI·Feb 6, 2026
Phase 2 · TRM

Tiny Recursion Models

How a 7M-parameter network with recursion beats models a thousand times its size on hard reasoning puzzles.

Towards AI·Feb 13, 2026

All articles →

In preparation

Beyond the KV-Cache: A Survey of Transformer-Alternative Language Model Architectures

A survey organizing the nineteen Atlas architectures into their three evolutionary phases, under a single unified state-update notation — in preparation for arXiv (cs.CL / cs.LG). The Atlas is its living companion — and every one of the nineteen gets its own published deep-dive first.

See the coverage map →