FlashAttention vs PagedAttention
FlashAttention and PagedAttention both make transformer attention cheaper on GPUs but solve different problems. FlashAttention speeds up the attention computation itself by working in tiles in fast on-chip memory, mainly for training and long prompts, while PagedAttention manages the memory that holds each request's key-value cache during serving, storing it in non-contiguous blocks so that more requests fit in a batch.
Definitions
- FlashAttention PTL-0252
- FlashAttention is an exact attention algorithm for transformers that computes attention in tiles held in fast on-chip GPU memory, reducing reads and writes to slower high-bandwidth memory so that attention runs faster and uses memory linear rather than quadratic in sequence length.
- PagedAttention PTL-0253
- PagedAttention is a technique for serving language models that stores each request's key-value cache in fixed-size blocks that need not be contiguous in memory, like pages in operating-system virtual memory, which reduces wasted memory and lets requests share cached blocks.
Differences
| FlashAttention | PagedAttention | |
|---|---|---|
| Problem addressed | Memory traffic during the attention computation | Fragmented, duplicated key-value cache memory during serving |
| Main idea | Compute exact attention in tiles held in on-chip SRAM | Store the KV cache in fixed-size blocks, like virtual-memory pages |
| Where it is used | Training and inference kernels | Serving systems that batch many requests, such as vLLM |
| Changes the model's output | No, the result is exact attention | No, it changes memory layout only |
| Reported benefit | Faster training and longer feasible contexts | Two to four times higher serving throughput at similar latency |
Which to use
- Look to FlashAttention when the attention computation itself is the bottleneck, as in training or processing long inputs.
- Look to PagedAttention when serving many concurrent requests and KV cache memory limits the batch size.
Sources
- Dao et al. (2022). FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness.
- Kwon et al. (2023). Efficient Memory Management for Large Language Model Serving with PagedAttention.
Cite this page
Protologue. (2026). FlashAttention vs PagedAttention. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.7.0). https://protologue.com/compare/flashattention-vs-pagedattention/