Log inStart free
LESSON 10.07 · 6 STAGES · 2 CONTROLS · 2 CHECKSPRO · PREVIEW

ALiBi

Watch a straight-line penalty on attention scores tell near words from far ones.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 2 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 10.07 · POSITION BAYHEAD 1 · m = 1/4 · QUERY night AT 7
01
Stage 1 of 6 · No position
The query night at position 7 scores keys 0 to 7 by content. Both copies of “the” score 0.81.
Explain it simply

Night is the newest word. It asks a question, the query, and each word up to it offers a key. Each bar shows how well a key matches. No position goes in, so both copies of “the” get the same bar.

Score bars for keys 0 to 7. The keys at positions 0 and 4 are both “the”, and both score 0.81.

tokensbias, slopescores, weightsmasked, past position 7
the00.81cat10.01sat22.04on30.78the40.81mat50.51at6−0.45night7−1.44content scorestokenscore squerythe00.81cat10.01sat22.04on30.78the40.81mat50.51at6−0.45night7−1.44content scorestokenscore squery
Toy: 16 tokens, width 8, 4 heads of width 2, seeded weights (not trained)
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
sij=qi⋅kj / 2\sy{s}{out}{s_{ij}} = \sy{q}{data}{q_i} \cdot \sy{k}{data}{k_j} \,/\, \sqrt{2}
s7,0=s7,4=0.81s_{7,0} = s_{7,4} = 0.81

The score is the query times the key, scaled down.

Common mix-ups

MYTHALiBi adds a position vector to each token.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
2 CHECKS · PRO
Q01In head 1 with the bias off, does the copy of “the” at 4 still beat the copy at 0?

Make your guess, then test it in the diagram. All 2 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 2 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.