Start studying
Module 4 · NLP Module contents
Module 4  ·  Card 11 / 20advanced

Static vs Contextual Embeddings

A static embedding gives each word one vector, fixed for ever, whatever sentence it appears in.

So bank gets a single blurred vector averaging the river and the money senses together.

A contextual embedding is computed for a word in place, so each occurrence gets its own vector.

The two banks in one sentence about a riverside branch end up far apart in the space.

That shift, from a lookup table to a function of the whole sentence, is what transformers bought.

Learn in depth ↓
Module 04 · NLP · 20 concepts
In depth  /  15 lines

Static vs Contextual Embeddings, in more detail

Word embeddings arrived as a lookup table: every word in the vocabulary owned one vector.

Word2Vec and GloVe learned those vectors from co-occurrence statistics over a large corpus.

The famous arithmetic, king minus man plus woman landing near queen, came from exactly that table.

The design has one unavoidable flaw, and it is a flaw of the format rather than the training.

Every sense of a word must share a single vector, because there is only one row to store it in.

So bank ends up somewhere between the financial sense and the river sense, and is a poor match for either.

This is the polysemy problem, and no amount of extra data fixes it while the table shape holds.

Contextual embeddings change the shape: the representation becomes a function of the whole sentence.

The same word in two sentences produces two different vectors, computed on the spot.

ELMo did this with stacked recurrent networks and BERT did it with self-attention.

In a sentence about a riverside branch, the two occurrences of bank land in quite different regions.

That is the direct payoff, and it lifted almost every downstream task when it arrived.

The cost is that you can no longer ship a table: producing a vector now requires running a model.

Static vectors are still worth knowing about, since they are tiny, instant and adequate for rough similarity.

Every embedding model behind modern semantic search is contextual, which is why retrieval improved so sharply.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
What is the key difference between static and contextual embeddings?
NLP

20 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close