What is an Embedding

Meaning as a List of Numbers

An embedding is a list of numbers (a vector) that represents the meaning of a piece of text. An embedding model is trained so that texts with similar meaning get vectors that point in similar directions: "refund not received" and "where is my money back" end up close together even though they share no words.

  • Real embedding vectors have 256–3072 numbers (dimensions).
  • Used for: semantic search, RAG retrieval, recommendations, duplicate detection, clustering, classification.
  • An embedding model is different from a chat model: it outputs a vector, not text.

A Hand-made 3D Example

Example

Imagine just three dimensions: "is about money", "is about delivery", "is about clothes". We set the numbers by hand to build intuition; a real model learns hundreds of such dimensions:

#                     money delivery clothes
vectors = {
    "refund not received":   [0.9, 0.2, 0.0],
    "where is my money back": [0.8, 0.1, 0.1],
    "parcel is late":        [0.1, 0.9, 0.0],
    "red cotton kurta":      [0.1, 0.0, 0.9],
}
def dot(a, b):
    return sum(x * y for x, y in zip(a, b))

query = vectors["refund not received"]
for text, v in vectors.items():
    print(f"{text:24} similarity to 'refund not received' = {dot(query, v):.2f}")

Output

refund not received      similarity to 'refund not received' = 0.85
where is my money back   similarity to 'refund not received' = 0.74
parcel is late           similarity to 'refund not received' = 0.27
red cotton kurta         similarity to 'refund not received' = 0.09