Two costs, routinely conflated
Attention is expensive in two different ways, at two different times, and confusing them leads to reaching for the wrong fix.
The training cost is quadratic in sequence length. Every token attends to every other, so the score matrix has n squared entries per head per layer. Going from 2,048 to 8,192 tokens multiplies that by 16. Going to 131,072 multiplies it by 4,096.
The inference cost is different and often larger in practice. Generating one token requires attending to every previous token, so their keys and values must be retained. That is the KV cache, and it grows linearly with the sequence.
For a 70-billion-parameter model with grouped-query attention, the cache runs at about 320 KB per token. At 8k context that is 2.7 GB. At 128k it is 42.9 GB. At a million tokens it is 343.6 GB, which is more memory than the weights.
Memory-efficient attention implementations fixed the first cost by never materialising the score matrix. They did not touch the second, because the cache is not an implementation detail. It is what attention is.

