Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Remembering which value went with which key
Language models constantly need to look things up: “the capital of France was mentioned earlier; what was it?” Plain state-space layers are linear filters, and a linear filter cannot do this kind of lookup. It can blur and delay signals, but not match a query against stored keys. H3 and Hyena add gates: elementwise multiplications between different projections of the input. Multiplication lets the model store “key times value” and later multiply by a query to read the right value back. The demo shows a related idea, an input-dependent update that decides what to keep.
Gated long-convolution models process very long contexts (genomes, logs, long documents) at subquadratic cost while keeping the recall abilities that made attention successful.
- 1. Plain linear SSMs struggle with…
- 2. H3 and Hyena add…
- 3. Hyena's main operator is…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Associative recall: a sequence k₁ v₁ k₂ v₂ … k_P v_P q must output the value whose key equals q. Guessing among the stored values gives chance 1/P (0.25 for 4 pairs). A sequence has 2P + 1 tokens.
- H3 layer: Q, K, V are linear projections of the input; K passes through a shift SSM and is multiplied by V; a diagonal SSM accumulates the products; the result is multiplied by Q.
- With no decay, the memory is M = Σ_t K_(t−1) ⊗ V_t, and the output is Qᵀ M, which reads the value stored with the matching key. This is linear attention.
- Hyena (order N): y = x_N ⊙ (h_N ∗ (x_(N−1) ⊙ (h_(N−1) ∗ … (h_1 ∗ v)))). The long filters h are produced by a small network of position (implicit filters); the x_i are gates.
- Cost: an FFT long convolution costs about L log₂ L (10,240 for L = 1024); attention costs L². At 64 k tokens, attention is about 4096 times more expensive.
- 1. Chance for recall with 4 pairs:
- 2. H3's memory with no decay is…
- 3. Hyena's filters are…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.H3 and Hyena in code
Exercise 1.
- A shift moved tokens down one position.
- A long convolution applied the filter.
- An order-2 Hyena recurrence with identity filters reduced to gating.
Practice.
- The
safari(Hyena) and H3 repositories provide layers. FlashFFTConv speeds long convolutions on GPUs. - Hyena filters use a positional encoding fed to an MLP, times a decaying window; gates come from short depthwise convolutions of projections.
- Test new sequence architectures on synthetic recall and induction tasks early: they predict language-modelling quality well.
q, k, v = proj(u).chunk(3, dim=-1) # H3: data-dependent projections
k = shift_ssm(k) # previous-token keys
kv = diag_ssm(k * v) # accumulate key*value products (long memory)
y = out_proj(q * kv) # multiplicative read-out with the query- 1. A library that speeds long convolutions:
- 2. Good early tests for new architectures:
- 3. H3's keys come from…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Why linear time-invariant models cannot recall.
- A linear SSM or long convolution produces outputs that are linear functions of the inputs.
- Associative recall requires an output that depends on the product of the query and the stored pairs: the value to return changes with the query. No linear function of the one-hot sequence can implement this; at best it can output “some value that appeared,” that is, chance.
Gates add the missing interaction.
- Multiplying projections creates second-order (and with more gates, higher-order) terms such as qᵢ·kⱼ·v_l, exactly the terms recall needs.
- H3’s construction is linear attention with an SSM in place of the running sum. Hyena stacks several gate-and-convolve stages to approximate attention’s data-controlled mixing.
The trade-off. Long convolutions give subquadratic cost and very long context, but compress the past into filters and states. Exact recall of many arbitrary keys still favours attention, which is why later models mix the two (Striped Hyena, Jamba).
- 1. An LTI model's output is…
- 2. Recall needs terms like…
- 3. H3 is closely related to…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Can a linear time-invariant model do associative recall?
History.
- D. Y. Fu, T. Dao, K. K. Saab, A. W. Thomas, A. Rudra and C. Ré, “Hungry Hungry Hippos: towards language modeling with state space models” (ICLR 2023).
- M. Poli et al., “Hyena hierarchy: towards larger convolutional language models” (ICML 2023).
- Later hybrids mix Hyena or SSM layers with attention.
Exercise 2.
- Task: recall sequences k₁ v₁ … k₄ v₄ q (one-hot, vocabulary 8; distinct keys and values), where the target is the value paired with q. 3000 sequences are used for training and 1000 for testing.
- LTI model: the best possible linear readout of the whole sequence (ridge least squares on all tokens). It is an upper bound for any linear time-invariant convolution model with a linear readout.
- H3-style model: the memory Σ shift(x) ⊗ x at value positions, read out by the query, with no training.
| model | recall accuracy |
|---|---|
| chance (pick a stored value) | 0.250 |
| best linear (LTI) readout | 0.255 |
| H3-style gated read-out | 1.000 |
- Linear time-invariant models cannot recall: even the best linear function of the entire sequence stays at chance. It can learn to output a value that appeared, but not which one the query asks for.
- One multiplicative interaction solves it exactly: storing key ⊗ value products and multiplying by the query is perfect, which is why H3 and Hyena add gates.
- Robust: seeds 1 and 2 gave 0.257 and 0.254 (linear) against 1.000 (gated); with 2 pairs, 0.49 against chance 0.5.
Gated long convolutions in AI, robotics and aerospace
- Long logs and telemetry: subquadratic models over very long event logs where earlier entries must be recalled.
- Genomics and documents: Hyena-based models (HyenaDNA) handle contexts of up to a million tokens.
- Design lesson: check which operations your architecture can express; a missing multiplicative interaction caps performance no matter how much it trains.
References
- D. Y. Fu et al. (2023). “Hungry Hungry Hippos: towards language modeling with state space models.” ICLR.
- M. Poli et al. (2023). “Hyena hierarchy: towards larger convolutional language models.” Proc. ICML.
- A. Katharopoulos, A. Vyas, N. Pappas and F. Fleuret (2020). “Transformers are RNNs: fast autoregressive Transformers with linear attention.” Proc. ICML.