Log inStart free
LESSON 10.05 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Learned and relative position embeddings

Watch a learned position table run out of columns while offsets keep going.


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

Go Pro · $8.25/mo
EXPLAINER · 10.05 · POSITION BAYTABLE 8 COLUMNS × 8 · STEP 300
01
Stage 1 of 6 · Position table
A position table holds one learned column per position. The model adds it to the token's embedding.
Explain it simply

Each token starts as its embedding, a column of 8 numbers. The middle grid is the position table: column 3 belongs to position 3. Training sets these numbers, the same way a real model sets its token embeddings. Here the embeddings stay fixed. The sum on the right is what the model reads.

Three grids of 8 by 8: the token embeddings, the position table after 300 steps, and their sum.

tokens, targetslearned positionsweights; values above 0loss; values below 0masked or missing
token embedding eposition table P (learned)x = e + P+=0 the1 cat2 sat3 on4 the5 mat6 at7 night0123456701234567012345670123456701234567the position tablex₃ = e(on) + P₃: dimension 0 is 0.4 + 0.50 = 0.90token embedding eposition table P (learned)x = e + P+=0 the1 cat2 sat3 on4 the5 mat6 at7 night0123456701234567012345670123456701234567the position tablex₃ = e(on) + P₃: dimension 0 is 0.4 + 0.50 = 0.90
Toy: trained on 8 positions, queried at 16; W_Q, W_K seeded, not trained
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
xp=e(tp)+Pp\sy{x}{ink}{x_p} = \sy{e}{data}{e(t_p)} + \sy{P}{param}{P_p}
x3[0]=0.4+0.50=0.90x_{3}[0] = 0.4 + 0.50 = 0.90

The input is the embedding plus the position's column.

Common mix-ups

MYTHA trained position table works at any length.

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

Predict, then reveal
3 CHECKS · PRO
Q01In the previous-token task with 0 training steps, how many of the 7 rows hit the token before them?

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

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 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.