# meta-pytorch/attention-gym

Helpful tools and examples for working with flex-attention

Repository: https://github.com/meta-pytorch/attention-gym
Canonical: https://ross.abutalabs.com/products/attention-gym
Language: Python
License: BSD-3-Clause
License Family: permissive
Last push: 2026-09-03T01:52:14+00:00

## Health v2 (maintenance only)
Score: 91/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 100, release rhythm 100, longevity 54
- inputs: {"age_days": 763, "days_push": 0, "days_rel": 0, "gap_med": 4, "n_releases_24m": 6}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1234, forks 79 (observed 2026-09-03T02:15:14.903291+00:00)

## What it is
Attention Gym is a collection of tools, examples, and reference implementations for working with PyTorch's FlexAttention API. It provides attention mask and score-mod utilities, attention variant implementations, and performance comparisons for researchers and developers.

## Use cases
- experiment with attention mechanisms using flex-attention
- create sliding window or document attention masks in pytorch
- benchmark different attention variants
- learn how to use flex_attention in my model
- reference implementations of linear attention

## When to choose
- you use PyTorch 2.5+ FlexAttention and want ready-made mask/score-mod examples
- you are researching or comparing attention mechanisms
- you want utility functions for building and combining block masks

## When to avoid
- you need a stable API with backward compatibility guarantees
- you don't use PyTorch or FlexAttention
- you need production-hardened attention kernels rather than examples

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, deep-learning, developer-tools, benchmarking
- domain: deep-learning, machine-learning, large-language-models, developer-tools
- platform: python, cross-platform
- tags: flex-attention, pytorch, attention-mechanisms, transformers, research, gpu, linux

## Member repositories
- meta-pytorch/attention-gym (main) score 91

## Provenance
- Observed fields: from GitHub, fetched 2026-09-03T02:15:14.903291+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-30T06:15:16.367612+00:00, confidence not recorded.
  - readme: https://github.com/meta-pytorch/attention-gym (fetched 2026-09-03T02:15:14.903291+00:00, sha 445133a79bad)
- Data as of 2026-08-30T08:39:29.467469+00:00.
