LESSON 28.04 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Causal and variable-length FlashAttention
Watch FlashAttention skip masked tiles and pack sequences of different lengths.
Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 28.04 · KERNEL BAY16 SLOTS · TILES OF 4 · 16 TILES
01
Stage 1 of 5 · Tiles of scores
FlashAttention splits the 16 × 16 score grid into tiles of 4. Each step loads one Q tile and one K, V tile.
Explain it simply
Each row of the grid is a query token, and each column is a key token. One cell is one score. FlashAttention never stores the whole grid. It loads one small square of it, a tile, into the fast memory on the chip.
The score grid: 16 query rows and 16 key columns, in 16 tiles of 4 by 4.
tokens, one tint per sequencetiles, SRAMscores (filled: used, outline: masked, wasted)masked or skippedO writes
Toy: 1 head, 16 tokens × 4 values in FP16, seeded random, not trained; batches of 8, 5 and 3 tokens
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
The grid of N by N scores holds this many tiles.
PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
- 4 more stages and 3 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.