LearnQuestion bank

Qwen3-Next and Qwen3.5 follow every three Gated DeltaNet (linear-attention) layers with one gated full-attention layer. What does a linear-attention layer keep instead of a KV cache, what is it bad at, and why ship a 3:1 hybrid rather than a fully linear model?

ResearchTechnicalHard

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • Linear layers keep a fixed-size per-head state matrix, updated token by token with a delta-rule write and learned decay/forget gate, so decode memory and per-token cost stay roughly constant as context grows.
  • Training remains parallel via chunked/scan formulations, while inference behaves like an RNN.
  • The state is a lossy compression of the past, so exact retrieval and copying of a specific earlier token degrade as context grows.
  • A 3:1 hybrid keeps one gated full-attention layer in four to restore precise long-range recall while cutting KV-cache memory to roughly a quarter of an all-attention model, improving long-context throughput.
  • Serving is harder: recurrent state cannot be paged and sliced per token like a KV cache, so prefix caching and speculative decoding need state snapshots, and kernels are less mature.
  • Validate with recall-heavy long-context evals such as multi-needle and copying, not just perplexity or short benchmarks.

In full

In this design, a linear-attention layer does not keep a growing KV cache; it keeps a fixed-size state matrix per head that is updated token by token, with Gated DeltaNet using a delta-rule write plus a learned decay/forget gate, so decode memory and per-token cost stay roughly constant as context grows. Training can still be parallelised through chunked or scan formulations, but inference behaves like an RNN. The trade-off is that the state is a lossy compression of the past, so exact retrieval and copying of a specific earlier token degrade as context grows. That is why the 3:1 hybrid is attractive: one gated full-attention layer in four restores precise long-range recall while cutting KV-cache memory to roughly a quarter of an all-attention model, which should raise throughput at long context. The caveat is serving: recurrent state cannot be paged and sliced per token like a KV cache, so prefix caching and speculative decoding need state snapshots, and the kernels are less mature. I would validate with recall-heavy long-context evals such as multi-needle and copying, not just perplexity or short benchmarks.

Corrected by an independent AI reviewer.

What a strong answer covers

  • A linear-attention layer keeps a fixed-size state matrix per head that is updated token by token (in Gated DeltaNet, a delta-rule write with a learned decay/forget gate), so decode memory and per-token cost stay constant as context grows.
  • Training stays parallel through chunked or scan formulations; inference behaves like an RNN.
  • Weakness: the state is a lossy compression of the past, so exact retrieval and copying of a specific earlier token degrade as the context grows.
  • Keeping full attention in one layer in four restores precise long-range recall while cutting KV-cache memory to roughly a quarter of an all-attention model, which raises throughput at long context.
  • Serving caveats: recurrent state cannot be paged and sliced per token like a KV cache, so prefix caching and speculative decoding need state snapshots, and kernels are less mature.
  • Validate with recall-heavy long-context evals (multi-needle, copying), not just perplexity or short benchmarks.

Common mistakes

  • Claiming linear attention is simply a cheaper approximation with no loss in recall.
  • Assuming the hybrid removes the KV cache entirely; the full-attention layers still need one.

Follow-ups

  • How would you choose the ratio of linear to full-attention layers for a new model?
  • Why might prefix caching be harder to support for a hybrid model in an inference server?