Labs / Transformer Lab
Attention masks and variants
Compare full, causal, sliding-window, and sparse attention masks; see which tokens each query can reach and how cost grows with length.
Theory and worked examples: Attention variants
Attention mask patterns
Rows are queries, columns are keys. A coloured cell means that query may attend to that key. Click a row to pick a query.
key position →
what query 12 reads directly allowed for other queries