AI and automation

Embeddings — numerical representations for semantic search

Embeddings represent text or other data as numerical vectors designed to capture relationships useful for a particular model and task. Similar inputs can have nearby representations under a chosen similarity measure.

Published: Updated: 3 min read
Schema: Embeddings and vector search. Material - Vector - Similarity.

What are embeddings?

Embeddings represent text or other data as numerical vectors designed to capture relationships useful for a particular model and task. Similar inputs can have nearby representations under a chosen similarity measure. This supports semantic retrieval, clustering and recommendations. A vector is not a human-readable explanation of meaning or proof that two documents make the same factual claim.

Material preparation

Divide documents into meaningful pieces and retain IDs, titles, dates and permissions. A fragment that is too short may lose context, and a fragment that is too long may confuse several topics. Tables and codes require separate attention because simple flattening can destroy relationships. Queries and documents must use a compatible encoding method. Vectors from different models should not be treated as directly comparable just because they are similar in length.

Vector index

A database or search engine stores representations and allows you to find the closest candidates. Approximate methods may speed up queries at the expense of some accuracy. Parameters should be selected on representative data, taking into account latency, cost and accuracy. A high similarity score is not a universal probability of a correct answer. A threshold that makes sense for one model or set may not perform the same after migration.

Hybrid search

A combination of text and vector matching can be useful when users type both natural questions and accurate symbols. Metadata filters can limit the scope to the appropriate language, department or product version. An additional ranking allows you to organize the found fragments. This does not replace permissions checking: a document that is not accessible to a person should not be included in the results or model context regardless of high similarity.

Privacy and update

Vectors should not be automatically considered anonymous. They may be associated with sensitive content and require appropriate access and removal policies. Update the appropriate portions when the document changes, and schedule an index recalculation when the model changes. Keep a version of the configuration so that differences in results can be explained. Don't post a raw index publicly just because it contains numbers instead of sentences.

How to test accuracy?

Prepare a set of questions with expected documents, including paraphrases, typos, and examples without the correct answer. Evaluate whether important material is included in the first results and then whether the application can use it correctly. In RAG, misretrieval and misgeneration are separate problems. A good demonstration result on a few easy questions does not replace a test of coverage of the entire resource and the real language of users.

Hybrid search selection example

A natural question about replacement may match the instructions' meaning, while the exact part symbol requires a specific string of characters. A vector-only search may confuse very similar models, and a text-only search may miss paraphrase. A combination of methods and filters allows you to cover both cases. However, the quality must be assessed based on the recipients' questions, not on the similarity of a few demonstrative sentences.

After changing the embedding model, plan to update documents and queries accordingly. The dimension of a vector is not the complete definition of space. Maintain a configuration version and control the deletion of source data and its representations. Vectors should not be treated as automatically anonymous; may remain associated with confidential content and require appropriate retention and access policies.

Sources and further reading

Use the primary documentation to check the principles and limitations described in this article.

How we prepare the glossary

These articles combine original editorial work, AI support for editing and translation, and checks against linked primary documentation. Examples are illustrative unless stated otherwise; they do not represent client results. Dates refer to publication and actual content changes.

From knowledge to action

Need help putting this into practice?

Tell us about your website or process. We will define the scope and the next practical step.

Discuss your project