littlebird13 commited on
Commit
adcbfd9
·
verified ·
1 Parent(s): 1e6d4ea

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +145 -3
README.md CHANGED
@@ -1,3 +1,145 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Qwen3-VL-Embedding-2B
2
+
3
+ <p align="center">
4
+ <img src="https://qianwen-res.oss-accelerate-overseas.aliyuncs.com/qwen3_vl_embedding_logo.png" width="400"/>
5
+ <p>
6
+
7
+ ## Highlights
8
+
9
+ The **Qwen3-VL-Embedding** and **Qwen3-VL-Reranker** model series are the latest additions to the Qwen family, built upon the recently open-sourced and powerful Qwen3-VL foundation model. Specifically designed for multimodal information retrieval and cross-modal understanding, this suite accepts diverse inputs including text, images, screenshots, and videos, as well as inputs containing a mixture of these modalities.
10
+
11
+ While the Embedding model generates high-dimensional vectors for broad applications like retrieval and clustering, the Reranker model is engineered to refine these results, establishing a comprehensive pipeline for state-of-the-art multimodal search.
12
+
13
+ - **Multimodal Versatility**: Both models seamlessly process inputs containing text, images, screenshots, and video within a unified framework. They achieve state-of-the-art performance across diverse multimodal tasks, including image-text retrieval, video-text matching, visual question answering (VQA), and multimodal content clustering.
14
+
15
+ - **Unified Representation Learning (Embedding)**: By leveraging the Qwen3-VL architecture, the Embedding model generates semantically rich vectors that capture both visual and textual information in a shared space. This facilitates efficient similarity computation and retrieval across different modalities.
16
+
17
+ - **High-Precision Reranking (Reranker)**: We simultaneously provide the Qwen3-VL-Reranker series to complement the embedding model. The Reranker accepts an input pair (Query, Document)—where both the query and document can consist of arbitrary single or mixed modalities—and outputs a precise relevance score. In retrieval scenarios, the Embedding and Reranker models are typically used in tandem: the embedding model handles the initial recall stage, while the reranker manages the re-ranking stage. This two-step process significantly enhances the final retrieval accuracy.
18
+
19
+ - **Exceptional Practicality**: Inheriting Qwen3-VL's multilingual capabilities, the series supports over **30** languages, making it ideal for global applications. It is highly practical for real-world scenarios, offering flexible vector dimensions, customizable instructions for specific use cases, and strong performance even with quantized models. These features allow developers to easily integrate both models into existing pipelines for applications requiring robust cross-lingual and cross-modal understanding.
20
+
21
+ ## Model Overview
22
+
23
+ **Qwen3-VL-Embedding-2B** has the following features:
24
+
25
+ - Model Type: MultiModal Embedding
26
+ - Supported Languages: 30+ Languages
27
+ - Supported Input Modalities: Text, images, screenshots, videos, and arbitrary multimodal combinations (e.g., text + image, text + video)
28
+ - Number of Parameters: 2B
29
+ - Context Length: 32k
30
+ - Embedding Dimension: Up to 2048, supports user-defined output dimensions ranging from 64 to 2048
31
+
32
+ For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our [blog](https://qwenlm.github.io/blog/qwen3-embedding/), [GitHub](https://github.com/QwenLM/Qwen3-VL-Embedding).
33
+
34
+ ## Qwen3-VL-Embedding and Qwen3-VL-Reranker Model list
35
+
36
+ | Model | Size | Model Layers | Sequence Length | Embedding Dimension | Quantization Support | MRL Support | Instruction Aware |
37
+ |---|---|---|---|---|----------------------|---|---|
38
+ | [Qwen3-VL-Embedding-2B] | 2B | 28 | 32K | 2048 | Yes | Yes | Yes |
39
+ | [Qwen3-VL-Embedding-8B] | 8B | 36 | 32K | 4096 | Yes | Yes | Yes |
40
+ | [Qwen3-VL-Reranker-2B] | 2B | 28 | 32K | - | - | - | Yes |
41
+ | [Qwen3-VL-Reranker-8B] | 8B | 36 | 32K | - | - | - | Yes |
42
+
43
+ > **Note**:
44
+ > - `Quantization Support` indicates the supported quantization post process for the output embedding.
45
+ > - `MRL Support` indicates whether the embedding model supports custom dimensions for the final embedding.
46
+ > - `Instruction Aware` notes whether the embedding or reranking model supports customizing the input instruction according to different tasks.
47
+ > Our evaluation indicates that, for most downstream tasks, using instructions (instruct) typically yields an improvement of 1% to 5% compared to not using them. Therefore, we recommend that developers create tailored instructions specific to their tasks and scenarios. In multilingual contexts, we also advise users to write their instructions in English, as most instructions utilized during the model training process were originally written in English.
48
+
49
+ ## Model Performance
50
+
51
+ ### Evaluation Results on [MMEB-V2](https://huggingface.co/spaces/TIGER-Lab/MMEB-Leaderboard)
52
+
53
+ Results on the MMEB-V2 benchmark. All models except IFM-TTE have been re-evaluated on the updated VisDoc OOD split. CLS: classification, QA: question answering, RET: retrieval, GD: grounding, MRET: moment retrieval, VDR: ViDoRe, VR: VisRAG, OOD: out-of-distribution.
54
+
55
+ | Model | Model Size | Image CLS | Image QA | Image RET | Image GD | Image Overall | Video CLS | Video QA | Video RET | Video MRET | Video Overall | VisDoc VDRv1 | VisDoc VDRv2 | VisDoc VR | VisDoc OOD | VisDoc Overall | All |
56
+ |----------------------------|---------|-------|------|------|------|-----------|------|------|------|------|------|-------|------|--------|------|------|--------|
57
+ | **# of Datasets →** | | 10 | 10 | 12 | 4 | 36 | 5 | 5 | 5 | 3 | 18 | 10 | 4 | 6 | 4 | 24 | 78 |
58
+ | VLM2Vec | 2B | 58.7 | 49.3 | 65.0 | 72.9 | 59.7 | 33.4 | 30.5 | 20.6 | 30.7 | 28.6 | 49.8 | 13.5 | 51.8 | 48.2 | 44.0 | 47.7 |
59
+ | VLM2Vec-V2 | 2B | 62.9 | 56.3 | 69.5 | 77.3 | 64.9 | 39.3 | 34.3 | 28.8 | 36.8 | 34.6 | 75.5 | 44.9 | 79.4 | 62.2 | 69.2 | 59.2 |
60
+ | GME-2B | 2B | 54.4 | 29.9 | 66.9 | 55.5 | 51.9 | 34.9 | 42.0 | 25.6 | 31.1 | 33.6 | 86.1 | 54.0 | 82.5 | 67.5 | 76.8 | 55.3 |
61
+ | GME-7B | 7B | 57.7 | 34.7 | 71.2 | 59.3 | 56.0 | 37.4 | 50.4 | 28.4 | 37.0 | 38.4 | 89.4 | 55.6 | 85.0 | 68.3 | 79.3 | 59.1 |
62
+ | Ops-MM-embedding-v1 | 8B | 69.7 | 69.6 | 73.1 | 87.2 | 72.7 | 59.7 | 62.2 | 45.7 | 43.2 | 53.8 | 80.1 | 59.6 | 79.3 | 67.8 | 74.4 | 68.9 |
63
+ | IFM-TTE | 8B | 76.7 | 78.5 | 74.6 | 89.3 | 77.9 | 60.5 | 67.9 | 51.7 | 54.9 | 59.2 | 85.2 | 71.5 | 92.7 | 53.3 | 79.5 | 74.1 |
64
+ | RzenEmbed | 8B | 70.6 | 71.7 | 78.5 | 92.1 | 75.9 | 58.8 | 63.5 | 51.0 | 45.5 | 55.7 | 89.7 | 60.7 | 88.7 | 69.9 | 81.3 | 72.9 |
65
+ | Seed-1.6-embedding-1215 | unknown | 75.0 | 74.9 | 79.3 | 89.0 | 78.0 | 85.2 | 66.7 | 59.1 | 54.8 | 67.7 | 90.0 | 60.3 | 90.0 | 70.7 | 82.2 | 76.9 |
66
+ | **Qwen3-VL-Embedding-2B** | 2B | 70.2 | 74.4 | 74.9 | 88.6 | 75.0 | 72.8 | 63.8 | 52.3 | 51.6 | 61.1 | 85.2 | 66.0 | 86.3 | 74.3 | 80.2 | 73.4 |
67
+ | **Qwen3-VL-Embedding-8B** | 8B | 74.4 | 81.0 | 80.0 | 92.2 | 80.1 | 79.1 | 70.1 | 57.0 | 53.2 | 66.1 | 88.2 | 69.9 | 88.8 | 78.3 | 83.3 | **77.9** |
68
+
69
+ ### Evaluation Results on [MMTEB](https://huggingface.co/spaces/mteb/leaderboard)
70
+
71
+ Results on the MMTEB benchmark.
72
+
73
+ | Model | Size | Mean (Task) | Mean (Type) | Bitxt Mining | Class. | Clust. | Inst. Retri. | Multi. Class. | Pair. Class. | Rerank | Retri. | STS |
74
+ |----------------------------------|:-------:|:-------------:|:-------------:|:--------------:|:--------:|:--------:|:--------------:|:---------------:|:--------------:|:--------:|:--------:|:------:|
75
+ | NV-Embed-v2 | 7B | 56.29 | 49.58 | 57.84 | 57.29 | 40.80 | 1.04 | 18.63 | 78.94 | 63.82 | 56.72 | 71.10|
76
+ | GritLM-7B | 7B | 60.92 | 53.74 | 70.53 | 61.83 | 49.75 | 3.45 | 22.77 | 79.94 | 63.78 | 58.31 | 73.33|
77
+ | BGE-M3 | 0.6B | 59.56 | 52.18 | 79.11 | 60.35 | 40.88 | -3.11 | 20.1 | 80.76 | 62.79 | 54.60 | 74.12|
78
+ | multilingual-e5-large-instruct | 0.6B | 63.22 | 55.08 | 80.13 | 64.94 | 50.75 | -0.40 | 22.91 | 80.86 | 62.61 | 57.12 | 76.81|
79
+ | gte-Qwen2-1.5B-instruct | 1.5B | 59.45 | 52.69 | 62.51 | 58.32 | 52.05 | 0.74 | 24.02 | 81.58 | 62.58 | 60.78 | 71.61|
80
+ | gte-Qwen2-7b-Instruct | 7B | 62.51 | 55.93 | 73.92 | 61.55 | 52.77 | 4.94 | 25.48 | 85.13 | 65.55 | 60.08 | 73.98|
81
+ | text-embedding-3-large | - | 58.93 | 51.41 | 62.17 | 60.27 | 46.89 | -2.68 | 22.03 | 79.17 | 63.89 | 59.27 | 71.68|
82
+ | Cohere-embed-multilingual-v3.0 | - | 61.12 | 53.23 | 70.50 | 62.95 | 46.89 | -1.89 | 22.74 | 79.88 | 64.07 | 59.16 | 74.80|
83
+ | Gemini Embedding | - | 68.37 | 59.59 | 79.28 | 71.82 | 54.59 | 5.18 | **29.16** | 83.63 | 65.58 | 67.71 | 79.40|
84
+ | Qwen3-Embedding-0.6B | 0.6B | 64.33 | 56.00 | 72.22 | 66.83 | 52.33 | 5.09 | 24.59 | 80.83 | 61.41 | 64.64 | 76.17|
85
+ | Qwen3-Embedding-4B | 4B | 69.45 | 60.86 | 79.36 | 72.33 | 57.15 | **11.56** | 26.77 | 85.05 | 65.08 | 69.60 | 80.86|
86
+ | Qwen3-Embedding-8B | 8B | **70.58** | **61.69** | **80.89** | **74.00** | **57.65** | 10.06 | 28.66 | **86.40** | **65.63** | **70.88** | **81.08** |
87
+ | Qwen3-VL-Embedding-2B | 2B | 63.87 | 55.84 | 69.51 | 65.86 | 52.50 | 3.87 | 26.08 | 78.50 | 64.80 | 67.12 | 74.29 |
88
+ | Qwen3-VL-Embedding-8B | 8B | 67.88 | 58.88 | 77.48 | 71.95 | 55.82 | 4.46 | 28.59 | 81.08 | 65.72 | 69.41 | 75.41 |
89
+
90
+
91
+ ## Usage
92
+
93
+ - **requirements**
94
+ ```text
95
+ transformers>=4.57.0
96
+ qwen-vl-utils>=0.0.14
97
+ torch==2.8.0
98
+ ```
99
+
100
+ ### Basic Usage Example
101
+
102
+ ```python
103
+ from scripts.qwen3_vl_embedding import Qwen3VLEmbedder
104
+ import numpy as np
105
+ import torch
106
+
107
+ # Define a list of query texts
108
+ queries = [
109
+ {"text": "A woman playing with her dog on a beach at sunset."},
110
+ {"text": "Pet owner training dog outdoors near water."},
111
+ {"text": "Woman surfing on waves during a sunny day."},
112
+ {"text": "City skyline view from a high-rise building at night."}
113
+ ]
114
+
115
+ # Define a list of document texts and images
116
+ documents = [
117
+ {"text": "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust."},
118
+ {"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"},
119
+ {"text": "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust.", "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"}
120
+ ]
121
+
122
+ # Specify the model path
123
+ model_name_or_path = "Qwen/Qwen3-VL-Embedding-2B"
124
+
125
+ # Initialize the Qwen3VLEmbedder model
126
+ model = Qwen3VLEmbedder(model_name_or_path=model_name_or_path)
127
+ # We recommend enabling flash_attention_2 for better acceleration and memory saving,
128
+ # model = Qwen3VLEmbedder(model_name_or_path=model_name_or_path, torch_dtype=torch.float16, attn_implementation="flash_attention_2")
129
+
130
+ # Combine queries and documents into a single input list
131
+ inputs = queries + documents
132
+
133
+ # Process the inputs to get embeddings
134
+ embeddings = model.process(inputs)
135
+
136
+ # Compute similarity scores between query embeddings and document embeddings
137
+ similarity_scores = (embeddings[:4] @ embeddings[4:].T)
138
+
139
+ # Print out the similarity scores in a list format
140
+ print(similarity_scores.tolist())
141
+
142
+ # [[0.8157786130905151, 0.7178360223770142, 0.7173429131507874], [0.5195091962814331, 0.3302568793296814, 0.4391537308692932], [0.3884059488773346, 0.285782128572464, 0.33141762018203735], [0.1092604324221611, 0.03871120512485504, 0.06952016055583954]]
143
+ ```
144
+
145
+ For more usage examples, please visit our [GitHub repository](https://github.com/QwenLM/Qwen3-VL-Embedding).