Embedding Layers

A token ID needs to lead to the vector associated with that token. An embedding layer provides the lookup table, and training adjusts its rows so the retrieved vectors become useful for the task.

10 sections · 10 questions · 3 coding challenges

1 / 10

Could Related Words Share What the Model Learns?

BOTIE

A token ID tells us which item we have, but its numerical size says nothing about the item's meaning. If every word is treated as wholly separate, learning something from one sentence offers little help with a similar sentence containing a different word.

Bengio and colleagues' 2003 neural language model learned a vector for each word alongside the prediction model. Their motivation was the enormous number of possible word sequences. Related learned representations could allow evidence from one sequence to help with another that had never appeared in training.

An embedding layer stores those vectors in a table. A token ID selects a row, and training adjusts the row through the task's loss. Similarity is something the learning process may produce, not a property of adjacent IDs. The table gives the rest of the network useful numerical inputs without requiring us to hand-write a list of linguistic attributes.

Sources for this history