Word Embeddings

NLP interview question · Hard difficulty

What are word embeddings?hard

Status
✓
Type
conceptual
Topic
word-embeddings
Frequency
common
Tags
word, embeddings, tokens, vectors
Answer

Embeddings represent words or text as dense numeric vectors. A token is a discrete, symbolic unit; an embedding is the continuous vector the model maps that token to — the model first tokenizes text, then looks up each token's embedding.

Explanation

Similar meanings tend to have nearby vectors, enabling semantic similarity, clustering, retrieval, and downstream model features. Concretely, "king" becomes a token ID, and that ID maps to a high-dimensional vector like [0.21, -0.45, 0.87, ...] — hundreds or thousands of dimensions, learned so that related concepts end up geometrically close in that space. The distinction matters because tokens alone can't be reasoned about mathematically — they're just symbols — while embeddings give the neural network something continuous to compute over, which is what lets it capture semantic relationships instead of just matching strings.

Follow-upHow are contextual embeddings different?
Follow-upWhat's the actual difference between a token and an embedding?