Super Interactive Lab / Transformer Architecture

How Transformers Work: An Interactive Deep Dive

Directly trace how text turns into high-dimensional vectors, calculates Query-Key-Value attention, routes through Multi-Head projections, and predicts next tokens.

1.00
Lower = sharper focus; Higher = uniform distribution.
8.0
Normalizes dot products to prevent gradient vanishing.

Click any token in the interactive diagram to view its personal Query-Key relationships across the full context.

Phase 3: Scaled Dot-Product Self-Attention

Observing how token vectors attend to all other token positions simultaneously via Q · Kᵀ / √d_k.

Attention(Q, K, V) = softmax(Q·Kᵀ / √d_k) · V
Query Vector (Q)
"What am I looking for?"
Key Vector (K)
"What features do I offer?"
Value Vector (V)
"What information do I pass along?"
Attention Weight: 0.842
Key Mechanism: When token "it" computes its attention query, its highest dot-product match is with "animal" rather than "street", enabling the transformer to accurately resolve pronoun coreference.
Context Length
10 tokens
Embedding Dim (d_model)
64 dims
Max Attention Weight
0.89
Predicted Next Token
"and"
Model snapshot exported successfully to JSON.
Enjoy this tool? Build your own with Super