MCPcopy Index your code
hub / github.com/fla-org/flash-linear-attention

github.com/fla-org/flash-linear-attention @v0.5.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.1 ↗ · + Follow
3,611 symbols 14,087 edges 564 files 545 documented · 15% 1 cross-repo links updated 3d agov0.5.1 · 2026-06-18★ 5,29739 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Flash Linear Attention

hf_model Discord

💥 Flash Linear Attention brings together hardware-efficient building blocks, training-ready layers, and components for modern sequence models, spanning linear attention, sparse attention, state space models, and hybrid LLM architectures. All implementations are platform-agnostic and verified on NVIDIA, AMD, and Intel hardware. Pull requests are welcome!


News

  • [2026-06] 🔭 Add Parallax implementation to fla (paper) — parameterized local linear attention: softmax attention with a learned first-order correction from a secondary query-side stream.
  • [2026-06] 🧱 Add Wall attention implementation to fla (blog) — full softmax attention with a learned per-channel multiplicative decay, a RoPE-free positional encoding from Tilde Research.
  • [2026-05] 🚪 Add Gated DeltaNet 2 (GDN-2) implementation to fla (paper) — decouples erase and write gates into independent channel-wise gates on top of KDA.
  • [2026-05] 🦅 Add Raven implementation to fla (repo).
  • [2026-05] 🚀 Add YOCO (You Only Cache Once) implementation to fla.
  • [2026-05] ⚡ Add fused AttnRes support to fla (paper).
  • [2026-04] 🐍 Add Mamba3 implementation to fla (paper).
  • [2026-04] 🧱 Add MoBA (Mixture of Block Attention) implementation to fla, with FlashMoBA backend support.
  • [2026-04] 🧱 Add TileLang backend support for selected kernels.
  • [2026-04] 🎯 Add GPT-OSS-style attention sink support to fla's attention kernels.
  • [2026-03] 🚀 Add Context Parallel support for KDA and GDN, enabling efficient distributed training across sequence dimension.
  • [2025-10] 🌘 Add Kimi Delta Attention (KDA) implementation to fla (paper).
  • [2025-09] 🌲 Add DeltaFormer implementation to fla (paper).
  • [2025-09] 🐻 Thrilled to announce that GDN has been integrated into Qwen3-Next. Check out their blog post for more info!
  • [2025-08] 🌲 Add Log-Linear Attention implementation to fla (paper).
  • [2025-08] 🎓 Add MoM implementation to fla (paper).
  • [2025-07] 🐳 Add MLA implementation to fla (paper).
  • [2025-07] 🛣️ Add PaTH Attention implementation to fla (paper).

Older news

  • [2025-06] 🎉 Add MesaNet implementation to fla (paper).
  • [2025-06] 🐍 Add Comba implementation to fla (paper).
  • [2025-05] 🎉 Add Rodimus* implementation to fla (paper).
  • [2025-04] 🎉 Add DeltaProduct implementation to fla (paper).
  • [2025-04] 🎉 Add FoX implementation to fla (paper).
  • [2025-03] ~~We have changed the default initializer_range to the magic 🐳 0.006~~ The initializer_range was rolled back to the default value of 0.02. For actual training, we recommend trying both.
  • [2025-02] 🐳 Add NSA implementations to fla. See kernels here.
  • [2025-01] 🔥 We are migrating to torchtitan-based training framework. Check out the flame repo for more details.
  • [2025-01] 🦅 Add RWKV7 implementations (both kernels and models) to fla.
  • [2024-12] Add flash-bidirectional-attention to fla-org (repo).
  • [2024-12] 🎉 Add Gated DeltaNet implementation to fla (paper).
  • [2024-12] 🚀 fla now officially supports kernels with variable-length inputs.
  • [2024-11] The inputs are now switched from head-first to seq-first format.
  • [2024-11] 💥 fla now provides a flexible way for training hybrid models.
  • [2024-10] 🔥 Announcing flame, a minimal and scalable framework for training fla models. Check out the details here.
  • [2024-09] fla now includes a fused linear and cross-entropy layer, significantly reducing memory usage during training.
  • [2024-09] 🎉 Add GSA implementation to fla (paper).
  • [2024-05] 🎉 Add DeltaNet implementation to fla (paper).
  • [2024-05] 💥 fla v0.1: a variety of subquadratic kernels/layers/models integrated (RetNet/GLA/Mamba/HGRN/HGRN2/RWKV6, etc., see Models).
  • [2023-12] 💥 Launch fla, offering a collection of implementations for state-of-the-art linear attention models.

Models

Year Model Paper
2022 ABC ABC: Attention with Bounded-memory Control code
2023 RetNet Retentive network: a successor to transformer for large language models code
2023 HGRN Hierarchically Gated Recurrent Neural Network for Sequence Modeling code
2024 GLA Gated Linear Attention Transformers with Hardware-Efficient Training code
2024 Based Simple linear attention language models balance the recall-throughput tradeoff code
2024 Rebased Linear Transformers with Learnable Kernel Functions are Better In-Context Models code
2024 DeltaNet Parallelizing Linear Transformers with Delta Rule over Sequence Length code
2024 HGRN2 HGRN2: Gated Linear RNNs with State Expansion code
2024 RWKV6 Eagle and Finch: RWKV with Matrix-Valued States and Dynamic Recurrence code
2024 LightNet You Only Scan Once: Efficient Multi-dimension Sequential Modeling with LightNet code
2024 YOCO You Only Cache Once: Decoder-Decoder Architectures for Language Models code
2024 Mamba2 Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality code
2024 GSA Gated Slot Attention for Efficient Linear-Time Sequence Modeling code
2024 MLA DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model code
2025 Samba Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling code
2025 Gated DeltaNet Gated Delta Networks: Improving Mamba2 with Delta Rule code
2025 RWKV7 RWKV-7 "Goose" with Expressive Dynamic State Evolution code
2025 NSA Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention code
2025 FoX Forgetting Transformer: Softmax Attention with a Forget Gate code
2025 DeltaProduct DeltaProduct: Improving State-Tracking in Linear RNNs via Householder Products code
2025 Rodimus* Rodimus*: Breaking the Accuracy-Efficiency Trade-Off with Efficient Attentions code
2025 MesaNet MesaNet: Sequence Modeling by Locally Optimal Test-Time Training code
2025 Comba Comba: Improving Bilinear RNNs with Closed-loop Control code
2025 PaTH PaTH Attention: Position Encoding via Accumulating Householder Transformations code
2025 MoM MoM: Linear Sequence Modeling with Mixture-of-Memories code
2025 Log-Linear Attention Log-Linear Attention code
2025 DeltaFormer Understanding Transformer from the Perspective of Associative Memory

Core symbols most depended-on inside this repo

exp2
called by 337
fla/ops/utils/op.py
backward
called by 281
fla/modules/grpo.py
exp
called by 248
fla/ops/utils/op.py
prepare_chunk_indices
called by 149
fla/ops/utils/index.py
normalize
called by 145
scripts/utils/autotune_export.py
register
called by 111
fla/ops/backends/__init__.py
check_shared_mem
called by 95
fla/utils/_device.py
fused_attnres
called by 91
fla/ops/attnres/fused.py

Shape

Function 1,738
Method 1,251
Class 403
Route 219

Languages

Python100%

Modules by API surface

fla/modules/activations.py86 symbols
fla/modules/layernorm.py67 symbols
fla/modules/fused_norm_gate.py47 symbols
fla/modules/feature_map.py44 symbols
fla/models/utils.py40 symbols
fla/ops/utils/cache.py35 symbols
benchmarks/cp/test_gdn_with_cp.py31 symbols
fla/models/yoco/modeling_yoco.py29 symbols
fla/modules/backends/triton_ascend/causal_conv1d.py28 symbols
fla/modules/backends/triton_ascend/activations.py26 symbols
fla/modules/backends/triton_ascend/__init__.py26 symbols
fla/models/rwkv7/modeling_rwkv7.py26 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

transformers4.45.0 · 1×

For agents

$ claude mcp add flash-linear-attention \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact