# fla-org/native-sparse-attention

🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"

Repository: https://github.com/fla-org/native-sparse-attention
Canonical: https://ross.abutalabs.com/products/native-sparse-attention
Homepage: https://arxiv.org/abs/2502.11089
Language: Python
License: MIT
License Family: permissive
Last push: 2026-02-05T02:22:09+00:00

## Health v2 (maintenance only)
Score: 49/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 65, release rhythm 35, longevity 39
- inputs: {"age_days": 558, "days_push": 210, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1020, forks 54 (observed 2026-08-28T04:03:15.542956+00:00)

## What it is
Efficient Triton kernel implementations of Native Sparse Attention (NSA), a hardware-aligned, natively trainable sparse attention mechanism for long-context language models. It provides fused kernels for token compression, top-k block selection, and sliding-window attention, with support for training and variable-length inputs.

## Use cases
- speed up long-context attention in transformer models
- pretrain language models with sparse attention
- implement natively trainable sparse attention kernels in Triton
- benchmark sparse attention performance on GPUs
- run attention with top-k block selection without materializing the attention matrix
- handle variable-length sequences with sparse attention

## When to choose
- you need efficient, GPU-optimized sparse attention for long-context LLM training or inference
- you want to reproduce or build on the NSA paper (arXiv:2502.11089)
- you need fused Triton kernels combining selected and sliding-window attention
- you want to reduce pretraining compute without sacrificing model quality

## When to avoid
- you need a general-purpose attention library with many attention variants
- your workloads are short-context where full attention is already fast enough
- you lack CUDA GPUs, since the kernels are Triton/CUDA-based
- you need production support or a stable API - the project is research-oriented

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, deep-learning, llm-training, gpu-computing, benchmarking
- domain: deep-learning, large-language-models, machine-learning, gpu-computing
- platform: python
- tags: sparse-attention, triton, kernels, long-context, transformers, attention-mechanism, gpu, linux, cuda

## Member repositories
- fla-org/native-sparse-attention (main) score 49

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:15.542956+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:09:16.993188+00:00, confidence not recorded.
  - readme: https://github.com/fla-org/native-sparse-attention (fetched 2026-08-28T04:03:15.542956+00:00, sha 68824b404bb8)
  - homepage: https://arxiv.org/abs/2502.11089 (fetched 2026-08-29T13:09:26.740916+00:00, sha 8f3dff948507)
  - site_page: https://info.arxiv.org/about/donate.html (fetched 2026-08-29T13:09:26.750238+00:00, sha cca9c3a11c56)
  - site_page: https://info.arxiv.org/about/ourmembers.html (fetched 2026-08-29T13:09:26.753857+00:00, sha 47cbc55ff1de)
  - site_page: https://info.arxiv.org/about (fetched 2026-08-29T13:09:26.755623+00:00, sha a1f16f915a9a)
  - site_page: https://info.arxiv.org/labs/index.html (fetched 2026-08-29T13:09:26.752126+00:00, sha b14a8d05a0ec)
- Data as of 2026-08-30T08:39:29.467469+00:00.
