Model or dataset
NX-AI/xlstm avatar
NX-AI/xlstm

xLSTM states three different PyTorch floors, and its build cache is keyed on a directory the repository does not have

Official repository of the xLSTM.

2,219 stars188 forksPythonApache-2.0

At a glance

What is it?
NX-AI/xlstm is the reference implementation of the xLSTM recurrent architecture, in a compiled package with a standalone single-file version of its 7B model. The readme claims support from PyTorch 1.8, the manifest requires 2.0, and the three shipped environments start at 2.2. The fast kernels live in a separate repository and are not installed automatically on Python 3.10.
Who is it for?
This is the repository to read if you want the xLSTM paper's architecture rather than a summary of it, because the block stack and the language model class are both importable and the 7B variant is a single file you can read in one sitting. Three things to settle first.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 17 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • NX-AI/xlstm2,219 ★ · +22
Star history
Repository2026-09-102026-11-23
NX-AI/xlstm2.2k2.2k

22 Stars in the last 74 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Three PyTorch floors, none of them the same number

The readme says the package was tested for PyTorch versions from 1.8 upwards. The manifest requires 2.0, in the runtime dependencies and again in the build requirements. And the repository ships three conda environment files, named for PyTorch 2.2 with CUDA 12.1, 2.4 with 12.4, and 2.6 with 12.6.

So four numbers describe one requirement, and they do not agree. The oldest environment anyone assembled starts at 2.2, which is already two minor versions above what the manifest will accept and thirteen above the oldest version the prose claims to have tested.

The quickstart resolves it by picking one. It tells you to create a conda environment from the PyTorch 2.4 file and activate it, then install the package:

bash
conda env create -n xlstm -f environment_pt240cu124.yaml
conda activate xlstm

That is a reasonable default and it is not the same as the stated support range. If you are deciding whether a given machine is supported, the three environment files are the only evidence of what anyone actually assembled, and the prose figure is the one to discount.

Cloning instead of installing from the index is also supported, and the editable install is the third path:

bash
git clone https://github.com/NX-AI/xlstm.git
cd xlstm
pip install -e .

The fast kernels are a separate repository, and 3.10 does not get them

The 7B model's speed comes from a package called mlstm_kernels, which lives in its own repository under the same organisation. The manifest lists it as a dependency, but conditionally: the marker restricts it to Python 3.11 and above, while the interpreter floor is 3.10.

That is a real gap, not a technicality. A Python 3.10 install satisfies the manifest completely and silently omits the kernels, and the readme's own minimal installation section tells you to install that package by hand when you want the 7B model. So the documented path for 3.10 users is manual, and nothing in the dependency list hints at it.

A third repository enters the picture further down, offered for standalone and faster kernels for the sLSTM variant specifically. Three projects then sit in the dependency chain for one model: this one, the kernels, and the faster-kernel library.

The two entry points for the paper's own architecture are named separately, and the distinction is a real one rather than cosmetic. A block stack is meant to be dropped into an existing project as an alternative backbone, structurally similar to a stack of transformer blocks but built from xLSTM blocks. A language model class is meant for language modelling and other token-based work. If you are integrating rather than training, the first is the one you want.

The build downloads torch, and the cache keys point at a missing directory

This is a compiled package. The build backend is a CMake-based Python build system, with the C++ binding library and PyTorch all listed as build requirements rather than only as runtime dependencies. That last one means an isolated build environment fetches a full PyTorch wheel before your own install even starts, which is the single biggest practical difference between installing this project and installing a pure-Python one.

The caching configuration is where it gets odd. It lists twelve file patterns as cache keys, and eleven of them are glob patterns under a path for the sLSTM block sources, covering C, C++, CUDA, and their header forms, in two subdirectories. The thirteenth entry is the CMake file itself.

The repository's top level has no directory by that name. What is there is a CMake file, a license, an authors file, the readme, three environment files, and six directories for experiments, notebooks, resources, tests, the package itself, and continuous integration. So eleven of the twelve cache keys point into a tree that is not part of this repository, which means those keys never match anything and the cache is effectively keyed on two files instead of twelve.

That is a small thing with a plausible cause, since compiled sources for the CUDA path may well live in a sibling checkout, but it is the kind of configuration that silently stops doing its job.

The sLSTM path needs a compiler, and two environment variables to get one

The scalar-memory variant of the architecture compiles for the GPU rather than shipping a binary wheel, and the readme is candid about what that costs. It requires a compute capability of 8.0 or above, which excludes a large part of the installed base.

If compilation fails, the readme offers a specific fallback and credits a named contributor for it, exporting a list of target architectures:

bash
export TORCH_CUDA_ARCH_LIST="8.0;8.6;9.0"

There is a second variable for injecting CUDA include paths when the default locations are wrong, and it can be set from the shell or from inside Python before the package is imported, which is the detail that matters for notebooks. And there is a general warning worth repeating: for custom combinations of PyTorch and CUDA, the versions have to match.

The build tool itself is a runtime dependency in the manifest, alongside the YAML parser, a serialisation format library, a packaging helper, and PyTorch. Having the build system required at run time is unusual, and it follows from the design rather than from sloppiness: this package builds native code at install time, so the tools that do the building have to be present when it is installed.

The layer configuration exposes the backend as a setting, with the CUDA backend named explicitly alongside a power-law, block-dependent initialisation for the biases.

Three kernel names decide whether you get Triton or plain PyTorch

The model configuration is where the hardware story becomes concrete. Three separate fields select the implementation, and the readme gives two complete sets of values rather than describing them.

