Flash Attention

Standard attention stores the full S×S score matrix in high-bandwidth memory (HBM). Here, S is the sequence length. Flash Attention processes small blocks in fast on-chip memory (SRAM). This reduces peak memory use.

Sequence Length

Head Dimension (d_head)

Block Size (Flash)

HBM Traffic

Standard:
Flash:
Reduction:

Peak Memory (score matrix)

Standard:
Flash:

Standard Attention

HBM Traffic
Peak Memory

Flash Attention

HBM Traffic
Peak Memory
Block 0 / 0

Click a preset to change the settings.