# thu-ml/SpargeAttn

[ICML2025] SpargeAttention: A training-free sparse attention that accelerates any model inference.

Repository: https://github.com/thu-ml/SpargeAttn
Canonical: https://ross.abutalabs.com/products/spargeattn
Homepage: https://arxiv.org/abs/2502.18137
Language: Cuda
License: Apache-2.0
License Family: permissive
Topics: ai-infra, attention, inference-acceleration, llm, mlsys, quantization, sparse-attention, vision-transformer, sageattention, video-generation, vit
Last push: 2026-02-25T00:07:21+00:00

## Health v2 (maintenance only)
Score: 51/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 69, release rhythm 35, longevity 39
- inputs: {"age_days": 554, "days_push": 190, "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 1033, forks 102 (observed 2026-08-28T04:03:18.542806+00:00)

## What it is
SpargeAttn is the official implementation of a training-free sparse and quantized attention method that accelerates inference for language, image, and video models. It provides plug-and-play CUDA APIs (built on SageAttention2++) that skip matrix multiplications via a two-stage online filter while preserving end-to-end accuracy.

## Use cases
- speed up LLM inference with sparse attention
- accelerate video generation model inference
- accelerate diffusion transformer image generation
- drop-in replacement for attention in PyTorch models
- apply custom block-sparse attention masks per head
- balance attention accuracy vs speed with topk sparsity

## When to choose
- you need faster attention inference on NVIDIA GPUs without retraining
- you run long-context LLMs or video/image generation models where attention dominates latency
- you want a plug-and-play sparse attention kernel compatible with SageAttention

## When to avoid
- you need CPU or non-CUDA hardware support
- you require exact dense attention outputs with no approximation
- your model uses very short sequences where sparsity gains are minimal

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, llm-inference, gpu-computing, sdk
- domain: deep-learning, large-language-models, gpu-computing, image-processing
- platform: python
- tags: sparse-attention, quantization, inference-acceleration, training-free, video-generation, vision-transformer, sageattention, cuda-kernel, icml2025, video, gpu, cuda

## Member repositories
- thu-ml/SpargeAttn (main) score 51

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:18.542806+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:06:41.987545+00:00, confidence not recorded.
  - readme: https://github.com/thu-ml/SpargeAttn (fetched 2026-08-28T04:03:18.542806+00:00, sha 2f4e8c56e5b1)
  - homepage: https://arxiv.org/abs/2502.18137 (fetched 2026-08-29T13:06:22.219929+00:00, sha e0c8806e12ee)
  - site_page: https://info.arxiv.org/about/donate.html (fetched 2026-08-29T13:06:22.229324+00:00, sha cca9c3a11c56)
  - site_page: https://info.arxiv.org/about/ourmembers.html (fetched 2026-08-29T13:06:22.232831+00:00, sha 47cbc55ff1de)
  - site_page: https://info.arxiv.org/about (fetched 2026-08-29T13:06:22.234598+00:00, sha a1f16f915a9a)
  - site_page: https://info.arxiv.org/labs/index.html (fetched 2026-08-29T13:06:22.231134+00:00, sha b14a8d05a0ec)
- Data as of 2026-08-30T08:39:29.467469+00:00.
