Services

Resources

Company

Embeddings

Embeddings are fixed-length vectors of numbers that an embedding model produces from text, images or other data. The model places items with similar meaning close together in that vector space. Applications compare embeddings to search by meaning, cluster documents, or find the context a retrieval-augmented generation (RAG) app sends to a large language model.

How it works

You send a piece of text to an embedding model and get back a vector of a set size. For example, OpenAI's text-embedding-3-small returns 1,536 numbers per input. To compare two items, you compute cosine similarity between their vectors. The score runs from minus 1 to 1, and higher means closer in meaning. "How do I restart a pod?" and "Kubernetes pod restart steps" score high, while an unrelated sentence scores much lower.

Why it matters in production

Every embedding in a store must come from the same model. If you change the embedding model, you must re-embed the whole corpus, which costs time and money. Embedding calls also add latency and cost to each query, so teams trace them and track similarity scores to spot weak retrieval.

See also

On the One2N blog

References

  1. Efficient estimation of word representations in vector space (Mikolov et al., 2013)

  2. Sentence-BERT: sentence embeddings using siamese BERT networks (Reimers and Gurevych, 2019)

Comic about embeddings: a help site search for how do I reset my password finds nothing, because the doc says change your login details; a model turns each text into numbers, a point on a map, where similar meanings sit close and a pizza recipe sits far; search turns the question into a point and finds the closest doc; switching models means redoing all the numbers.