Skip to content
Discussion options

You must be logged in to vote
Admin verified this answer by martex-dev Aug 27, 2026

Self-attention compares every token to every other token, so time and memory both scale with the square of sequence length. Below a few thousand tokens it rarely dominates the budget. It starts to matter when the attention matrix no longer fits comfortably in memory, which is why FlashAttention-style tiling, which never materialises the full matrix, gives a large win at long context even though the asymptotic cost is unchanged.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer verified by Admin Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant