# Qwen3-Reranker ## 论文 [Qwen3 Embedding: Advancing Text Embedding and Reranking Through Foundation Models](https://arxiv.org/abs/2506.05176) ## 模型简介 Qwen3嵌入模型系列是Qwen3家族最新的专有模型,专门为文本嵌入和排序任务而设计此系列。继承了其基础模型出色的多语言能力、长文本理解和推理技能。Qwen3 嵌入系列在文本检索、代码检索、文本分类、文本聚类和双语文本挖掘等多种文本嵌入和排序任务中取得了显著进展。
## 环境依赖 | 软件 | 版本 | | :------: | :------: | | DTK | 26.04 | | Python | 3.10.12 | | Transformers | 4.57.6 | | Torch | 2.5.1+das.opt1.dtk2604.20260206.ga29664ea | | vLLM | 0.11.0+das.opt1.rc4.dtk2604.20260305.g49a30c70 | 推荐使用镜像:harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-py3.10 ```bash docker run -it \ --shm-size 256g \ --network=host \ --name qwen3-reranker \ --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/ \ harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-py3.10 bash ``` ## 预训练权重 **请根据`支持的DCU型号`选择对应模型下载,FP8模型仅在BW1100/BW1101上支持,其他型号请勿使用!** | 模型名称 | 权重大小 | 数据类型 | 支持的DCU型号 | 最低卡数需求 |下载地址| |:-----:|:----------:|:----------:|:----------:|:---------------------:|:----------:| | Qwen3-Reranker-0.6B | 0.6B | BF16 | K100AI | 1 | [HuggingFace](https://huggingface.co/Qwen/Qwen3-Reranker-0.6B) | | Qwen3-Reranker-4B | 4B | BF16 | K100AI | 1 | [HuggingFace](https://huggingface.co/Qwen/Qwen3-Reranker-4B) | | Qwen3-Reranker-8B | 8B | BF16 | K100AI | 1 | [HuggingFace](https://huggingface.co/Qwen/Qwen3-Reranker-8B) | ## 数据集 `暂无` ## 训练 `暂无` ## 推理 ### vLLM #### 单机推理 ##### offline ```bash export VLLM_USE_NN=0 export ALLREDUCE_STREAM_WITH_COMPUTE=1 ## model_name_or_path 模型地址参数 python infer_vllm.py --model_name_or_path /path/your_model_path/ ``` ##### serve 1. 启动服务 ```bash export VLLM_USE_NN=0 export ALLREDUCE_STREAM_WITH_COMPUTE=1 vllm serve Qwen/Qwen3-Reranker-0.6B \ --max-model-len 4096 \ --block-size 16 \ --trust-remote-code \ --enforce-eager \ --enable-prefix-caching \ --served-model-name Qwen3-reranker \ --task score \ --disable-log-requests \ --hf_overrides '{"architectures":["Qwen3ForSequenceClassification"],"classifier_from_token": ["no", "yes"],"is_original_qwen3_reranker": true}' ``` 2. 测试命令: ```bash curl http://127.0.0.1:8000/score \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "text_1": "ping", "text_2": "pong", "model": "Qwen3-reranker" }' ``` ## 效果展示
### 精度 `DCU与GPU精度一致,推理框架:vllm。` ## 源码仓库及问题反馈 - https://developer.sourcefind.cn/codes/modelzoo/qwen3-reranker ## 参考资料 - http://github.com/QwenLM/Qwen3-Embedding