Gradivex
  • Home
  • Academy
  • Arena
  • Visualizer
  • Models
Log in
NLP & Transformers/Embeddings/Lesson 5

Contextual embeddings

Module 2 · Lesson 5 of 5 · 6 min read
Theory

One address per word was always a compromise

Static embeddings answer "where does this word live?" once, at training time, forever. But you never read a WORD; you read an occurrence of a word inside a sentence, and the sentence decides what it means. "bank" next to "river" and "bank" next to "loan" are, for every purpose that matters, two different words wearing the same spelling.

The repair, arriving around 2018 with ELMo and then BERT: compute the vector fresh for every occurrence. Start from a static-ish lookup, then let the surrounding words push and pull the vector before anyone uses it. Same token, different sentence, different final coordinates.

The word for this is contextual, and it is not an incremental upgrade. It dissolves the ambiguity problem instead of managing it: nobody has to enumerate the meanings of "bank" because the sentence itself computes which one is present.

Interactive

Watch "bank" move

The dashed circle is the static embedding: one address, forever, stuck between two neighborhoods. Click a sentence and watch where a contextual model places the SAME word.

riverwatershoreboatmoneyloandepositaccount“bank” (static: one dot forever)“bank” (contextual)
Theory

The machinery question

A definition is not a mechanism. Saying "context adjusts the vector" raises the real question: WHAT reads the other words, decides that "river" matters more than "the", and applies the pull, for every token in the sentence at once?

You already brushed against the answer at the end of the deep learning protocol: attention. Each token looks at every other token, scores how relevant each one is, and mixes their information into its own vector, with learned weights. Run that mixing once and "bank" absorbs a hint of "river". Stack the operation in layers and representations get progressively sharper: literal at the bottom, contextual in the middle, task-shaped at the top.

The next module opens that machine bolt by bolt: the scoring, the mixing, the multiple heads doing it in parallel, and the architecture built around it. Module name: The Transformer. Everything you have built so far, tokens and geometry, is its raw material.

Interactive

Check your understanding

A contextual model processes "bank" in 1,000 different sentences. How many distinct vectors does it produce for that word?

Takeaway

What to remember

  • ✓Static embeddings assign one frozen address per word; contextual models compute a fresh vector per occurrence.
  • ✓The surrounding sentence pushes the vector toward the meaning actually in play: "bank" commutes between districts.
  • ✓Adjustment is continuous, not a choice among enumerated senses.
  • ✓The mechanism doing the reading-and-mixing is attention, and it is the subject of the next module.
  • ✓Module complete: from counting bags to moving points. You now hold the full "text to geometry" pipeline.
Mentor-0

Stuck on something in this lesson? Ask.

0/1000

Every lesson is free to read. Log in to save your progress, complete lessons, and earn Compute and XP.

Log in free
The semantic space
Gradivex

Understand AI from the inside, read it, see it, prove it.

Platform

AcademyVisualizerRoadmapsModels

Community

DiscordLeaderboard

Company

PrivacyTerms

© 2026 Gradivex. All rights reserved.