AI Disclosure: LLM tools and coding agents (Opencode) were used to assist with PyTorch implementation boilerplate, running automated benchmark sweeps, and structuring this writeup. All architectural hypotheses, experimental ablations, causality/parity audits, and reported metrics were designed and verified by me.
Over the last few months, I’ve been experimenting on my RX 9070XT to see how far you can push a sub-quadratic language modelling when you cleanly separate local token mixing, static FFN capacity, and global content-based memory.
I didn't set out to build a sparse-hop architecture, but was backed into it after a string of dead ends:
- Multi-scale dilated convolutions weren't enough for retrieval: I originally tried using multi-scale dilated convolutions (inspired by wavelets/multi-scale feature extraction) with learned scale routing to handle long-range context. On synthetic associative-recall tests, it hovered right around the random-guessing floor (~51%). Which gave the unfortunate result of Fixed-stride filters simply can't do content-based lookup when the target sits at an arbitrary past offset.
- Adding Gated Delta fixed retrieval, so I dropped the multi-scale convs: Adding a chunkwise-parallel Gated Delta state (L2-normalized queries/keys, per-head decay and write gates, blocked WY triangular solve) which solved associative recall immediately.
- Replacing Mult-scale dilated convs with a single depthwise causal conv: Ablations showed the multi-scale conv branches weren't pulling their weight and replacing them with a simple causal
k=4 depthwise conv and moving the parameter savings into wider SwiGLU layers improved perplexity by ~5% and trained 1.6× faster.
- Where the memory sits mattered more: At 25M parameters (
d=384, 6 blocks), my first prototype ran a single 3×128 Delta module as a parallel bypass reading from token embeddings and adding its output after Block 6. It extrapolated smoothly to 4,096 tokens, but trailed a parameter-matched RoPE Transformer by ~2.5 PPL at native T=1024 (26.38 vs 23.93). Moving that exact same 3×128 module inside the stack after Block 3 (B3), so earlier blocks contextualize keys/queries and later blocks process retrieved values (or atleast thats what I think is happening), dropped native PPL from 26.38 to 23.85 with zero extra cache (0.217 MiB).
- Putting Delta in every layer actually hurt: Next, I tested placing a
3×128 Delta module in all 6 blocks (which narrowed SwiGLU layers). Native PPL degraded to 26.76 while training almost 2× slower. Giving a few well-spaced global "memory hops" (B2+B4) plenty of SwiGLU capacity beat dense recurrent layers across every length.
Parameter-Matched Results (25M, WikiText-103, 100M Targets)
All models share the exact same ~21.46M non-embedding parameter budget (d=384, T=1024 native training, BF16 + torch.compile). One thing I ran into during eval was, raw RoPE blew up to 96.24 PPL at 4096 tokens, which initially looked like a huge extrapolation win; until I evaluated that same RoPE checkpoint with zero-shot YaRN, which brought it down to 23.27. Even against YaRN, the 2-hop B2+B4 model held a slight edge across all three context lengths while decoding ~6× faster with a constant 0.407 MiB cache.
| Model (~21.46M backbone) |
Delta Hops |
PPL u/1024 (s42 / s1337 / mean) |
PPL u/2048 (mean) |
PPL u/4096 (mean) |
Train tok/s |
Decode ms/tok u/4096 |
Cache MiB |
| RoPE Transformer (+ eval YaRN) |
0 |
23.93 / 24.32 / 24.12 |
23.34 |
23.27 |
190,391 |
10.953 |
146.250 |
In-Stack Sparse Delta (B3) |
1 |
23.85 / 24.52 / 24.19 |
23.54 |
23.20 |
178,148 |
1.471 |
0.217 |
In-Stack Sparse Delta (B2+B4) |
2 |
23.66 / 24.25 / 23.96 |
23.30 |
22.94 |
147,810 |
1.781 |
0.407 |
Dense Delta (B1–B6, s42 only) |
6 |
26.76 / — / 26.76 |
25.95 |
25.50 |
93,884 |
3.558 |
1.169 |
Caveats & What's Next
- Scale & data: Everything above is at 25M parameters on WikiText-103 (
100M targets), and the dense 6-hop control was only run on a single seed. (I neither have the GPU budget to go above 125M nor the monetary budget to rent a GPU for testing higher scales).
- Verification: Every checkpoint passed a strict FP64 suffix-causality audit (
0.0 leakage from future tokens) and step-by-step cached-decode parity checks.
- Next step: I just cleaned up the codebase into a standalone pure-PyTorch repo (
sparse-delta-lm) with 125M presets (1:3 sparse-hop ratio, 4 hops across 12 blocks) and lm-evaluation-harness hooks to see if this holds up on FineWeb-Edu (2.5B tokens) and standard zero-shot tasks (PIQA, HellaSwag, ARC-Easy, WinoGrande, LAMBADA).
Repo: https://github.com/SnappierSoap318/sparse-delta-lm
If anyone has tried similar sparse recurrent/linear-attention interleaving at larger scales—or sees flaws in how I parameter-matched the SwiGLU width trade-off—I’d love to hear your thoughts.