On NVIDIA hardware, the three fields name Triton variants: a chunk-wise kernel for the matmul path, a sequence kernel, and a single-step kernel. Elsewhere, the same three fields are set to native implementations, with the readme's comments marking each substitution as no Triton kernels. So the difference between the fast path and the portable path is three strings in a config object, not a separate code path you import.

The rest of the configuration is ordinary model shape: embedding dimension, head count, block count, vocabulary size, a flag for returning the last hidden states, and a mode. The demo in the notebook initialises a random model of that shape, moves it to the GPU and runs a forward pass over a small random tensor.

Two further notes on hardware. The models were tested mostly on NVIDIA parts, and the claim for AMD is that the Triton kernels should also run there, which is a hedged sentence rather than a tested matrix. For Apple's ecosystem, the readme points to the native settings for Metal and then to a community-run port written for MLX, maintained outside this organisation. The authors are explicit that the native path is the recommendation for now, which is the most useful sentence in the section.

One file holds the whole 7B architecture

There are two papers and two architectures, and the repository keeps them apart. The first is the xLSTM paper with nine authors, which produced the architecture exposed as the block stack and the language model class. The second is the 7B paper with eight authors, which produced what the readme calls xLSTM Large, an optimised variant trained as a 7B parameter model on 2.3 trillion tokens.

The code for the optimised variant sits in its own subdirectory, separate from the rest of the package, and the readme points out something genuinely useful about it: there is a standalone single-file implementation of the architecture in one module, it needs the separate kernels package, and apart from that it has no dependency on the paper's original implementation.

That is a meaningful offer for anyone evaluating the architecture. A single file you can read end to end, with no need to hold the rest of the codebase in your head, is a different proposition from a research package with five entry points. Weights for the 7B model are published on a model host, and a demo notebook for the architecture is in the notebooks directory.

One small thing to know about the readme itself: the quickstart snippet ends mid-statement, with a call whose closing parenthesis is missing, and the block-stack example stops in the middle of its configuration. Copying either verbatim will not run.

Two CUDA index sources, one of them commented out

The manifest declares two package indexes for PyTorch itself, both marked explicit, one for the CUDA 12.6 wheel family and one for CUDA 13.0. The source mapping then routes Linux and Windows to the 12.6 index, and the line that would route anything to the 13.0 index is present in the file with a comment marker in front of it.

So CUDA 13 support is prepared in the configuration and deliberately not switched on. That is a sensible thing to do with a build that compiles native code, since a new major toolkit version is exactly where kernel compilation breaks, but it does mean anyone on 13.0 is currently on the default PyTorch wheel rather than the one this project would prefer for them.

The authorship story has a similar gap. The manifest names three authors with institutional email addresses, the first paper credits nine, the second credits eight, and the repository also carries a separate authors file. Three names in the package metadata against a nine-person paper is not wrong, but it is worth knowing which list you are reading before you cite anything.

Everything else in the manifest is conventional: a licence declared by file reference rather than by name, a Python floor of 3.10, an operating-system-independent classifier, and five keywords covering the architecture, its two competitors and the two broad fields.

Editorial conclusion

This is the repository to read if you want the xLSTM paper's architecture rather than a summary of it, because the block stack and the language model class are both importable and the 7B variant is a single file you can read in one sitting. Three things to settle first. Pick your environment from the three shipped files rather than from the stated floor, since 2.2, 2.4 and 2.6 are what was actually assembled. Install the separate kernels package yourself if you are on Python 3.10, because the manifest's marker will not do it for you. And decide whether you need the compiled path at all: the native PyTorch settings are documented in the same file as the fast ones, and on hardware without recent CUDA compute capability the slow path is the only path.

Frequently asked questions

what is xlstm

xLSTM is a recurrent neural network architecture built on ideas from the original LSTM, using exponential gating with normalization and stabilization together with a new matrix memory. The project reports promising language modelling performance against Transformers and state space models, and trained a 7B parameter model on 2.3 trillion tokens.

What does installing xlstm need?

The manifest asks for Python 3.10 or newer and PyTorch 2.0 or newer, but the repository ships three conda environment files for PyTorch 2.2, 2.4 and 2.6, and the quickstart uses the 2.4 one. For the 7B model you also need the separate kernels package, which the manifest installs only on Python 3.11 and above.

Does xLSTM run on Apple Silicon or AMD GPUs?

The models were tested mostly on NVIDIA parts, and the readme says the Triton kernels should also run on AMD. For other platforms such as Apple Metal it recommends the native PyTorch implementations, which means changing three kernel settings, and points to a community-written MLX port for the Apple ecosystem.

What is the difference between the two xLSTM entry points?

The block stack is meant to be used as an alternative backbone in existing projects, similar to a stack of Transformer blocks but built from xLSTM blocks. The language model class is for language modelling and other token-based applications. If you are working with yaml configuration, the readme notes you can build the config dataclasses with dacite.

What does the sLSTM path require from my GPU?

A compute capability of 8.0 or above, and a compiler, because this variant builds native code at install time. The readme suggests exporting a target architecture list variable if compilation fails, and a second variable to inject CUDA include paths, which can be set from the shell or from inside Python.

What is the newest xLSTM release?

v2.0.6, and the package metadata carries the same version. The release before it in the visible list is v2.0.4 from May 2025, so the visible history skips 2.0.5 and spans roughly fifteen months.

Official sources

  1. License: Apache-2.0
  2. NX-AI/xlstm on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/nx-ai-xlstm.svg)](https://hysenlabs.com/projects/nx-ai-xlstm)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/nx-ai-xlstm.svg)](https://hysenlabs.com/projects/nx-ai-xlstm)

Was this useful?