Skip to main content

Loading the visual lab…

#embeddings-3dNeural networks

A word becomes a vector: close in space = close in meaning, and you can do math on them.

What you'll play with

  1. Welcome to #embeddings-3d. Each point is a word, and its position is not arbitrary: a language model turns each word into a vector (a list of numbers), and two words with similar meaning end up close in space. This is a simplified 3D projection, built to be readable — real embeddings have 768 dimensions or more. The scene rotates on its own; type /rotate to stop it.
  2. Let's start with one word. Type /word cat: I highlight it and compute its 5 nearest neighbours (cosine similarity).
  3. Change family: /word Paris. Its neighbours are the other capitals… and notice France just below, in the blue cloud of countries.
  4. Type /links to draw a line from each country to its capital. The lines are all parallel: the relation "capital of" is ONE direction in space. Same for king → queen, man → woman, prince → princess.
  5. Since "capital of" is an arrow, we can copy it onto another country. Type /analogy Paris France Italy: I compute Paris − France + Italy and look for the closest word to the result.
  6. This is arithmetic on meaning. The historical example from word2vec (Mikolov, 2013): /analogy king man woman. The model never read a dictionary, it just saw billions of sentences.
  7. To isolate one cloud, filter: /cluster emotions. The other families fade. Then explore freely: /word joy, /distance joy sadness, /distance cat Paris
  8. You have seen it all: a word = a vector, close = similar meaning, a relation = a direction. LLMs do exactly this, but with thousands of dimensions and whole sentences — it is the very first layer of every transformer, the one that feeds the neurons of the #neuron channel. Keep playing: /analogy Tokyo Japan Canada, /word doctor, /cluster all, /reset.

Channel commands

  • /word <word>Highlights a word and shows its 5 nearest neighbours (cosine).
  • /analogy <a> <b> <c>Computes a − b + c and finds the closest word to the result.
  • /cluster <animals|cities|countries|royalty|emotions|jobs|all>Keeps only one family of words in colour.
  • /linksShows or hides the country→capital and male→female lines.
  • /rotateStarts or stops the scene's auto-rotation.
  • /distance <a> <b>Cosine similarity between two words, with interpretation.
  • /resetClears selection, analogy and filter; restarts rotation.

Glossary

Embedding
Representation of a word (or a token, an image…) as a vector of numbers, learned so that items close in meaning have close vectors.
Vector space
The set of all possible vectors. A 300-dimensional embedding lives in a 300-dimensional space; here we project into 3D so we can see it.
Cosine similarity
Cosine of the angle between two vectors: 1 = same direction, 0 = orthogonal, −1 = opposite. Standard measure of semantic closeness, insensitive to length.
Vector analogy
king − man + woman ≈ queen: relations (gender, capital, plural) become constant directions in the space.
Word2vec
Method (2013) that learns embeddings by predicting a word from its neighbours (CBOW) or the reverse (skip-gram). "You shall know a word by the company it keeps."
Distributional hypothesis
Two words that appear in similar contexts have similar meanings. This is the principle that lets us learn meaning without a dictionary.
Dimension
Number of coordinates in a vector. More dimensions = more nuance representable, but more data needed. Typically 100 to 4,096.
Dimensionality reduction
Projecting high-dimensional vectors into 2D or 3D so we can visualize them (PCA, t-SNE, UMAP), losing as little information as possible.
Nearest neighbors
The words whose vector is closest to a given word. Listing them is the simplest test of an embedding's quality.

Other channels in Neural networks

  • #neuronLet us break a neuron apart: inputs, weights, sum, activation.
  • #dropoutDropout regularization: the best friend of deep networks.
  • #activationWhy an activation? ReLU, sigmoid, tanh, Leaky ReLU, GELU and the vanishing gradient.
  • #gradient-descentLoss is a landscape. The gradient says which way is up, so we step the other way.
  • #backpropagationThe computation graph replayed backwards: each node receives ∂L/∂(itself) and the chain rule does the rest.
  • #overfittingA big model on few data points: the decision boundary twists until it memorizes the noise.
  • #cnn-filtersAn image is a grid of numbers. A 3×3 filter slides over it, multiplies, adds up: that is a convolution.
  • #is-it-einsteinIs it Einstein? Two faces go through the scanner of a network that learned only Einstein: Haythem → NO, Einstein → YES. Watching is free; touching is Premium.
  • #embeddings-3dA word becomes a vector: close in space = close in meaning, and you can do math on them.