Tinker Transformer architecture

by Samy (Kondasamy Jayaraman)

Loading Larkspur mini

Layer 1 · head 1 · token 7 of 7 (␣business)Who looks at whom, in Larkspur mini’s first head. Weights computed live.

Chapter 3 of 7

Attention

Each token is now its own vector. But “business” alone can’t tell what comes next: it needs “five” and “within” too.

This chapter: How does each token gather what it needs from the tokens before it?

About this chapter

You will learn

  • How to read an attention heatmap: who looks at whom, and how much
  • Why each row of weights adds up to 1
  • Why a token can never look at a token after it: the causal mask

Words you’ll meet

Attention
The step where each token gives every earlier token a weight, then takes in a mix of them, more from the heavier ones.
Weight
How much one token takes from another, between 0 and 1. A token’s weights add up to 1.
Causal mask
Vaswani and colleagues (2017) mask attention in the part of the Transformer that writes, so a position cannot look at the positions after it and each prediction depends only on what came before.

Step 1 of 5

lets tokens read each other: each weighs the tokens before it and takes in more from the heavier ones.

Open the Attention tab.

Loading Larkspur mini…