Super Super

Transformer Attention Playground

Self-attention, live
Ready. Attention weights computed locally in your browser.

Attention from token 0

What you are looking at

This page runs a small, deterministic self-attention block entirely in your browser. Every token in your sentence is hashed into a fixed pseudo-random embedding, projected through three small learned-looking matrices (one per head), and scored with the standard scaled dot-product formula. Nothing is sent to a server, and no model weights are downloaded.

The math, in order

What this is and is not

This is a faithful implementation of the attention mechanism, not a trained language model. The projection matrices are fixed and illustrative, so the weights show how attention distributes mass — not what a real GPT or BERT head has learned. Real heads in trained models specialise in syntax, coreference, or positional patterns; the three heads here are labelled to suggest those roles, but their weights come from deterministic pseudo-random matrices, not training.

Try these

Why do the rows sum to 1?

Softmax exponentiates each score and divides by the sum of the exponentials across the row. That guarantees positive weights that sum to exactly 1 for every query token, which is what makes the matrix a valid attention distribution.

Why divide by √d?

Dot products of d-dimensional vectors grow with d. Dividing by √d keeps the variance of the scores roughly constant, which prevents softmax from saturating into a one-hot distribution as the dimension grows.

Is my sentence sent anywhere?

No. All computation happens in this tab. The only network requests are for the page itself, the Super logo, and the optional native player adapter.

How is the CSV structured?

The first row is a header with the token strings. Each subsequent row starts with the query token, then lists the attention weight from that query to every key token, rounded to six decimals.