Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
A collection of memory efficient attention operators implemented in the Triton language.
| Date | Stars |
|---|---|
| 2026-07-30 | 301 |
| 2026-08-07 | 304 |
| 2026-08-15 | 305 |
| 2026-08-27 | 305 |
| 2026-08-28 | 306 |
| 2026-08-29 | 307 |
| 2026-08-31 | 307 |
| 2026-09-01 | 307 |
| 2026-09-02 | 308 |
| 2026-09-09 | 308 |
| 2026-09-15 | 309 |
| 2026-09-18 | 311 |
| 2026-09-19 | 312 |
| 2026-09-21 | 312 |
| 2026-09-23 | 312 |
| 2026-09-24 | 312 |
| 2026-09-28 | 313 |
| 2026-09-29 | 314 |
| 2026-09-30 | 318 |
| 2026-10-07 | 318 |
| 2026-10-10 | 318 |
| 2026-10-13 | 318 |
| 2026-10-17 | 319 |
| 2026-10-18 | 320 |
| 2026-10-19 | 321 |
| 2026-10-20 | 321 |
| 2026-10-21 | 324 |
| 2026-10-22 | 326 |
| 2026-10-24 | 326 |
| 2026-10-27 | 327 |
| 2026-11-04 | 327 |
Today
— stars today
This week
— stars this week
This month
+9 stars this month
Momentum
15.0
growth rate 0.00%/day
# FlagAttention
<p align="center">
<img src="./assets/logo/horizontal-blue.png" width="400" alt="FlagAttention">
</p>
[中文版](./README_cn.md)
FlagAttention is a collection of memory-efficient attention operators implemented with [Triton](https://github.com/triton-lang/triton). It targets model training and inference workloads that need custom attention-score transformations, paged or sparse KV-cache layouts, or recurrent linear-attention kernels.
Like [FlashAttention](https://arxiv.org/abs/2205.14135), the dense kernels tile the computation and recompute intermediates instead of materializing the full attention matrix. The repository also contains decoding, block-sparse, quantized, and recurrent operators that do not fit the standard scaled-dot-product-attention interface.
> [!IMPORTANT]
> The repository contains operators at different maturity levels. Only FlashAttention and Piecewise Attention are currently marked `stable`; the remaining operator families are `alpha`. [`conf/operators.yaml`](./conf/operators.yaml) is the source of truth for stages, tests, and benchmark entry points.
## Operator overview
| Operator family | Public import | Main layout/use | Gradient support | Stage |
| --- | --- | --- | --- | --- |
| FlashAttention | `flag_attn.flash_attention` | Dense attention; `q: [B,Hq,M,D]`, `k/v: [B,Hkv,N,D]`; MQA/GQA, dropout, auxiliary outputs | Forward + backward | Stable |
| Piecewise Attention | `flag_attn.piecewise_attention` | Dense attention with two Q/K pairs selected by token distance | Forward + backward | Stable |
| Split-KV FlashAttention | `flag_attn.flash_attention_split_kv` | Long-KV decoding and low-query-parallelism workloads | Forward | Alpha |
| Paged Attention | `flag_attn.paged_attention` | Single-token queries over a paged KV cache | Forward | Alpha |
| MiniMax M3 sparse attention | Six `flag_attn.minimax_m3_*` functions | 128-token page scoring, top-k selection, sparse prefill and decode | Inference | Alpha |
| Chunk GLA | `flag_attn.chunk_gla` | Recurrent gated linear attention; `[B,T,H,D]`, fixed or packed variable lengths | Forward + backward | Alpha |
| Chunk Gated Delta Rule | `flag_attn.chunk_gated_delta_rule` | Chunked delta-rule recurrence; head-first or sequence-first | Forward | Alpha |
| GDN2 | `flag_attn.chunk_gdn2` | Chunked GDN2 prefill with native Triton/TLE and vendor paths | Forward/inference | Alpha |
| Kimi Delta Attention | `flag_attn.chunk_kda` | Specialized chunked KDA inference; constraints depend on the active backend | Inference | Alpha |
| SageAttention | `flag_attn.sage_attention.forward`, `per_block_int8` | Per-block INT8 Q/K quantization and attention; HND or NHD layout | Forward | Alpha |
| Parallel NSA | `flag_attn.parallel_nsa.parallel_nsa`, `parallel_nsa_compression` | Native sparse attention and compression; fixed or packed variable lengths | Forward + backward | Alpha |
The top-level package exports the dense, paged, recurrent, KDA/GDN2, and MiniMax APIs. SageAttention and Parallel NSA are submodule APIs. Vendor-specific development interfaces are available under `flag_attn.runtime.backend._<vendor>` but are not treated as stable public APIs.
## Requirements and backends
- Python 3.10 or newer.
- A PyTorch build for the target accelerator.
- Triton 2.2 or newer, or a vendor runtime that provides compatible Triton APIs.
- A supported accelerator for kernel execution. CPU-only hosts can inspect package metadata, but cannot run the attention kernels.
PyTorch and accelerator runtimes are intentionally not hard dependencies in [`pyproject.toml`](./pyproject.toml), because the correct packages depend on the device and driver stack. Install the appropriate PyTorch build before FlagAttention.
The runtime recognizes `nvidia`, `amd`, `hygon`, `iluvatar`, `metax`, `enflame`, `ascend`, `cambricon`, `mthreads`, `intel`, and `cpu` for device metadata and explicit selection. Recognition does not mean that every operator is implemented or tested on every backend; Excerpt of 21,814 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:3682812b35afecda, topic:triton-lang, readme:quantization, readme:quantized