Review — Embeddings and table lookup
Back to the lesson · Learning path plan
What to remember
- For a vocabulary of size V and embedding dimension d, the embedding matrix has shape V × d. ID i selects row i.
- The ID is a row index. The d learned numbers stored in the row are the embedding coordinates.
- With fixed parameters, two occurrences of the same ID share the lookup vector. States produced later can differ with position and context.
Predict before checking
Consider the toy ID sequence \([17,42,8,17]\), with zero-based sequence positions. Which rows does the table read, and in what order? Which vector must repeat if the table stays fixed?
Show the answer
The rows read are \(E_{17,:}\), \(E_{42,:}\), \(E_{8,:}\), and \(E_{17,:}\), in that order. Both occurrences of ID 17 retrieve the same initial vector. In the first-block-input exercise, that vector is fixed at \((2,-1)\); the other values are not needed to establish the order.
IDs 41 and 42 do not necessarily have nearby vectors: proximity between vocabulary indices places no constraint on the geometry of the learned rows.
Work through the lookup exercise to check the row order, then predict what happens when IDs are renumbered with or without the corresponding table-row permutation.