Quick startOne op, or one TOML file.
JLA installs from PyPI as jax-linear-attention. Call a kernel from your own JAX model with jla.ops.linear_attention(..., impl="auto"): it runs the Mosaic GPU kernel on an H100 and the chunked JAX op anywhere else. Or train a model from one TOML file with jla train.
Python 3.12 or newer and JAX 0.11.2 (the version is pinned). The kernels need an NVIDIA Hopper GPU (H100 or H200) and a CUDA 13 driver; on any other device every op falls back to its plain-JAX implementation. Quick start
pip install "jax-linear-attention[cuda]"
CPU only (reference and chunked ops, small models):
pip install jax-linear-attention
Why JLAKernels for the layers new models use.
The layers behind newer language models (Mamba, Gated DeltaNet, KDA, RWKV-7, GLA) are recurrences, and they need dedicated kernels to train fast. PyTorch has them in Flash Linear Attention's Triton kernels; in JAX they have mostly run as plain JAX ops, which XLA cannot fuse into one efficient pass.
01Exact
Three implementations of every recurrence.
A token-by-token reference (the oracle), a chunk-parallel JAX op that runs on any JAX backend, and a Pallas Mosaic GPU kernel for Hopper. The tests hold each kernel to the reference on dense inputs, packed documents, initial and final states and every gradient.
02Fail-closed
Slower, never wrong.
impl="auto" runs a kernel only for the shapes, dtypes and options its GPU tests cover; every other call runs the chunked JAX op, so an unsupported call is slower, never wrong.
03Packed documents
Every kernel, every document.
segment_ids reset the state at document boundaries inside every kernel, so a packed batch trains exactly as its documents would one by one.
04Training stack
One TOML file per experiment.
Data, FSDP, tensor, expert and pipeline parallelism; FP8 with delayed scaling; dropless MoE on grouped-GEMM kernels; crash-consistent checkpoints with exact resume; SFT and DPO; Hugging Face import and export; perplexity and lm-evaluation-harness. Every option
Where we loseAs plainly as where we win.
The cases where JLA is slower than the alternatives, with their numbers. Every case and the reason
Softmax attention against FA3
The forward is 0.90–0.92× FA3 on causal attention, short of the 0.95× target, and forward + backward 0.77–0.92× with the default backward (0.87–1.00× with the opt-in fused one); impl="auto" keeps cuDNN for dense causal and windowed calls.
Gated DeltaNet against FlashQLA
On long single sequences (one row of 16K–64K tokens: 0.69–0.78× forward + backward at 8 heads, 0.68–0.73× at 16) and with packed documents at small B × H (one row of 8 heads with 16 documents: 0.74–0.77× from 16K tokens, 0.58–0.60× at 2K–8K). FlashQLA starts each sequence piece a few chunks early, from zero (an approximation); our split is exact, and its backward is two passes against FlashQLA's one fused kernel. At head dim 64, which FlashQLA does not support, packed documents in short rows also trail FLA (0.83–0.93× forward + backward at 2K–8K tokens).
KDA inference against FlashKDA
At large B × H (0.57× at (8, 2048, 32)): FlashKDA keeps a bf16 state and approximate exp, and fuses its per-chunk preparation into one kernel.
Hopper only, one JAX version
The kernels need an H100 or H200 (everything else runs plain JAX), and JAX is pinned to 0.11.2 because Mosaic GPU's API changes with every JAX release. A few kernels (the Mamba-2 row kernels, the Gated DeltaNet piece scan, fp8_swiglu) are Pallas Triton, which JAX 0.11.2 deprecates; they move to Mosaic GPU before the pin does.
Our linear-attention kernels port the Triton kernels of Flash Linear Attention and follow its layer definitions, and its trainer, flame, is our end-to-end baseline. FlashAttention-3 shaped our attention kernel, our Mamba kernels port Mamba's, FlashQLA and FlashKDA showed the way for the Gated DeltaNet and KDA kernels, and Tokamax and JAX's Pallas examples are where our attention and GEMM kernels began. Acknowledgements
JLA is an independent project. It is not affiliated with or endorsed by Google or the JAX team; “JAX” names the framework it is built on.
Open source
Built in
the open.
JLA is free and open source under Apache-2.0. Version 0.1.0 is early development, and its APIs will change. Contributions are welcome, with a DCO sign-off on every commit.