vllm-ascend/recipes
~/browse/Qwen

Qwen3-Reranker

Qwen3 Reranker series for text ranking (0.6B / 4B / 8B). Built on Qwen3 dense backbones and served via vLLM-Ascend pooling runner with the /v1/rerank API.

Dense0.6B41K ctxrerankervLLM 0.9.2rc1Difficulty: beginnerembedding

Single-node pooling serve on Atlas 800 A2/A3 and Atlas 300I DUO

Added: 2026-10-15·Updated: 2026-10-15·[ edit ]

Preparation

The Qwen3 Reranker model series is designed for text ranking tasks. Building upon the dense foundational models of the Qwen3 series, it provides reranking models in 0.6B, 4B, and 8B sizes. This recipe shows how to serve the official original checkpoints with vLLM Ascend using the pooling runner and the OpenAI-compatible /v1/rerank API. Requires vLLM Ascend 0.9.2rc1 or newer.

Deployment Guide

Select NPU type and deployment options to view the corresponding deployment instructions.

Verification

Once your server is started, verify with:

import requests

url = "http://127.0.0.1:8000/v1/rerank"

# Please use the query_template and document_template to format the query and
# document for better reranker results.

prefix = '<|im_start|>system\nJudge whether the Document meets the requirements based on the Query and the Instruct provided. Note that the answer can only be "yes" or "no".<|im_end|>\n<|im_start|>user\n'
suffix = "<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n"

query_template = "{prefix}<Instruct>: {instruction}\n<Query>: {query}\n"
document_template = "<Document>: {doc}{suffix}"

instruction = (
    "Given a web search query, retrieve relevant passages that answer the query"
)

query = "What is the capital of China?"

documents = [
    "The capital of China is Beijing.",
    "Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun.",
]

documents = [
    document_template.format(doc=doc, suffix=suffix) for doc in documents
]

response = requests.post(
    url,
    json={
        "query": query_template.format(
            prefix=prefix, instruction=instruction, query=query
        ),
        "documents": documents,
    },
).json()

print(response)

Expected result: HTTP 200 with a JSON body containing relevance_score. The first document (Beijing) should score much higher than the second.

For more usage examples, see the vLLM pooling/score examples.

More Info

Accuracy

Accuracy

Using MTEB

1. Refer to MTEB for details.
2. Run:

import os

from mteb.models.vllm_wrapper import VllmCrossEncoderWrapper

if __name__ == "__main__":
    import mteb

    data_path = "/home/data/mteb_data"
    os.environ["HF_DATASETS_CACHE"] = data_path
    os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"

    model = VllmCrossEncoderWrapper(
        "/root/.cache/Qwen3-Reranker-0.6B",
        revision="norm",
        dtype="float16",
        enforce_eager=True,
        max_model_len=10240,
        hf_overrides={
            "architectures": ["Qwen3ForSequenceClassification"],
            "classifier_from_token": ["no", "yes"],
            "is_original_qwen3_reranker": True,
        },
    )

    cache = mteb.ResultCache("/home/data/mteb_data")
    tasks = mteb.get_tasks(tasks=["MultiLongDocReranking"])
    results = mteb.evaluate(
        model, tasks=tasks, cache=cache, overwrite_strategy="always"
    )
    print(results)

Benchmark

Using vLLM Benchmark

Example for Qwen3-Reranker-0.6B (refer to the vLLM benchmark CLI):

vllm bench serve \
    --model Qwen/Qwen3-Reranker-0.6B \
    --backend vllm-rerank \
    --port 8000 \
    --dataset-name random-rerank \
    --endpoint /v1/rerank \
    --random-input 200 \
    --save-result \
    --result-dir ./