Skip to content
AI & Machine Learning

Embeddings

Definition

Embeddings are lists of numbers that represent the meaning of text, images or other data, so that items with similar meanings end up close together. They power search by meaning, recommendations, grouping similar items, and the retrieval step in RAG.

Diagram

Embeddings as a map of meaningPhrases about signing in, such as reset my password and can’t get into my account, sit close together. Phrases about money, such as refund my order and charged twice, form another group, and phrases about delivery a third. A search is placed on the same map and finds its nearest neighbors, even when it shares no words with them.SIGNING INreset my passwordcan’t get into my accountforgot loginMONEYrefund my ordercharged twicemoney backDELIVERYwhere is my parcellate deliverytrack shipmentsearch: “locked out”
“Locked out” shares no words with “can’t get into my account”, but their embeddings are close, so search by meaning finds it. Real embeddings have hundreds of dimensions rather than two, and closeness is measured with math such as cosine similarity, but the idea is the same.

Worked example