AI GLOSSARY · AI CONCEPTS
FlashAttention
Definition
FlashAttention is an exact attention algorithm for Transformers that is aware of how data moves between GPU memory levels. It processes attention in blocks, called tiling, to reduce reads and writes to slower memory.
Also called: flash attention, FlashAttention-2, FlashAttention-3, flash attention 2, flash attention 3, flash-attn.
In plain language
Attention is the step where a language model looks back over the text it has been given. Done the plain way, it moves a lot of data around inside the graphics chip, and that movement, not the arithmetic, can be the slow part. FlashAttention is a way of doing the same calculation in small blocks that fit in the chip's fastest memory, so there is less back-and-forth. It is like cooking with ingredients on the counter instead of walking to the pantry for each one. It gives the same answer as ordinary attention, so it does not make a model smarter. It also depends on the hardware and the software library you use, so it may not be available in every setup.
Technical definition
The original paper (Dao et al., arXiv 2205.14135, submitted May 2022) argues that attention algorithms should account for data movement between levels of GPU memory, and presents FlashAttention as an exact algorithm that uses tiling to reduce reads and writes between GPU high-bandwidth memory and on-chip SRAM. FlashAttention-2 (arXiv 2307.08691, July 2023) changes work partitioning and parallelism to use the GPU better. FlashAttention-3 (arXiv 2407.08608) targets Hopper GPUs by overlapping computation and data movement and adding FP8 support. Hugging Face's Transformers documentation says FlashAttention tiles attention computations and avoids large intermediate tensors to reduce memory footprint, and shows it selected with the attn_implementation argument.
Worked examples in this catalogue
Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.
Skill by Skill Almanac · Illustrative, not executed
local-model-sizing 57/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- The skill works out whether an open-weight language model will run on a given GPU, Mac or PC, with a script that computes weight, KV-cache and overhead memory per quantization.
- Why it exercises the concept
- The catalogue has no attention-kernel skills, so this is a contrast case. Its one-line description does not mention attention kernels; it shows the kind of memory budgeting that kernel choices such as FlashAttention relate to.
Guide · Illustrative, not executed
Self-Hosting an AI Agent: What You Take On
- What you see
- A guide to what you take on when an AI agent runs on your own machine, including the model server and the check that a model fits your hardware.
- Why it exercises the concept
- Attention kernels are a server-side setting you meet only when you run models yourself. The guide does not name FlashAttention, so it is a contrast case about the self-hosting context.
Guide · Illustrative, not executed
What Is an LLM? The Facts Agent Users Need
- What you see
- A guide explaining that an LLM predicts text one token at a time inside a fixed context window, and the context, cost and error facts that follow.
- Why it exercises the concept
- The papers motivate FlashAttention by the cost of attention on long sequences. The guide explains the context-window side from a user's view and does not discuss the algorithm.
How it shows up when you use agents
In Claude Code, Codex or Cursor you do not choose an attention algorithm. The service that runs the model does. FlashAttention matters when you run models yourself, for example a local model behind a coding agent, or when you fine-tune one. There it appears as a setting or a package: Hugging Face's Transformers documentation shows it chosen through the attn_implementation argument when a model is loaded, and describes it as lowering memory traffic.
The practical point is that FlashAttention aims at the same output as standard attention, computed with less data movement. It targets the cost of attention on long inputs, which grows with sequence length. It does not enlarge a model's context window, and it does not change what the model has learned. The KV cache is a different memory cost: it stores values from earlier tokens during generation, while FlashAttention changes how the attention calculation is carried out.
What breaks when this is misunderstood: people install it expecting a fix for out-of-memory errors that come from model weights or the cache, or expect different answers. Support depends on the model, the GPU and the library version, as the three papers describe different GPU targets. Next action: read your serving library's documentation for the supported attention backends, enable one setting at a time, and compare memory use and output quality on your own workload. See Attention mechanism and Transformer.
Common confusions
- FlashAttention versus approximate attention. The first paper presents FlashAttention as exact attention. Its abstract contrasts it with approximate methods that reduce compute.
- FlashAttention versus the KV cache. One is a way of computing attention with fewer memory reads and writes. The other stores earlier keys and values for reuse during generation. A setup can use both.
- FlashAttention versus FlashAttention-2 and -3. They are separate papers with different focus: the second reworks parallelism and work partitioning, and the third targets Hopper GPUs. The version you can use depends on your hardware and software.
- Myth. FlashAttention gives a model a longer context window. A window is a property of the model and service; the algorithm changes how attention is computed, and the first paper reports that it enables longer context in Transformers.
Related terms
Terms that mention FlashAttention
2 terms mention this one
More in AI concepts
Sources
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness — Dao et al., arXiv (accessed 2026-11-24)
- FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning — Dao, arXiv (accessed 2026-11-24)
- FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision — Shah et al., arXiv (accessed 2026-11-24)
- Inference optimization overview, Hugging Face (accessed 2026-11-24)
Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-24. Wikipedia is never the only source.
Review record
Last verified
Drafted by claude-sonnet-5-5; sources and example targets checked by claude-haiku-5-5 source check; claude-sonnet-5-5 editor pass on 2026-11-24. Last verified .
This entry is still in review, so it is not listed in search engines yet.
Change log (2)
- : First version.
- : Verifier pass: Corrected wording and source title.