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

Attention Efficiency and Long Context4 / 5

Chapter 034 / 5

Attention Efficiency and 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)

Complete the starter code in the editor. Any correct approach is accepted.

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