Choosing and Configuring Embedding Models
This lesson explains how embeddings represent the meaning of content as vectors that make semantic search possible, and how to choose and configure an embedding model.
Learning outcomes
After completing this lesson, you will be able to:
- Explain how embeddings enable semantic search.
- Configure Bedrock embedding models.
- Choose dimensions and evaluate domain fit.
- Generate embeddings at scale.
How embeddings enable semantic search
Keyword search finds documents that contain the words in a query, but users often describe what they need in different words from the ones documents use. Semantic search addresses this by comparing meaning rather than words, and embeddings make that possible.
An embedding model converts an input, such as a sentence, a passage or an image, into a fixed-length list of numbers called a vector, for example 1,024 numbers. The model is trained so that inputs with similar meaning produce vectors that are close together. Closeness is measured with cosine similarity, which compares the angle between vectors, Euclidean (L2) distance or the inner (dot) product. Semantic search embeds the documents in advance and stores their vectors; at query time it embeds the query with the same model and finds the stored vectors nearest to it. As a result, "how do I reset my password" matches a document titled "Recovering account access" even though the two share no words.
The following diagram shows a query and passages as points in a vector space.

How embeddings work
Embedding models on Amazon Bedrock
Amazon Titan Text Embeddings V2 accepts up to 8,192 tokens of text, supports more than 100 languages, and outputs 1,024, 512 or 256 dimensions, with an option to normalise vectors. Amazon Titan Multimodal Embeddings embeds images and text into one space for image search by text or image. Amazon Nova Multimodal Embeddings embeds text, documents, images, video and audio into a single space. Cohere Embed models offer strong English and multilingual retrieval and distinguish query and document input types.
import boto3, json
brt = boto3.client("bedrock-runtime")
body = {"inputText": "How do I reset my password?", "dimensions": 512, "normalize": True}
r = brt.invoke_model(modelId="amazon.titan-embed-text-v2:0", body=json.dumps(body))
vector = json.loads(r["body"].read())["embedding"] # 512 floats8,192tokens
Maximum input to Titan Text Embeddings V2
1,024 / 512 / 256dimensions
Output sizes of Titan Text Embeddings V2
100+languages
Supported by Titan Text Embeddings V2
Choosing dimensions and evaluating domain fit
More dimensions capture more nuance but cost more storage, memory and query time. Reducing Titan V2 from 1,024 to 256 dimensions cuts vector storage by three quarters with a modest loss of retrieval accuracy, which is often acceptable for large corpora. The only reliable way to choose is to evaluate: build a set of real queries with the documents that should be found, embed the corpus with each candidate model and dimension, and compare recall at k and latency.
Domain fit matters most for specialised vocabularies such as medical, legal or internal product names, and for languages other than English. The following table summarises the trade-offs.
| Choice | Benefit | Cost |
|---|---|---|
| Higher dimensions (1,024) | Best accuracy | More storage, memory and latency |
| Lower dimensions (256 or 512) | Smaller, faster indexes | Slightly lower accuracy |
| Multimodal model | Images and text in one search | Usually lower text-only accuracy than text models |
| Multilingual model | Cross-language retrieval | Evaluate per language |
The following diagram compares two embedding dimension settings for a vector index on recall, storage and memory.

Dimensions and storage
Generating embeddings at scale
A knowledge base may contain millions of chunks, and embedding them one request at a time is slow and quickly reaches the model's request quota. Three approaches handle this scale. Lambda functions can consume chunks from an SQS queue in batches, with reserved concurrency to keep the request rate below the quota and automatic retries for throttled calls. Bedrock batch inference processes large sets of embedding requests asynchronously at a lower price for supported models. And Bedrock Knowledge Bases embed documents automatically during each sync, managing throughput themselves.
Whatever the method, documents and queries must be embedded with the same model and the same number of dimensions. Vectors produced by different models, or by the same model at different dimensions, are not comparable, so changing the embedding model means re-embedding the entire corpus and rebuilding the index, usually into a new index that replaces the old one once it is complete.
Embedding a large corpus
Shrinking an index
A vector index of 300 million chunks at 1,024 dimensions has become expensive, and query latency is rising. An evaluation shows recall at 10 of 0.91 at 1,024 dimensions and 0.89 at 256.
Re-embedding with Titan Text Embeddings V2 at 256 dimensions cuts vector storage and memory by about 75% and improves latency for a two-point recall loss, which a reranker can recover. Both documents and queries must use the new setting, so the switch is a full re-index into a new index followed by a cut-over.
Which embeddings let a text query find relevant images?
Show answer
Multimodal embeddings, which place images and text in the same vector space.
Exam Tips
Remember for the exam
- Titan Text Embeddings V2: up to 8,192 tokens; 1,024, 512 or 256 dimensions.
- Fewer dimensions: smaller, faster indexes with a small accuracy loss.
- Images and text together: multimodal embeddings.
- Same model and dimensions for documents and queries; a model change requires re-embedding.