# zhuzilin/ring-flash-attention

Ring attention implementation with flash attention

Repository: https://github.com/zhuzilin/ring-flash-attention
Canonical: https://ross.abutalabs.com/products/ring-flash-attention
Language: Python
License: MIT
License Family: permissive
Last push: 2025-09-10T11:55:45+00:00

## Health v2 (maintenance only)
Score: 44/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 41, release rhythm 35, longevity 66
- inputs: {"age_days": 924, "days_push": 357, "days_rel": 357, "gap_med": 42, "n_releases_24m": 8}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1049, forks 101 (observed 2026-08-28T04:03:22.718030+00:00)

## What it is
A Python library implementing RingAttention on top of FlashAttention for distributed long-context transformer training. It provides varlen and batch APIs, zigzag/stripe variants, Llama3-style context parallelism, and a HuggingFace model adapter.

## Use cases
- train LLMs with sequences longer than fit on one GPU
- enable context parallelism in HuggingFace training runs
- pack variable-length samples with ring attention
- use llama3-style context parallelism for varlen training
- reduce memory overhead of attention across multiple GPUs
- substitute flash attention in transformers models with ring attention

## When to choose
- you need to train or fine-tune transformers on very long sequences across multiple GPUs
- you want drop-in ring/context-parallel attention compatible with flash_attention_2 and HuggingFace models
- you need varlen (packed samples) support with low memory overhead

## When to avoid
- single-GPU training where flash attention alone suffices
- inference-only workloads without distributed setup
- non-CUDA or non-NCCL environments

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, llm-training, gpu-computing
- domain: deep-learning, large-language-models, gpu-computing
- platform: python
- tags: ring-attention, flash-attention, context-parallelism, distributed-training, transformers, long-context, varlen, huggingface, gpu, linux

## Member repositories
- zhuzilin/ring-flash-attention (main) score 44

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:22.718030+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:00:34.243085+00:00, confidence not recorded.
  - readme: https://github.com/zhuzilin/ring-flash-attention (fetched 2026-08-28T04:03:22.718030+00:00, sha 70d29a2e5095)
- Data as of 2026-08-30T08:39:29.467469+00:00.
