Embeddings
P10.text-representation.03 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Tokenization
Where next?
Later in Text Representation
This module unlocks
Go up a level
P10.text-representation.03 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Tokenization
Later in Text Representation
This module unlocks
Go up a level
A token ID is only a shelf mark: the number 17 says nothing about what the word means, and a model can compute nothing useful with it. What we need instead is a representation in which similar words receive similar numbers, so that meaning becomes something we can measure. This module builds exactly that from the corpus itself: it counts which words keep company with which, compresses those counts into dense vectors with truncated SVD, and looks up your sentence's rows in the resulting embedding table. Every number you will see here is derived from corpus statistics, never from random initialisation.
Why it matters — This table is the model's entire lexical knowledge — GloVe shipped exactly such a matrix for 400k words; every LLM still starts with one.
Reference: Pennington et al. 2014 — GloVe
Reads /api/text-representation/svd — loading
Computing…
The same kind of table can be learned instead of counted: Word2vec, step by step (P10.text-representation.07) trains word vectors by guessing each word's neighbours, one training pair at a time, and shows the two matrices that guessing rewrites.
Self-check
Where do the numbers in the embedding table come from on this page?
Self-check
What does a larger window size change in the co-occurrence matrix?
Self-check
Why is the embedding lookup so cheap?
Practise this lesson's 3 self-checks
One per screen: you reveal each answer and mark it yourself. Nothing is recorded.
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
A scratch console for this page's ideas — ungraded, nothing you run here is recorded.
Scratch console
A scratch console with the scientific stack (pandas, numpy, scikit-learn). Runs on the server — no network, resource-limited and measured.
Output appears here.
Loading your notes...