Embedding Vectors as Row Lookups

An embedding table assigns a learned vector to each supported ID. Looking up a sequence preserves the number and order of those IDs.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace two tokens
  2. Use the trained vocabulary

Trace two tokens

If IDs 3 and 5 index rows with four components each, the two-token result has shape \((2,4)\) under token-major layout. See tensor axes.

Use the trained vocabulary

Changing which token owns ID three changes which vector the model reads. Keep the mapping consistent between fitting and inference. Token embeddings and subwords explain that representation.[1]

References

  1. Ian Goodfellow, Yoshua Bengio and Aaron Courville, Deep Learning ↩