What are embeddings in AI?

An embedding is a list of numbers (a vector) that a model produces to represent the meaning of a piece of text, an image or audio. Items with similar meaning get vectors that sit close together, so similarity becomes a calculation.

Also called vector embeddings, embedding model, text embeddingsUpdated

Computers compare strings exactly. "Refund" and "money back" share no letters, so a keyword search treats them as unrelated. An embedding lets software compare meaning instead. An embedding model reads a piece of input and outputs a fixed-length vector, typically a few hundred to a few thousand numbers. The model has been trained so that inputs with similar meaning produce vectors pointing in similar directions.

No single number means "about payments" or "polite". Meaning is spread across all the dimensions, which is why embeddings are compared with each other rather than read directly.

How embeddings are made

Text is first split into tokens. A neural network, usually a transformer, processes them and pools its internal state into one vector for the whole passage. Embedding models are trained on very large numbers of pairs that should be close (a question and its answer, a caption and its image) and pairs that shouldn't, so the geometry ends up reflecting meaning.

Each model has its own vector space. A vector from one model can't be compared with a vector from another, even if both have the same number of dimensions.

Example: cosine similarity with three phrases

Real embeddings have hundreds of dimensions. These made-up three-dimensional ones show the calculation:

"refund status"           [0.82, 0.41, 0.10]
"where is my money back"  [0.78, 0.47, 0.15]
"change delivery address" [0.12, 0.30, 0.95]

Cosine similarity measures the angle between two vectors: their dot product divided by the product of their lengths. It runs from -1 to 1, and higher means more similar.

  • "refund status" vs "where is my money back": 0.995
  • "refund status" vs "change delivery address": 0.342

The two refund phrases share no keywords, yet their vectors are almost parallel. That is the basis of semantic search: embed the query, then find the stored vectors with the highest similarity, usually in a vector database.

What embeddings are used for

  • Retrieval for LLMs. The search step in retrieval-augmented generation.
  • Search and recommendations. Similar products, related articles and duplicate ticket detection.
  • Classification and clustering. Grouping or routing support tickets by training a small classifier on their vectors.
  • Matching across media. Models trained on images and captions put both in one space, so a text query can find a photo.

Choosing an embedding model

  • Test on your own data. Public leaderboards are a starting point. Write 50 to 100 real queries with known correct passages and measure how often the right one appears in the top five.
  • Check language coverage. If users write in Hindi, Tamil or mixed Hinglish, test those queries specifically.
  • Weigh dimensions against cost. More dimensions can capture more detail but take more storage and memory. Some models let you shorten their vectors with a modest loss of accuracy.
  • Plan for re-embedding. Changing the model means regenerating every stored vector, so store the model name and version with each one.
  • Apply the source's data rules. An embedding is derived from the original text, so the same retention and erasure rules should apply to it.

Embedding choice and chunking decide most retrieval results, as our guide to taking an LLM feature from demo to production explains.

Any idea in mind? Let's make it real.

Tell us what you're building. You'll hear back from an engineer, not a sales team, usually within one working day.

Book a 30-min call