W_E — the embedding matrix
Read "W E". It is a learned table with one row per token in the vocabulary; each row is that token's vector of d_model numbers.
: rows, each numbers wide. Row is the vector the model uses for token . It is trained like any other weight.
Many models tie this matrix to the output layer: they reuse it (transposed) to turn the final hidden vector back into one score per vocabulary token. That saves a whole block of parameters, which is a large share of a small model.
Example
GPT-2 small.
Where the course uses it
- 1.5 Embeddings: From a Token to a Vector · Module 1, Shapes and Linear Algebrafirst use
- 7.5 The Output Layer · Module 7, The Block and the Full Model
- 16.4 Sandwich Normalization and Embedding Scaling · Module 16, Efficient and Long Attention
- 26.4 Training on Images and Text Together · Module 26, Vision-Language Models
Related terms
- eᵢ — a one-hot vectorRead "e i". It is a vector with a 1 in position i and 0 everywhere else: token number i, written as a vector.
- d_model — the model's widthRead "d model". It is how many numbers represent one token inside the network: 768 for GPT-2 small, 4096 for LLaMA-3 8B.
- |V| — size of the vocabularyRead "the size of V". Single bars around a set mean "how many items it has", so |V| is the number of tokens in the vocabulary.