Skip to visualization
visualization / Sliding Window

minGPT · Sliding Window

local, banded causal attention
◆ SWA
T=8
i8

🔍 Variable Inspector

click any code line
Click a code line to inspect its variables.
About this lesson
Quick answer

What Sliding Window Attention explains

Restrict each token to a local causal band. This page uses readable dense reference code and explains the optimized O(T·W) kernel separately.

Key concepts

Primary research

Longformer · Beltagy et al.