I've been continuing work on my experimental architecture, PPLSTM (Parallel Permutation Long Short-Term Memory), and wanted to share some of my latest results.
What am I trying to solve?
The original xLSTM architecture introduced two types of LSTM:
mLSTM: Uses matrix memory and a query, key and value (QKV) mechanism, providing associative memory and parallelisable training.
sLSTM: Uses scalar memory with recurrent memory mixing, offering interesting state-tracking capabilities, but its dependence on previous hidden states prevents full parallelisation across the sequence.
NX-AI addressed this bottleneck in their xLSTM 7B architecture by moving entirely to mLSTM blocks.
However, rather than removing sLSTM and its form of memory mixing, I wanted to explore whether some of its useful capabilities could be retained in a parallelisable alternative.
PPLSTM
My approach uses groups of three memory channels, a learned mixture of six possible permutations and a signed carry mechanism.
By making these transformations dependent on input features rather than previous hidden states, the recurrence can be computed using an associative parallel scan.
It's not mathematically equivalent to sLSTM, but the aim is to retain comparable useful capabilities without the same sequential bottleneck.
Language modelling results
Initial standalone 5M-token CPU experiment (test perplexity, lower is better):
Transformer: 58.90
sLSTM: 51.43
PPLSTM: 54.50
I then tested replacing the sLSTM blocks within a hybrid xLSTM architecture with PPLSTM.
50M-token experiment:
Vanilla xLSTM: 97.78 PPL | 2,187 tok/s
mLSTM + PPLSTM: 97.04 PPL | 22,790 tok/s
This represents approximately a 10.4x training speed improvement, although the comparison was against vanilla PyTorch sLSTM, not the official optimised CUDA kernel.
200M-token FineWeb-Edu experiment (approximately 530K parameters per model, context length 128):
mLSTM + PPLSTM + CUDA Graphs: 87.83 PPL | 35,121 tok/s
Transformer SDPA: 87.60 PPL | 263,885 tok/s
While the Transformer was considerably faster, the language modelling performance was very similar.
Memory and state tracking
In separate synthetic experiments, trained at a sequence length of 128 and evaluated at 512, the hybrid achieved the following results against a Transformer:
Mod-4 state tracking: 89.06% vs 27.93%
Delayed recall: 100% vs 82.23%
Key-value recall: 100% vs 22.07%
Key-value updates: 93.55% vs 19.73%
Parity: Both approximately 49%
Further synthetic training brought the hybrid's mod-4 state-tracking accuracy to approximately 96%.
I've also experimented with standalone PPLSTM against a Transformer, although I haven't conducted a full ablation study. Parity and more complex multi-hop reasoning remain unsolved in my current experiments.
Developing a custom CUDA kernel
As I've only had access to a Tesla T4 GPU, computational efficiency has been a big focus.
Initially, I used CUDA Graphs, achieving between 2.20x and 6.37x higher throughput than vanilla PyTorch sLSTM with CUDA Graphs across nine configurations.
I then developed a specialised fused CUDA kernel combining the memory scan, normalisation, output calculations and their backward operations, without changing the underlying PPLSTM mathematics or trainable parameters.
A separate 10M-token experiment produced:
PPLSTM hybrid + CUDA Graphs: 34,628 tok/s | 132.52 PPL
Fused PPLSTM hybrid + CUDA Graphs: 111,031 tok/s | 132.37 PPL
That's a 3.21x training speed improvement over the already CUDA Graph-accelerated implementation, with all 20 recorded numerical and execution checks passing.
I haven't yet tested the fused kernel over the full 200M-token training run.
Feedback
I'm not an academic researcher or professionally involved in the ML field , This is an independent project I've been working on out of personal interest. So i have tried to package it up in a manner the community would want.
These are small-scale, largely single-seed experiments, so there's still plenty of work to be done before drawing broader conclusions.
I'd really appreciate any feedback or constructive criticism from people with more experience in the field, whether that's regarding the architecture, mathematics, experimental methodology or CUDA implementation. Maybe even getting some sort of team together.
All the source code, mathematical explanations, experiment reports, CUDA kernel and reproducible notebooks are available on GitHub.
GitHub: https://github.com/rickey1990/PPLSTM
Related xLSTM 7B paper: https://arxiv.org/abs/2503.13427