NewsCrawler.org

Colors are our embeddings of light: an intuition for tokens and embeddings

embedding
Image: fedemagnani.github.io

The article explains how a large language model turns text into numbers, and compares this process with how humans see light.

Input text is split into subwords, and a tokenization algorithm maps each subword to an integer called a token[1]. One such algorithm is byte-pair encoding[2], which dates from 1994 and was adapted for language models much later. The full set of subword-to-token pairs is called the vocabulary[3].

A single integer is too poor a description of a subword, so each token is linked to a vector of numbers, its embedding[4], which the model adjusts during training. The vocabulary is stored as a matrix with one row per token, and the number of tokens balances sequence length against memory and computation. The article describes an embedding as the model's learned representation of a subword, useful for predicting the next words, not a claim about the subword's true nature.

In the second part, the article compares this to vision and describes colors as what the visual system makes of reflected light. Humans have around 6 million cone cells in the retina, of three types with peak sensitivities at about 420 nm, 530 nm and 560 nm. Human eyes detect wavelengths from about 380 nm to 780 nm, while ultraviolet light is mostly invisible to humans but visible to pigeons, goldfish and bees.

Read the original fedemagnani.github.ioDiscussion

Sources

Published: First seen: Читать по-русски

Open as a page