README.md 4.69 KB
Newer Older
weishb's avatar
weishb committed
1
# Qwen3-VL-Reranker
weishb's avatar
weishb committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
## 论文
[Qwen3-VL-Embedding and Qwen3-VL-Reranker: A Unified Framework for State-of-the-Art Multimodal Retrieval and Ranking](https://arxiv.org/abs/2601.04720)

## 模型简介
Qwen3-VL-Embedding 和 Qwen3-VL-Reranker 模型系列是通义千问(Qwen)家族的最新成员,基于近期开源且强大的 Qwen3-VL 基础模型构建而成。该系列专为多模态信息检索与跨模态理解而设计,可接受包括文本、图像、截图和视频在内的多种输入形式,以及这些模态任意组合的混合输入。 Embedding 模型可生成高维向量,适用于检索、聚类等广泛场景;而 Reranker 模型则用于对初步结果进行精细化排序,二者共同构建了一套完整的前沿多模态搜索流水线。
多模态通用性:两个模型均能在统一框架下无缝处理文本、图像、截图和视频等多种输入,在图像-文本检索、视频-文本匹配、视觉问答(VQA)以及多模态内容聚类等多样化任务中均达到业界领先水平。
统一表征学习(Embedding):依托 Qwen3-VL 架构,Embedding 模型在共享语义空间中生成同时包含视觉与文本信息的丰富向量,从而高效支持跨模态的相似度计算与检索。
高精度重排序(Reranker):我们还推出了 Qwen3-VL-Reranker 系列模型,以补充 Embedding 模型的能力。Reranker 接收一个(查询,文档)对作为输入——其中查询和文档均可包含任意单一或混合模态——并输出精确的相关性分数。在检索流程中,通常先由 Embedding 模型执行高效的初步召回,再由 Reranker 在后续阶段对结果进行精细化重排序。这种两阶段方法显著提升了检索准确率。
卓越的实用性:继承 Qwen3-VL 的多语言能力,该系列支持 30 多种语言,非常适合全球化应用。其在实际场景中高度实用,提供灵活的向量维度、针对特定用例可定制的指令支持,即使使用量化后的嵌入向量也能保持强劲性能。这些特性使开发者能够轻松将两个模型集成到现有系统中,实现强大的跨语言与跨模态理解能力。
<div align=center>
    <img src="./doc/01.png"/>
</div>


## 环境依赖
| 软件 | 版本 |
| :------: | :------: |
weishb's avatar
weishb committed
19
| DTK | 26.04 |
weishb's avatar
weishb committed
20
21
| python | 3.10.12 |
| transformers | 4.57.6 |
weishb's avatar
weishb committed
22
| vllm | 0.15.1+das.opt1.alpha.dtk2604 |
weishb's avatar
weishb committed
23

weishb's avatar
weishb committed
24
推荐使用镜像:harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220
weishb's avatar
weishb committed
25
26
27
28
29

```bash
docker run -it \
    --shm-size 60g \
    --network=host \
weishb's avatar
weishb committed
30
    --name qwen3-vl-reranker \
weishb's avatar
weishb committed
31
32
33
34
35
36
37
38
39
40
    --privileged \
    --device=/dev/kfd \
    --device=/dev/dri \
    --device=/dev/mkfd \
    --group-add video \
    --cap-add=SYS_PTRACE \
    --security-opt seccomp=unconfined \
    -u root \
    -v /opt/hyhal/:/opt/hyhal/:ro \
    -v /path/your_code_data/:/path/your_code_data/ \
weishb's avatar
weishb committed
41
    harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220 bash
weishb's avatar
weishb committed
42
43
44
45
46
47
48
```
更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。

关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装

镜像内其他环境配置
```
weishb's avatar
weishb committed
49
pip install pycountry
weishb's avatar
weishb committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
```


## 数据集
暂无

## 训练
暂无

## 推理
### vllm
#### 单机推理


weishb's avatar
weishb committed
64
65
```bash
## serve启动
weishb's avatar
weishb committed
66
vllm serve Qwen/Qwen3-VL-Reranker-8B \
weishb's avatar
weishb committed
67
68
69
70
71
    --runner pooling \
    --hf-overrides '{"architectures":  ["Qwen3VLForSequenceClassification"],"classifier_from_token":["no","yes"],"is_original_qwen3_reranker":true}' \
    --chat-template qwen3_vl_reranker.jinja \
    --max-model-len 4096 \
    --served-model-name qwen3-vl-reranker
weishb's avatar
weishb committed
72
73

## client访问
weishb's avatar
weishb committed
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
curl -s http://127.0.0.1:8000/rerank \
    -H "Content-Type: application/json" \
    -d '{
      "model": "qwen3-vl-reranker",
      "query": "如何部署 vLLM 的 reranker 服务?",
      "documents": [
        "先安装依赖,然后使用 vllm serve 启动服务,并调用 /score 接口。",
        "今天的天气不错,适合出去散步。"
      ]
    }'
```


## 效果展示

weishb's avatar
weishb committed
89
![alt text](./doc/image.png)
weishb's avatar
weishb committed
90
91
92
93
94
95
96
97
98
99
100

### 精度
`DCU与GPU精度一致,推理框架:vllm`

## 预训练权重
| 模型名称  | 权重大小  | DCU型号  | 最低卡数需求 |下载地址|
|:-----:|:----------:|:----------:|:---------------------:|:----------:|
| Qwen3-VL-Reranker-8B | 8B | K100AI | 1 | [Modelscope](https://www.modelscope.cn/models/Qwen/Qwen3-VL-Reranker-8B)|
| Qwen3-VL-Reranker-2B | 2B | K100AI | 1 | [Modelscope](https://www.modelscope.cn/models/Qwen/Qwen3-VL-Reranker-2B)|

## 源码仓库及问题反馈
weishb's avatar
weishb committed
101
- https://developer.sourcefind.cn/codes/modelzoo/qwen3-vl-reranker_vllm
weishb's avatar
weishb committed
102
103
104

## 参考资料
- https://github.com/QwenLM/Qwen3-VL-Embedding