Embeddings in AI
What an Embedding Is
Embeddings in AI are lists of numbers, called vectors, that represent the meaning of a piece of data such as a word, sentence, document or image. An embedding model converts the input into such a vector so that items with similar meaning end up with similar vectors.
For example, “cheap web hosting” and “affordable shared hosting” use different words but have related meanings, so their embeddings sit close together in the vector space. A “banana bread recipe” would sit far away from both.
How Similarity Is Measured
Vectors are compared with a similarity measure, most commonly cosine similarity, which compares the direction of two vectors. A score near 1 means the items are very similar, and a score near 0 means they are unrelated. The individual numbers have no meaning on their own; only the relative positions of the vectors matter.
Modern embedding models typically produce vectors with hundreds or thousands of dimensions. More dimensions can capture more nuance but need more storage and compute.
Where Embeddings Are Used
- Semantic search: finding pages by meaning rather than exact keywords. A query such as “my site loads slowly” can match an article titled “improving page load time”.
- Recommendations: suggesting related products or articles based on similarity.
- Retrieval for chatbots: finding relevant passages to give a language model, as in retrieval augmented generation.
- Clustering and duplicates: grouping similar support tickets or spotting near-duplicate content.
Stored content and search queries must be converted with the same embedding model. Mixing models produces meaningless comparisons. Storing and searching large numbers of vectors is covered in vector databases.
Frequently asked questions
Do I Need Embeddings for a Site Search?
Not necessarily. Keyword search with a standard search index handles exact matches well. Embeddings add value when visitors phrase questions differently from your content, or when you want results ranked by meaning. Many sites combine both, using keyword matching first and semantic ranking afterwards.
Can Embeddings Expose Private Information?
They can carry information from the text they were created from, so treat them with the same care as the source data. Embeddings of customer messages or internal documents should be stored under the same access controls, and you should check what your embedding provider does with the data you send.