Use embedding models to create text embeddings that capture the meaning of a sentence or a passage. You can use these models with classifiers such as support vector machines. Embedding models can also help you with retrieval-augmented generation
tasks.
The following diagram illustrates the retrieval-augmented generation pattern with embedding support.
The retrieval-augmented generation pattern with embedding support involves the following steps:
Convert your content into text embeddings and store them in a vector data store.
Use the same embedding model to convert the user input into text embeddings.
Run a similarity or semantic search in your knowledge base for content that is related to a user's question.
Pull the most relevant search results into your prompt as context and add an instruction, such as “Answer the following question by using only information from the following passages.”
Send the combined prompt text (instruction + search results + question) to the foundation model.
The foundation model uses contextual information from the prompt to generate a factual answer.
USE embeddings are wrappers around Google Universal Sentence Encoder embeddings that are available in TFHub. These embeddings are used in the document classification SVM algorithm. For a list of pretrained USE embeddings and their supported
languages, see Included pretrained USE embeddings
When using USE embeddings, consider the following:
Choose embedding_use_en_stock if your task involves English text.
Choose one of the multilingual USE embeddings if your task involves text in a non-English language, or you want to train multilingual models.
The USE embeddings exhibit different trade-offs between quality of the trained model and throughput at inference time, as described below. Try different embeddings to decide the trade-off between quality of result and inference throughput
that is appropriate for your use case.
embedding_use_multi_small has reasonable quality, but it is fast at inference time
embedding_use_en_stock is a English-only version of embedding_embedding_use_multi_small, hence it is smaller and exhibits higher inference throughput
embedding_use_multi_large is based on Transformer architecture, and therefore it provides higher quality of result, with lower throughput at inference time
The following table lists the pretrained blocks for USE embeddings that are available and the languages that are supported. For a list of the language codes and the corresponding language, see Language codes.
List of pretrained USE embeddings with their supported languages
Block name
Model name
Supported languages
use
embedding_use_en_stock
English only
use
embedding_use_multi_small
ar, de, el, en, es, fr, it, ja, ko, nb, nl, pl, pt, ru, th, tr, zh_tw, zh
use
embedding_use_multi_large
ar, de, el, en, es, fr, it, ja, ko, nb, nl, pl, pt, ru, th, tr, zh_tw, zh
About cookies on this siteOur websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising.For more information, please review your cookie preferences options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.