Laboratory · Interactive exhibit LAB-04
From words to tokens, and to the relations between them
Type a sentence, see how a small vocabulary splits it into subwords, then select a token to inspect attention weights toward the others.
Type: teaching simulation with a real attention calculationTry a sentence
1. Three views of the same text
Words and punctuation
Museum subword tokenizer
The ▁ symbol marks the beginning of a word. Real tokenizers learn much larger vocabularies from corpora and differ between models.
2. Select a token and inspect attention
Select a token. Each bar shows the weight assigned from that token to every position in this small synthetic layer.
Attention(Q,K,V) = softmax(QKᵀ / √d) V
Documentation
The exhibit connects two important technical ideas: subword units in neural machine translation and the Transformer’s scaled dot-product attention.
- Sennrich, Haddow & Birch (2016), Neural Machine Translation of Rare Words with Subword Units
- Vaswani et al. (2017), Attention Is All You Need
Visitor input is not sent to an external server or model.