Skip to content
IT glossary
Data and MLUpdated December 3, 2026

Embedding

Эмбеддинг

An embedding represents an item, such as a sentence or a product, as a list of numbers. Comparing these lists can reveal which items are similar in ways that matter for the task.

Also known as: векторное представление

What an embedding captures

An embedding places an item at a point in a space with many dimensions. The useful information is often in which items end up near one another, rather than in any single coordinate. In a product search system, for example, “carry-on luggage” might land near “cabin suitcase” even though the phrases share no words. What counts as similar depends on the training data and the job the model was trained to do.

Where the numbers come from

For a fixed set of IDs, such as products in a catalog, a model can learn an embedding table with one row per ID. During training, the values in each row are adjusted to improve an outcome such as predicting a purchase. A text encoder works differently: it computes a vector from the input text, so it can represent a new query without a dedicated row for it. One way to train a retrieval encoder is to give it examples of queries paired with relevant and irrelevant documents, then reward it for scoring the relevant pairs higher.

Example: retrieving help articles

Suppose a customer types “I can't sign in after changing phones.” The search service embeds the query and compares it with vectors it already computed for passages in the help center. A passage about moving an authenticator app may rank highly even if it never uses the phrase “changing phones.” The service can return the passage directly or pass it to a language model as context in a retrieval-augmented generation (RAG) pipeline.

Cosine similarity is one common scoring method: it compares the direction of two nonzero vectors without using their lengths. If both vectors are scaled to unit length, cosine similarity equals their dot product. For a small collection, a service can score every passage. For a large one, an approximate nearest-neighbor index can cut search time, at the cost of sometimes missing a true nearest neighbor.

When similarity is not enough

A high similarity score is not a guarantee that two statements agree or that a passage answers the question. Documents with opposite conclusions can be close because they discuss the same topic. Vector search can also miss exact identifiers such as ERR-2047, so a help center might combine it with keyword search. Outside search, learned embeddings are used in recommender systems and to find visually similar images.

Also, two models producing 768 numbers do not necessarily put those numbers in the same space. Queries and documents need compatible representations, typically from the same encoder or a pair trained to work together. An incompatible model change means regenerating document vectors and rebuilding the search index.

What comes up in interviews

A common design question is how to tell whether a new embedding model improves search. Use held-out queries with relevance labels and measure how many relevant passages appear in the top k results (Recall@k). Measure latency separately, and if you're also changing the index, compare its results with an exact search to isolate losses from approximation.