2
From tokens to vectors
Each ID picks a row of numbers from a table, and a second table adds where the word sits.
Hover or tap a word or a row to follow it from ID to E to X. Tap empty space to reset.
blue frame: learned weights (training changes them)green frame: numbers worked out for this sentence
A table called E has one row of 3 numbers for every token in the vocabulary. Our four IDs pick four rows.
E is the embedding table (10 × 3). A row is the token's embedding vector.
A row of zeros with a single 1, times E, gives exactly one row of E. Same answer, matrix style.
one-hot vector · E = embedding.
A second table, P, adds a row for each position. Now the same word in a different place looks different.
X = E[ids] + P[0:4]. P holds learned positional embeddings.
Four words are now four rows of numbers: X, 4 × 3. Each row = the word's own numbers + its position's numbers.