Mistral 发布 1.24B 开源多模态嵌入模型 Clipstral
mistralai/mistral-multimodal-embed-1B
Mistral AI 发布开源多模态嵌入模型 Mistral Multimodal Embed(代号 Clipstral),1.24B 参数,把图像、视频和多语言文本映射到同一个 1024 维空间。
官方给出 37 项零样本基准与 13 个开源编码器的横向对比,可据此判断 1.24B 多模态嵌入的性价比位置。
译文尚不完整,完整内容请切换到原文。
Mistral 多模态嵌入 - Clipstral
Mistral 多模态嵌入 (代号 Clipstral) 是一个 1.24B 参数的开权双编码器,它将 图像、视频和多语言文本 嵌入到一个共享的 1,024 维空间中。匹配的文本和视觉内容彼此靠近,因此相同的嵌入可用于文本到图像和文本到视频的搜索(以及反向搜索),使用图像或视频作为查询的视觉搜索,零样本图像和视频分类,以及数据集管理(如去重和过滤不匹配的对)。
- 原始分辨率和宽高比。 视觉 Transformer 以图像的原始大小和宽高比处理每个图像,并且 从 224 到 1036 px,准确率保持稳定。
- 视频。 一个轻量级的时空编码器同时关注所有帧的补丁标记 (训练和评估中每个片段有 16 帧)。
- 长、多语言文本。 文本塔楼有一个 131k 条目的多语言标记器,并且没有固定的上下文限制。
- 紧凑和快速。 总共 1.24B 参数。视频只是在每帧视觉 Transformer 之上添加了一个 4 层编码器, 因此大型图像和视频集合可以在单个 NVIDIA H100 上索引。
这个存储库是一个自包含的软件包:包含权重、标记器、图像处理器和所有自定义推理代码。 GitHub 存储库 添加了一个 Gradio 演示、一个示例笔记本和下面使用的示例媒体。
结果
我们将 Clipstral 与 13 个开权编码器进行了比较,参数量最高到 4B,再加上 Qwen3-VL-Embedding-8B 作为更大的参考,在一种零样本协议下:37 个基准测试(6 个图像检索、18 个图像分类、5 个视频检索、8 个视频分类),每个模型在 224、336、672 和 1036 px 下使用三种输入转换进行评估,保持其在每个数据集上的最佳分数(跨分辨率和转换的最佳分数)。 检索是排名 1 的召回率 (R@1),在两个方向上取平均值;分类是 top-1 准确率。
在参数量最高到 4B 的模型中,Clipstral 是最好的图像和视频 检索器,并且在图像和视频分类方面排名第二,仅次于参数量是其 1.7–2 倍的模型。
| 模型 | 参数 | 图像检索 | 图像分类 | 视频检索 | 视频分类 |
|---|---|---|---|---|---|
| Clipstral | 1.24B | 80.2 | 79.2 | 64.0 | 57.0 |
| PE-Core-L | 0.67B | 67.9 | 78.8 | 55.4 | 52.5 |
| PE-Core-G | 2.42B | 71.0 | 81.6 | 60.9 | 55.1 |
| MetaCLIP 2-H | 1.86B | 74.0 | 76.2 | 46.0 | 48.1 |
| MetaCLIP 2-bigG | 3.63B | 75.5 | 79.1 | 46.6 | 49.7 |
| SigLIP2-So400m | 1.14B | 73.1 | 77.9 | 46.7 | 49.3 |
| SigLIP2-g | 1.87B | 73.4 | 78.4 | 47.4 | 50.0 |
| TIPSv2-L | 0.49B | 60.1 | 67.4 | 43.6 | 39.2 |
| TIPSv2-g | 1.53B | 62.3 | 69.7 | 47.4 | 41.2 |
| VideoPrism-LvT-L | 0.58B | – | – | 58.5 | 51.5 |
| EmbeddingGemma 2 | 0.44B | 75.8 | 69.0 | 61.0 | 49.9 |
| C-RADIOv4-So400m | 1.15B | 75.1 | 76.1 | 46.4 | 46.8 |
| C-RADIOv4-H | 1.37B | 75.6 | 77.3 | 47.5 | 47.6 |
| Qwen3-VL-Embedding-2B | 2.13B | 77.5 | 69.5 | 61.9 | 57.8 |
| Qwen3-VL-Embedding-8B (参考) | 8.14B | 82.7 | 72.9 | 66.2 | 61.7 |
粗体:最佳,下划线:参数量最高到 4B 的模型中第二最佳。Qwen3-VL-Embedding 和 EmbeddingGemma 2 使用任务调整的指令。每个基准测试的结果,评估协议和吞吐量测量在论文中。
重点评估:
- 长标题。 在一个长标题检索套件(DOCCI、ActivityNet Captions、PVD 和 DiDeMo)上,Clipstral 在参数量最高到 4B 的模型中具有最高的平均 R@1(71.2,与 Qwen3-VL-Embedding-2B 的 69.8 和 EmbeddingGemma 2 的 69.7 相比)。
- 多语言检索。 在 XM3600(36 种语言)上,Clipstral 在所有语言中达到 59.7 R@1,是参数量最高到 4B 的模型中的最佳,在 35 种非英语语言中达到 59.7,而在英语中为 57.8。
- Resolution robustness. Clipstral's performance remains consistent across resolutions, from 224 to 1036 pixels. For instance, on video retrieval, its mean R@1 varies by less than one point (62.9 to 63.8). Other models lose accuracy significantly at high or low resolutions: PE-Core-L drops by 17 points at 1036 px (from 55.2 to 38.2) and VideoPrism-LvT-L by 11 (from 58.3 to 47.3), while TIPSv2-g drops by 16 points at 224 px (from 47.4 to 31.8) and EmbeddingGemma 2 by 8 (from 61.0 to 52.7).
Installation
The package is tested with python 3.13, transformers 4.57 / 5.8 / 5.18 / 5.23, on CPU (float32) and on NVIDIA GPU (bfloat16).
To run the demos of the GitHub repository, use uv from the repository root:
uv sync
The torch build is selected automatically via environment markers (see [tool.uv.sources] in
pyproject.toml): CUDA 13.0 on Linux, CPU-only on macOS and Windows, so plain uv sync and
uv run python app.py always install the right build for the current platform.
For other accelerators, follow the uv PyTorch guide.
Quick start
The model code ships with the weights and loads with trust_remote_code=True. The snippets below run in order
as one script, from any folder: the three example files (under 1 MB) are downloaded from the
GitHub repository. Replace them with your own files to embed your data.
import urllib.request
import cv2
import numpy as np
import torch
from PIL import Image
from transformers import AutoImageProcessor, AutoModel, AutoTokenizer
repo_id = "mistralai/mistral-multimodal-embed-1B"
assets = "https://raw.githubusercontent.com/mistralai/mistral-multimodal-embed/main/assets"
device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = torch.bfloat16 if device == "cuda" else torch.float32
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True, dtype=dtype).eval().to(device)
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
processor = AutoImageProcessor.from_pretrained(repo_id, trust_remote_code=True)
# --- text ---
texts = ["iconic windmill", "a gothic cathedral", "a statue in a sunny square"]
tok = tokenizer(texts, padding=True, return_tensors="pt")
with torch.inference_mode():
text_features = model.get_text_features(tok.input_ids.to(device), tok.attention_mask.to(device))
# --- images ---
image_paths = [urllib.request.urlretrieve(f"{assets}/images/image_0{i}.jpg", f"image_0{i}.jpg")[0] for i in (0, 1)]
images = [Image.open(path).convert("RGB") for path in image_paths]
pixel_values = [p.to(device=device, dtype=dtype) for p in processor(images)["pixel_values"]]
with torch.inference_mode():
image_features = model.get_image_features(pixel_values)
print(image_features @ text_features.T) # (num_images, num_texts) cosine similarities
The default keep_ratio transform preserves each image's aspect ratio, so images can have different shapes
and the processor returns a list of tensors (with squash or center_crop, it returns one stacked tensor).
All returned features are L2-normalized 1,024-dimensional float32 tensors, so a dot product is a cosine
similarity.
Videos
A video is embedded from 16 evenly spaced frames, here decoded with OpenCV and encoded at 224 px:
def read_frames(path: str, num_frames: int = 16) -> list[Image.Image]:
capture = cv2.VideoCapture(path)
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
assert frame_count > 0, f"could not read the frame count of {path}"
frames = []
for index in np.linspace(0, frame_count - 1, num_frames).round().astype(int):
capture.set(cv2.CAP_PROP_POS_FRAMES, int(index))
ok, bgr = capture.read()
assert ok, f"could not decode frame {index} of {path}"
frames.append(Image.fromarray(cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB)))
capture.release()
return frames
video_path = urllib.request.urlretrieve(f"{assets}/videos/video_02.mp4", "video_02.mp4")[0]
video_processor = AutoImageProcessor.from_pretrained(repo_id, trust_remote_code=True, size=224)
frames = video_processor(read_frames(video_path))["pixel_values"]
video = torch.stack(frames).to(device=device, dtype=dtype) # (16, 3, H, W)
with torch.inference_mode():
video_features = model.get_video_features([video]) # (1, 1024)
print(video_features @ text_features.T) # (num_videos, num_texts)
Frame order matters. get_video_features accepts either a (B, T, 3, H, W) tensor or a list of
(T, 3, H, W) clips; use a list when your videos have different frame counts or sizes. The processor also
accepts decoded uint8 frame tensors, for example from torchcodec.
Demos
The GitHub repository includes:
- Gradio app (
app.py): runuv run python app.pyand open http://localhost:7860. One tab searches the example images and videos with text; the other classifies example photos by city, zero-shot. - Notebook (
example.ipynb): text-to-image/video and image-to-image retrieval and zero-shot classification, to run locally or on Colab.
Model details
- Parameters: 1.24B in total: vision transformer 409M, spatio-temporal encoder 50M, text tower 783M.
- Embedding: 1,024 dimensions, shared by text, images, and videos.
- Vision tower: 24-layer ViT, hidden size 1,024, patch size 14, 2D RoPE,
and 2x2 patch merging. Images are pooled with a global max (
amax). - Video path: each frame goes through the vision tower. A 4-layer temporal encoder with 3D RoPE then attends across all frames' tokens jointly, and a global max pool produces one embedding per clip.
- Text tower: 14 layers, hidden size 1,792, causal attention with RoPE. The text embedding is taken at the end-of-sequence token.
The exact settings are in config.json.
Preprocessing details
- Default transform:
keep_ratioat 448 px. The longer side is resized to 448 and the aspect ratio is preserved. Each side is rounded to a multiple of 28 (patch size 14 x patch merge 2). Resizing uses OpenCVINTER_AREA. - 其他转换:
squash调整为正方形并忽略长宽比。center_crop进行正方形中心裁剪。两者都返回size x size张量,且size必须是 28 的倍数。 - 归一化: 均值
(0.48145466, 0.4578275, 0.40821073)和 标准差(0.26862954, 0.26130258, 0.27577711)。 - 不使用 OpenCV: 使用 torchvision 传递
use_cv2_resize=False进行调整大小。结果像素与默认 OpenCV 调整大小略有不同。 - 文本: 分词器自动添加序列开始和结束标记。结束标记是必需的,因为文本嵌入是从它读取的。填充在右侧。
范围
- 短视频。 视频训练使用最长约一分钟的片段,表示为 16 帧。更长的视频可能需要更多帧或片段级聚合。
- 一次一个输入。 每个输入单独嵌入(一个图像、一个视频或一段文本);图像加文本等混合输入不会联合编码。可能进行后期融合:单独嵌入每个输入然后组合嵌入,例如通过取平均值。
- 内容。 该模型针对自然图像和视频。文档、OCR 重内容以及代码在此版本中不在范围内。
文件
| 文件 | 目的 |
|---|---|
model.safetensors, config.json |
权重和模型配置 |
modeling_mistral_contrastive.py, configuration_mistral_contrastive.py |
模型代码,由 AutoModel 加载 |
image_processing_mistral_contrastive.py, image_transforms.py |
图像处理器,由 AutoImageProcessor 加载 |
preprocessor_config.json |
默认转换和分辨率 |
tokenizer.json, tokenizer_config.json, special_tokens_map.json |
分词器 |
引用
@misc{clipstral2026,
title = {Clipstral: Image, Video, and Multilingual Text Embedder},
author = {Mistral AI},
year = {2026},
url = {https://www.alphaxiv.org/abs/2611.clipstral-mistral-multimodal-embed-1b}
}
许可
Apache License 2.0 - 查看 LICENSE。
来源: Mistral AI · Hugging Face 新模型 · huggingface.co