ladderlore
  • 输入服务名称,例如 S3 或 IAM。

概念 · 基于 AIF-C01

Embedding models for text and image

Choose and use Titan, Cohere or SageMaker embedding models, with matching dimensions and one model for index and query.

本课尚未翻译,暂以英文显示。

你在AI Practitioner中已学过

  • An embedding turns meaning into a vector of numbers.
  • Similar meanings give vectors that are close together.
  • Vectors are stored in a vector database and searched by similarity.
阅读AI Practitioner课程
  • Titan Text Embeddings V2

    Input
    Text, up to 8,192 tokens
    Note
    1,024 dimensions by default
  • Titan Multimodal Embeddings

    Input
    Text and images
    Note
    One space for both
  • Cohere Embed

    Input
    Text, v3 short, v4 very long
    Note
    Set document or query type
  • Your SageMaker model

    Input
    Whatever it supports
    Note
    You host and scale it
Four embedding model choices.

1 / 2

  • Titan Text Embeddings V2

    Input
    Text, up to 8,192 tokens
    Note
    1,024 dimensions by default
  • Titan Multimodal Embeddings

    Input
    Text and images
    Note
    One space for both
  • Cohere Embed

    Input
    Text, v3 short, v4 very long
    Note
    Set document or query type

2 / 2

  • Your SageMaker model

    Input
    Whatever it supports
    Note
    You host and scale it
Four embedding model choices.
Documents
Query
Model
Vector store
Nearest chunks
indexsearch
Documents and queries pass through the same model.

是什么

Amazon Bedrock offers embedding models. Amazon Titan Text Embeddings V2 takes up to 8,192 tokens and returns a 1,024-dimension vector by default, with smaller sizes available to save storage. Titan Multimodal Embeddings maps text and images into the same space, so a text query can find images. Cohere Embed v3 takes short text: up to 512 tokens, about 2,048 characters, per text. Cohere Embed v4 takes very long input, up to about 128,000 tokens, and images too. Both need an input type: search_document when you index, search_query when you search. Other types are classification and clustering. Each model has its own input limit and output size, so check both before you choose.

是什么

The same model must embed documents and queries. Vectors from two models are not comparable, and a vector index has one fixed dimension. Changing the model means re-embedding all data. You call the model with InvokeModel for one request at a time, which suits queries and small loads. For a large corpus, use batch inference or the ingestion job of a knowledge base, which is cheaper and avoids rate limits.

是什么

You can also host your own embedding model on a SageMaker endpoint, for example a sentence transformer from JumpStart or Hugging Face, when you need a specific language or domain model. Built-in algorithms such as BlazingText create word embeddings. Chunk text to fit the model input limit before you embed it.

要记住

  • Titan Text Embeddings V2: up to 8,192 tokens, 1,024 dimensions by default.
  • Titan Multimodal Embeddings: text and images in one space.
  • Cohere Embed: set the input type to document when indexing and query when searching.
  • Index and query need the same model. A new model needs new vectors.

要记住

  • InvokeModel for real-time requests. Batch or ingestion jobs for big corpora.
  • A SageMaker endpoint can host your own embedding model.

考试中

  • “Search images with a text query” points to a multimodal embedding model.
  • “Search results are poor after changing the embedding model” points to re-embedding with the same model for index and query.
  • “Embed millions of documents cheaply” points to batch inference or a knowledge base ingestion job.