Implement a blocked/tiled attention forward pass (FlashAttention-style) with running max/s

Attention Efficiency & Long Context4 / 5

Chapter 034 / 5

Attention Efficiency & Long Context

Implement a blocked/tiled attention forward pass (FlashAttention-style) with running max/s

Hard

Implement a blocked/tiled attention forward pass (FlashAttention-style) with running max/sum and verify it matches naive attention.

Target interface
flash_attention(Q, K, V, block=16, causal=True)

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.