Token Embeddings (64D)
Turn words into lists of numbers: each word ID gets 64 numbers (a vector) where words with related meanings sit close together.
Computers cannot read letters directly, so they use numbers. The embedding table acts like a catalog: each word ID looks up a row of 64 numbers that represents the meaning of that word, like how 'king' relates to 'queen'.
In giant models like GPT-3, the embedding table holds over 50,000 words with 12,288 numbers each. In our bilingual lab, we use 256 words and 64 numbers so you can inspect every calculation clearly.
Token Embedding Lookup
Semantic Space (2D PCA Projection)
Tokens with similar meanings naturally cluster close to each other.
Notice that words from the same semantic category (like royalty or grammar) sit close to each other in this 64-dimensional space.
The numbers in this table are smoothly balanced around zero without extreme spikes or dead columns. This smooth spread proves that the model learned stable, healthy representations for both English and Persian words.
- ID to Vector: Each word number selects its own row of 64 numbers from the table.
- Learned Meaning: Training pulls words with similar roles or meanings closer together.
- Updating Weights: The entire table of numbers is updated step-by-step during training.
- 2D View: PCA flattens the 64 numbers into 2 dimensions so you can easily see word clusters.
Try comparing 'king' and 'queen' with poetry words. Notice how words from the same topic cluster together in the 2D view.