← Be the Model

Be the model: attention

Chapter 8. This machine reads up to twelve words of the pioneer facts and uses attention to decide how much of each earlier word to use when it predicts the next one. Pick a question, step through the calculation for one position, then train the machine and watch its answers change.

The machine starts untrained, with random numbers drawn when the page loaded, so your numbers will differ from the book's picture. This is machine .

Input
The context window (twelve positions)
Under each available position: its attention score, then its attention weight. Click a position to see its vectors below the machine.
Sum of the unrounded attention weights: not yet calculated
Click a position to see its token embedding, positional embedding, sum, key and value.
Inspect calculation
Choose the attention weights yourself

Sliders for the selected question's inspected position. The settings are normalized so they add up to 1 (all zero means equal weights). The model's parameters don't change.

Compare the two questions

Both use the same current parameters. Initial logits were saved when the machine was built.

Training on the pioneer facts
One-step report: gradients and updates for every parameter group
Take a step to fill the report.
Check a gradient with a test nudge