Attention playground

Type a sentence and watch a real language model read it. See every attention head and what the model expects next. It all runs in your browser, so nothing you type is sent anywhere.

Load a real language model

DistilGPT-2 (82M parameters) runs entirely in your browser. Nothing you type leaves your device. It downloads once, about 84 MB, so a laptop on Wi-Fi works best.

About the model and how exact this is

The model is DistilGPT-2 (82M parameters, 6 layers of 12 heads), a smaller version of GPT-2 trained to imitate it. We exported it so it returns its attention weights, and stored its weights as 8-bit integers with a scale for every 64 values to keep the download to about 84 MB.

Against the original model in PyTorch, attention weights differ by at most about 0.03. Next-word probabilities are usually within a few percentage points; the top choice can swap only where the original's top two were nearly tied. Text starts with GPT-2's start token, which many heads use as a resting place for attention.