This lesson is a draft. It may be incomplete or contain errors.

How language models work · foundation

What is an embedding?

How a computer can turn a word into a position, so that words with similar meanings end up near each other.

catkittendogpuppycartruckbicycleapplebananacherry

Press play, or drag a word.

  • Animals (circles)
  • Vehicles (squares)
  • Fruit (triangles)
Start
Ten words as points on a flat plane. Press play to watch them move, or drag any word.
Text description

Ten words (cat, kitten, dog, puppy, car, truck, bicycle, apple, banana, cherry) start scattered at random places on a plane. As the animation plays, they drift into three groups: animals, vehicles and fruit. Lines then connect a chosen word to its two nearest neighbours, which are always words from the same group. You can move any word with a mouse, a finger or the arrow keys, and the lines update to show its new nearest neighbours.

What you just saw

Placeholder. The real lesson will explain what the learner just watched: each word became a point, and words used in similar ways ended up close together.

Closeness as a number

Placeholder. Introduce distance only now that the learner has seen it.

The distance between two points on a plane is

d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

where dd is the distance, (x1,y1)(x_1, y_1) is the position of the first word, and (x2,y2)(x_2, y_2) is the position of the second.

What this picture leaves out

Sources

No sources listed yet.

How this lesson was made

Stub created to test the lesson structure. The text and visual are placeholders and have not been checked yet.

Tools used:

  • Claude (Anthropic): Scaffolding the lesson structure and placeholder visual.

Written by Alex Zhao. Not yet reviewed. Last updated 26 October 2026.