Python starts when you choose Run.
Online Softmax Without the Attention Matrix
Running maxima and rescaled sums recover exact attention arithmetic without retaining every score. A small CPU example makes the invariant explicit.
Original CPU online-softmax illustration for one query row and scalar values; not a FlashAttention GPU kernel.
The code uses Python 3 and the standard library. Saved output is from the checked CPU run.
tile=1: output=30.000000 tile=2: output=30.000000 tile=4: output=30.000000 score_entries: full_matrix=16777216, one_row_tile=64
Sources
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness: https://arxiv.org/html/2205.14135v2
Python runs locally in this page. Saved results and figures are visible before execution.