All demos

Attention Explorer

Find a relationship one attention head notices

A transformer has many attention heads. Each can emphasize a different connection among earlier token pieces. Start with a question, compare the heads, then inspect one map closely.

Try this
  1. Choose a sentence and its reading question.
  2. Select the token that is doing the reading.
  3. Compare heads before opening one map.
Advanced view

Attention

1. Choose The Token That Is Reading

It can only attend to itself and earlier tokens.

2. Compare What Each Head Notices

Each card lists the three earlier token pieces receiving the most attention. Choose a head to inspect its full map.

3. Inspect The Selected Head

Choose a head above to see its map.

Rows: the token doing the reading. Columns: earlier token pieces it can consider. Darker cells mean stronger attention. The outlined row is the reading token.
Compare this reading token across all layers

For the current head, each layer lists its three strongest links. Select a different layer in Advanced view to update the head comparison.