Index Ai Academy
Glossary · Phase 5 · Transformers

Sliding-window attention

Also written: sliding window attention

Attention where each token only looks at a fixed number of recent tokens, so the cost grows in step with the length instead of with its square.

Try it now

Ten times the tokens means a hundred times the scores. That's why FlashAttention avoids storing them, and sliding windows avoid computing them.

Learn it properly

Long context · Efficient attention and million-token windows. About 35 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write