Skip to content
rickey1990Public

About

PPLSTM is a research prototype exploring a parallel, permutation-mixed alternative to xLSTM's sequential sLSTM cell. Includes PyTorch code, tests and early benchmarks.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PPLSTM — Parallel Permutation Long Short-Term Memory

Research prototype · November 2026

PPLSTM is a parallel-scannable, three-channel permutation-mixed recurrent memory cell being investigated as a practical alternative to the sequential sLSTM component in xLSTM-style models. The aim is comparable useful language and state-tracking capability with faster training, not necessarily smaller models or superior accuracy.

Important: PPLSTM changes the sLSTM recurrence; it is not mathematically equivalent to ordinary sLSTM. The GPU implementations below keep the PPLSTM recurrence, not the sLSTM recurrence.

Three implementations — same PPLSTM mathematics

Implementation What changes? Execution method Where to look
PPLSTM / PyTorch reference Original six-permutation, signed-carry cell; no accelerator-specific code PyTorch prefix scans, eager execution pplstm.py · proof of concept
PPLSTM + CUDA Graphs No change to the cell equations or scan code Captures/replays the existing PyTorch forward and backward graph, reducing launch overhead Graph comparison PDF · Colab notebook
PPLSTM + fused T4 CUDA + Graphs Same PPLSTM recurrence and trainable parameters; replaces the memory scan, normalizer scan, output combination and their backward calculation with specialised CUDA code Fused CUDA kernels plus CUDA Graph capture/replay 10M equivalence PDF · CUDA source · Kaggle notebook

Terminology: “PPLSTM + Graphs” is not the non-accelerated original. It is the original PyTorch PPLSTM already running with CUDA Graphs. The fused benchmark measures the additional speedup on top of Graphs. The mLSTM blocks remain mLSTM blocks in both hybrids.

Key experiment results

These are different studies with different setups. Compare models within the same row/study.

Study Comparison and result Important qualification
5M-token proof of concept Miniature PPLSTM test PPL 54.50 vs sLSTM 51.43; similar quality One-layer CPU text experiment, one seed
50M-token xLSTM replacement Hybrid PPLSTM 97.04 vs vanilla xLSTM 97.78 test PPL; 22,790 vs 2,187 training tok/s Vanilla PyTorch sLSTM, not the official optimised sLSTM CUDA kernel; no Graphs
200M-token FineWeb-Edu mLSTM+PPLSTM+Graphs 87.83 vs Transformer SDPA 87.60 test PPL; 35,121 vs 263,885 tok/s 529,880 vs 528,224 parameters; one seed; context 128
10M-token fused-kernel verification PPLSTM+Graphs 34,628 vs fused PPLSTM+Graphs 111,031 training tok/s (3.21×); test PPL 132.52 vs 132.37 Same hybrid architecture, data and parameter count, T4 FP32 prototype; one seed

The CUDA Graph speed study also reports a 2.20×–6.37× throughput advantage over vanilla PyTorch sLSTM+Graphs across nine tested single-block configurations. These runs do not establish a speed advantage over the production optimised xLSTM CUDA kernels.

Numerical equivalence and scope

  • The PyTorch PPLSTM cell's parallel and serial computations agree on tested outputs and gradients.
  • The fused T4 implementation passed 20/20 recorded numerical/execution checks. Same-weight full-model comparisons through training showed a largest reported logit difference of 1.24e-5 and overall relative gradient L2 difference of 5.18e-7.
  • Fusion did not change PPLSTM's six permutations, signed gate, gate initialization or trainable parameter structure.
  • This supports close numerical agreement and comparable training behaviour on tested T4/FP32 workloads; it does not guarantee bitwise equality, identical long-run weight trajectories, or performance on every GPU.

Documentation and reproducibility

Quick start — reference cell

pip install torch
python test_pplstm.py
python pplstm.py
import torch
from pplstm import PPLSTM
cell = PPLSTM(width=36)
out = cell(torch.randn(2, 128, 36))
print(out.shape)  # [2, 128, 36]

The CUDA Graph and fused implementations are demonstrated in the notebooks and require a suitable CUDA environment. The FineWeb-Edu corpus is not redistributed in this repository.

Research status

What is supported: the proposed PPLSTM recurrence is scan-compatible; comparable small-model language performance has been measured; the T4 fused implementation substantially improved training throughput while closely matching the PyTorch reference numerically.

What remains open: equivalence of capabilities to hidden-state-dependent sLSTM across diverse tasks; multi-seed scaling; fused-kernel correctness and robustness beyond tested GPU/dtypes/shapes; comparison against official optimised sLSTM kernels on compatible hardware. Synthetic-task results belong to the tested combined mLSTM+PPLSTM models, not automatically to isolated PPLSTM.

This is experimental software. The original AGPL-3.0-only licence applies to PPLSTM project source; other dependencies may have their own licences. See LICENSE and commercial licensing.

Related work: xLSTM paper · NX-AI/xlstm.

About

PPLSTM is a research prototype exploring a parallel, permutation-mixed alternative to xLSTM's sequential sLSTM cell. Includes PyTorch code, tests and early benchmarks.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages