Model reference · open weights
gme-Qwen2-VL is an open-weight embedding model from Alibaba. gme-Qwen2-VL-7B-Instruct (FP32) weighs 16.6 GB; the smallest configuration that runs it is RTX 4090 24 GB.
Summary of the Alibaba-NLP/gme-Qwen2-VL-2B-Instruct model card, 2026-10-01. The estimate below is for another build of the family.
What it is
| Released by | Alibaba |
|---|---|
| Released | 2024-12-21 |
| Parameters | 2.2B |
| VRAM | 16.6 GB for the weights |
What it runs on
| Card | Runs | Memory |
|---|---|---|
| RTX 3060 12 GB … RTX 4060 Ti 16 GB | does not fit | |
| RTX 3090 24 GB | fits | 23.4 GB |
| RTX 4090 24 GB | fits | 23.4 GB |
| RTX 5090 32 GB | fits | 31.0 GB |
| L40S 48 GB | fits | 44.0 GB |
| A100 80 GB | fits | 78.2 GB |
| H100 80 GB | fits | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | fits | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | fits | 107 GB |
| H200 141 GB | fits | 138 GB |
| B200 180 GB | fits | 176 GB |
Builds
| Build | Params | Precision | Weights | Smallest setup |
|---|---|---|---|---|
| gme-Qwen2-VL-2B-Instruct ↗ | 2.2B | FP32 | 4.4 GB | RTX 3060 12 GB |
| gme-Qwen2-VL-7B-Instruct (above) ↗ | 8.3B | FP32 | 16.6 GB | RTX 4090 24 GB |
From the model card
We are excited to present GME-Qwen2VL series of unified multimodal embedding models,
which are based on the advanced Qwen2-VL multimodal large language models (MLLMs).
The GME models support three types of input: text, image, and image-text pair, all of which can produce universal vector representations and have powerful retrieval performance.
Key Enhancements of GME Models:
Qwen2-VL and our training data, GME models support dynamic resolution image input.Developed by: Tongyi Lab, Alibaba Group
Paper: GME: Improving Universal Multimodal Retrieval by Multimodal LLMs
| Models | Model Size | Max Seq. Length | Dimension | MTEB-en | MTEB-zh | UMRB |
|---|---|---|---|---|---|---|
gme-Qwen2-VL-2B | 2.21B | 32768 | 1536 | 65.27 | 66.92 | 64.45 |
gme-Qwen2-VL-7B | 8.29B | 32768 | 3584 | 67.48 | 69.73 | 67.44 |
Transformers
The remote code has some issues with transformers>=4.52.0, please downgrade or use sentence_transformers
from transformers import AutoModel
from transformers.utils.versions import require_version
require_version(
"transformers<4.52.0",
"The remote code has some issues with transformers>=4.52.0, please downgrade: pip install transformers==4.51.3"
)
t2i_prompt = 'Find an image that matches the given text.'
texts = [
"The Tesla Cybertruck is a battery electric pickup truck built by Tesla, Inc. since 2023.",
"Alibaba office.",
]
images = [
'https://upload.wikimedia.org/wikipedia/commons/e/e9/Tesla_Cybertruck_damaged_window.jpg',
'https://upload.wikimedia.org/wikipedia/commons/e/e0/TaobaoCity_Alibaba_Xixi_Park.jpg',
]
gme = AutoModel.from_pretrained(
"Alibaba-NLP/gme-Qwen2-VL-2B-Instruct",
torch_dtype="float16", device_map='cuda', trust_remote_code=True
)
# Single-modal embedding
e_text = gme.get_text_embeddings(texts=texts)
e_image = gme.get_image_embeddings(images=images)
print('Single-modal', (e_text @ e_image.T).tolist())
## Single-modal [[0.359619140625, 0.0655517578125], [0.04180908203125, 0.374755859375]]
# How to set embedding instruction
e_query = gme.get_text_embeddings(texts=texts, instruction=t2i_prompt)
# If is_query=False, we always use the default instruction.
e_corpus = gme.get_image_embeddings(images=images, is_query=False)
print('Single-modal with instruction', (e_query @ e_corpus.T).tolist())
## Single-modal with instruction [[0.429931640625, 0.11505126953125], [0.049835205078125, 0.409423828125]]
# Fused-modal embedding
e_fused = gme.get_fused_embeddings(texts=texts, images=images)
print('Fused-modal', (e_fused @ e_fused.T).tolist())
## Fused-modal [[1.0, 0.05511474609375], [0.05511474609375, 1.0]]
sentence_transformers
The encode function accept str or dict with key(s) in {'text', 'image', 'prompt'}.
Do not pass prompt as the argument to encode, pass as the input as a dict with a prompt key.
from sentence_transformers import SentenceTransformer
t2i_prompt = 'Find an image that matches the given text.'
texts = [
"The Tesla Cybertruck is a battery electric pickup truck built by Tesla, Inc. since 2023.",
"Alibaba office.",
]
images = [
'https://upload.wikimedia.org/wikipedia/commons/e/e9/Tesla_Cybertruck_damaged_window.jpg',
'https://upload.wikimedia.org/wikipedia/commons/e/e0/TaobaoCity_Alibaba_Xixi_Park.jpg',
]
gme_st = SentenceTransformer("Alibaba-NLP/gme-Qwen2-VL-2B-Instruct")
# Single-modal embedding
e_text = gme_st.encode(texts, convert_to_tensor=True)
e_image = gme_st.encode([dict(image=i) for i in images], convert_to_tensor=True)
print('Single-modal', (e_text @ e_image.T).tolist())
## Single-modal [[0.356201171875, 0.06536865234375], [0.041717529296875, 0.37890625]]
# How to set embedding instruction
e_query = gme_st.encode([dict(text=t, prompt=t2i_prompt) for t in texts], convert_to_tensor=True)
# If no prompt, we always use the default instruction.
e_corpus = gme_st.encode([dict(image=i) for i in images], convert_to_tensor=True)
print('Single-modal with instruction', (e_query @ e_corpus.T).tolist())
## Single-modal with instruction [[0.425537109375, 0.1158447265625], [0.049835205078125, 0.413818359375]]
# Fused-modal embedding
e_fused = gme_st.encode([dict(text=t, image=i) for t, i in zip(texts, images)], convert_to_tensor=True)
print('Fused-modal', (e_fused @ e_fused.T).tolist())
## Fused-modal [[0.99951171875, 0.0556640625], [0.0556640625, 0.99951171875]]
We validated the performance on our universal multimodal retrieval benchmark (UMRB, see Release UMRB) among others.
| | | Single-modal |
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.
Benchmarks
As published on the model card: the maker's own numbers, not measured by AxForge.
| Task | Dataset | Metric | Score |
|---|---|---|---|
| STS | MTEB AFQMC | cos_sim_pearson | 61.032 |
| STS | MTEB AFQMC | cos_sim_spearman | 67.549 |
| STS | MTEB AFQMC | euclidean_pearson | 65.390 |
| STS | MTEB AFQMC | euclidean_spearman | 67.549 |
| STS | MTEB AFQMC | manhattan_pearson | 65.253 |
| STS | MTEB AFQMC | manhattan_spearman | 67.342 |
| STS | MTEB ATEC | cos_sim_pearson | 50.838 |
| STS | MTEB ATEC | cos_sim_spearman | 54.032 |
| STS | MTEB ATEC | euclidean_pearson | 55.207 |
| STS | MTEB ATEC | euclidean_spearman | 54.032 |
| STS | MTEB ATEC | manhattan_pearson | 55.052 |
| STS | MTEB ATEC | manhattan_spearman | 53.813 |
| Classification | MTEB AmazonCounterfactualClassification (en) | accuracy | 72.552 |
| Classification | MTEB AmazonCounterfactualClassification (en) | ap | 35.015 |
| Classification | MTEB AmazonCounterfactualClassification (en) | f1 | 66.441 |
| Classification | MTEB AmazonPolarityClassification | accuracy | 96.758 |
| Classification | MTEB AmazonPolarityClassification | ap | 95.510 |
| Classification | MTEB AmazonPolarityClassification | f1 | 96.757 |
| Classification | MTEB AmazonReviewsClassification (en) | accuracy | 61.972 |
| Classification | MTEB AmazonReviewsClassification (en) | f1 | 60.507 |
| Classification | MTEB AmazonReviewsClassification (zh) | accuracy | 53.490 |
| Classification | MTEB AmazonReviewsClassification (zh) | f1 | 51.577 |
| Retrieval | MTEB ArguAna | map_at_1 | 36.273 |
| Retrieval | MTEB ArguAna | map_at_10 | 52.782 |