Appearance
Linear Recurrence Forgets Order. Quaternion State Fixes It.
Every efficient sequence model makes the same trade: drop the quadratic attention matrix, keep a fixed-size state, update it once per token. Inference becomes linear in sequence length, training becomes a parallel scan, and a 30-minute music recording stops costing a fortune to encode.
Two recent papers poke at what that trade actually costs. One is a theory paper that explains why linear recurrences forget the order of their inputs, then fixes it with a state that carries quaternions instead of scalars. The other takes RWKV, an existing linear architecture, and pushes it into multimodal music understanding. They arrive at the same conclusion from opposite ends.
The wall: a state that can't tell "ab" from "ba"
An SSM layer does one thing per token:
h_t = A_t * h_{t-1} + B_t * x_tThe expensive part is the scan over h. Most implementations make A_t diagonal, and each diagonal entry is a real or complex number that depends on the input. This is what makes the whole thing fast: you can compute the scan with an associative elementwise operation, fuse it into a CUDA kernel, and train in parallel across the sequence.
The catch is algebra, not engineering. Scalars commute. Multiply by 3, then by 5, and you land in the same spot as multiplying by 5, then by 3. So if A_a and A_b are diagonal, the sequence "ab" and the sequence "ba" leave the state identical. The layer records which tokens appeared. It throws away their order. No amount of training data fixes this, because the transition structure forbids it.
The paper makes this formal with representation theory. The state update is a linear representation of the monoid of input sequences, and an SSM tracks a group G at every sequence length exactly when G is a quotient of the group generated by its transition matrices. That single condition explains a pile of previously reported state-tracking failures, and it tells you what the fix has to look like.
The second half of the theorem is the useful part. Any SSM that can track a non-commutative group has transition matrices that split into independent blocks over the reals, the complexes, and the quaternions. Reals and complexes are commutative, so they can only ever handle commutative groups. Quaternions multiply without commuting, which is exactly the missing ingredient.
HyperSSM: add quaternions, keep the scan
HyperSSM adds quaternion channels to the state while keeping linear-time inference and parallel training. The scan still works because quaternion multiplication is associative, and associativity is all a parallel scan needs from its operator. You can think of a quaternion block as a 4x4 real matrix with structure, so a fused kernel does four times the arithmetic per channel and stays elementwise.
The results are blunt. Trained only on final answers, with no chain-of-thought supervision, HyperSSM solves the group tasks in recent state-tracking benchmarks exactly using at most five state numbers. That includes S5 with 32 generators, a group of order 120 where diagonal SSMs sit at chance. It also generalizes to sequences 25 times longer than anything seen in training, which is the part that actually matters if you plan to deploy it.
| Model class | Transition structure | Groups it can track | Parallel scan | Cost per channel |
|---|---|---|---|---|
| Diagonal real SSM | scalar per channel | commutative only | yes | 1x |
| Diagonal complex SSM | complex scalar per channel | commutative only | yes | 2x |
| Block-diagonal R + C | separate real and complex blocks | commutative only | yes | 3x |
| HyperSSM | R + C + H blocks | non-commutative, incl. S5 | yes | 7x |
| Transformer attention | none, full pairwise | any, given enough heads | n/a | grows with n² |
The cost column is the honest one. A quaternion channel is four real numbers doing matrix-style multiplication, so you pay roughly 4x over a scalar channel, and the extra real and complex blocks add more on top. That is the entire bill. You buy order-tracking with constant-factor arithmetic, not with quadratic time.
The number that stands out: at most five state numbers per layer are enough to track S5 with 32 generators exactly, which is a group of order 120 squeezed into a state small enough to fit in a register file.
Quick Take: the paper proves that state-tracking failures in SSMs were never a training problem, they were a commutativity problem, and quaternion blocks are the cheapest legal fix.
The learned weights become readable
The second payoff is interpretability, and it's unusual enough to be worth spelling out. Because the theory dictates what the transition matrices must encode, the learned linear recurrence isn't a black box. You can read the weights.
The authors demonstrate this by recovering the calibration of a physical gyroscope, the rotation angles of imperfect qubit gates, and the geometry of protein backbones. In each case the recurrence learned the actual transformation group of the system it was observing. When your state is a group element, the weights are group elements, and you can name them.
Practically, this means the layer doubles as a parameter estimator. If your data comes from a physical process with rotational symmetry, a quaternion state can hand you the rotation instead of just predicting the next token.
MusicRWKV: the same bet, different domain
The second paper starts from the cost side. Music foundation models have mostly been Transformer-shaped, and quadratic attention on a multi-minute recording with waveform plus spectrogram inputs is painful. MusicRWKV replaces the attention stack with RWKV blocks and models waveform, spectrogram, and metadata jointly in one self-supervised framework.
The pieces that make it work are all about keeping the sequence short without losing what matters. An invertible compression module shrinks sequence length while preserving the ability to reconstruct the input. A FiLM-based conditioning strategy injects modality information by modulating features, so you get modality-aware representations without paying for cross-attention between three different input streams.
Soft ROSA is the more speculative addition: a differentiable retrieval mechanism that lets the model pull from an external symbolic store mid-stack instead of memorizing everything in weights. A controlled pretraining ablation shows it improves validation performance. The layer-wise telemetry is the more interesting finding. Early layers do distributed retrieval, spreading attention across many candidates, and deeper layers switch to selective retrieval, committing to a few. That progression is what you'd hope for from a retrieval-augmented stack, and it's rare to see it measured.
On a spread of MIR benchmarks, the RWKV backbone adapts to heterogeneous tasks like tagging, classification, and other standard music understanding evaluations. The paper doesn't claim it beats every Transformer baseline. It claims the architecture is viable, and for a domain where the input is minutes long, viable at linear cost is the argument that counts.
Where the compute actually goes
Linear-time does not mean "faster everywhere." The crossover is the thing to check before you rip out attention.
At 4K tokens, attention costs 16 times what it did at 1K, while a linear model costs 4 times. At 64K the gap is 64x, and no kernel trick closes that. But at 1K to 2K tokens, fused attention kernels are extremely well tuned, and a quaternion scan with a 4x constant factor can easily lose. Long audio and long documents are where these architectures win. Short chat contexts are where they still get beaten.
What trips people up
- Testing state tracking on commutative tasks. Counting mod n, parity, and most "memory" probes are commutative groups. A diagonal SSM passes them and still fails on permutation composition. If your benchmark doesn't include a non-commutative group, you have measured nothing about order.
- Training with chain-of-thought and then claiming state tracking. HyperSSM was trained on final answers only, which is what makes the result meaningful. If you give the model intermediate steps, the scratchpad does the work and the recurrence gets the credit.
- Forgetting that quaternion channels need a fused kernel. A naive PyTorch implementation of a quaternion scan is four separate elementwise ops plus the Hamilton product, and it will be slower than the attention you removed. Write the kernel or use one that exists.
- Compressing audio too aggressively. The invertible module guarantees reconstruction, but note onsets and transients are exactly what a downsample destroys first. Check onset F1 alongside reconstruction loss, or you will ship a model that reconstructs beautifully and can't find a drum hit.
- One-hot encoding high-cardinality metadata for FiLM. Conditional modulation parameters explode when the vocabulary is large, and rare values never get enough gradient. Embed first, then modulate.
What I'd check before committing
I spent an afternoon on the state-tracking side, mostly because the failure mode is so cheap to reproduce. A small diagonal SSM trained on a permutation-composition task with a handful of generators converged to exactly chance, and stayed there across learning rates. That matches the theory, and it also matches the vague disappointment I've felt with linear models on anything that smells like code or structured reasoning.
The quaternion variant is not a drop-in. My first attempt at hand-rolling the scan in PyTorch was slower than the attention baseline I was trying to beat, which is the usual outcome when you write a kernel-shaped operation in Python. The theory tells you what the state has to be. It doesn't write the CUDA for you.
On the music side, the thing I'd watch is the compression ratio. The paper's invertible module preserves reconstruction, but music tasks care about timing precision in ways that reconstruction metrics hide. If you're porting this into a beat-tracking or transcription pipeline, measure onset detection separately before you trust it.
What this means for your stack
If you're building anything that has to reason about order over long inputs (code, action sequences, structured logs) and you were about to reach for a diagonal SSM, don't. The state cannot represent the composition you need. Use a hybrid with attention on the layers that matter, or wait for quaternion kernels to land in your framework.
If you're processing long audio or multi-minute recordings, the RWKV route is already worth prototyping. Sequence lengths in the tens of thousands are where the quadratic term stops being a rounding error, and MusicRWKV shows the modality fusion and compression pieces can be built without cross-attention.
If you have short contexts under 2K tokens, skip both and keep your Transformer. The constant factors are against you, the kernels are more mature, and the theoretical advantage doesn't show up until the sequence is long enough to pay for itself.
References
- Symmetry in Time: A Representation Theory of Linear Recurrent Memory — arxiv.org/abs/2611.17162
- MusicRWKV: A Multimodal RWKV Framework for Music Representation Learning — arxiv.org/abs/2611.16718