Embeddings โ text as numbers
Embeddings turn text into number vectors, so an AI can compare how similar things mean mathematically.
What is an embedding?
An embedding is a list of numbers (a vector) that represents the meaning of a piece of text โ a word, a sentence, a whole paragraph โ in a multi-dimensional space. A dedicated embedding model produces these numbers, not the language model that later answers your questions.
Why this is useful
Texts with similar meaning get vectors that sit close together in number space. "Dog" and "puppy" sit close together, "dog" and "tax return" sit far apart. A computer can calculate this closeness (e.g. with cosine similarity) without "understanding" language itself โ plain math is enough.
What embeddings are used for
- Semantic search: find documents that match in meaning, even when no word matches exactly
- RAG: the foundation for finding relevant text snippets for a request
- Clustering: automatically group similar texts
- Recommendations: "similar articles" features
Where embeddings get stored
At larger scale, embeddings end up in a vector database (e.g. Pinecone, Weaviate, or the Postgres extension pgvector), which is optimized for fast similarity search across millions of vectors.
EXAMPLE
embed('dog') โ [0.12, -0.44, 0.81, ...] embed('puppy') โ [0.14, -0.41, 0.79, ...] โ close together embed('tax return') โ [-0.9, 0.33, -0.1, ...] โ far apart
QUICK QUIZ
What does it mean when two embeddings sit close together?
SOURCES
- OpenAI-Doku: Embeddings โ platform.openai.com
- Claude-Doku: Embeddings โ docs.claude.com
- Wikipedia: Worteinbettung โ de.wikipedia.org