2502_90647073/Reranker
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Qwen3-Reranker-0.6B

A model for fast deployment and verification of Qwen3-Reranker-0.6B on Ascend NPU environments. Supports text generation, embedding, reranking, and scoring. Fully adapted and precision-validated for Ascend NPU.

中文

Table of Contents

  • Model Description
  • Environment
  • Quick Start
  • Model Download
  • Deployment
  • Precision Evaluation
  • FAQ
  • References

Model Description

ItemContent
Model NameQwen3-Reranker-0.6B
SourceModelScope: Qwen/Qwen3-Reranker-0.6B
ArchitectureQwen3ForCausalLM
Parameters0.6B
Weight Size1.11 GB (model.safetensors)
Supported Precisionbfloat16, float32
Embedding Dimension1024
Max Sequence Length4096 tokens
Adaptation Status✅ Fully adapted — zero code changes

Key Features

  • Zero-code adaptation: Qwen3ForCausalLM natively supported in vLLM, fully compatible with vLLM-Ascend
  • Multi-mode inference: Text generation, embedding, reranking
  • Extremely lightweight: 0.6B parameters, only 1.14 GB VRAM
  • Ascend-native: All operators (GQA, RoPE, SwiGLU) accelerated via Ascend CANN

Environment

Hardware

ItemConfiguration
ServerAtlas 800 A2
NPUAscend 910B (64GB)
CPU Cores64
Memory512 GB

Software

SoftwareVersion
OSUbuntu 22.04.5 LTS / EulerOS 2.10
Python3.11.14
Ascend DriverCANN 8.5.1
torch2.6.0
torch_npu2.6.0
vLLM0.18.0
vLLM-Ascend0.18.0
transformers4.51.3

Quick Start

1. Install Dependencies

pip install vllm==0.18.0
pip install vllm-ascend==0.18.0
pip install transformers>=4.51.0 modelscope

2. Start Inference Server

Reranker Mode (Recommended)

python3 -m vllm.entrypoints.openai.api_server \
    --model /path/to/Qwen3-Reranker-0.6B \
    --runner pooling \
    --convert embed \
    --enforce-eager \
    --trust-remote-code \
    --max-model-len 4096 \
    --gpu-memory-utilization 0.3 \
    --port 8000

Text Generation Mode

python3 -m vllm.entrypoints.openai.api_server \
    --model /path/to/Qwen3-Reranker-0.6B \
    --enforce-eager \
    --trust-remote-code \
    --max-model-len 4096 \
    --gpu-memory-utilization 0.5 \
    --port 8000

3. API Calls

# Embedding
curl http://localhost:8000/v1/embeddings \
  -H "Content-Type: application/json" \
  -d '{"input": ["Your text here"]}'

# Rerank
curl http://localhost:8000/rerank \
  -H "Content-Type: application/json" \
  -d '{"query": "search query", "documents": ["doc1", "doc2"]}'

# Score
curl http://localhost:8000/score \
  -H "Content-Type: application/json" \
  -d '{"text_1": ["query"], "text_2": ["document"]}'

# Text generation
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "Hello"}], "max_tokens": 50}'

Precision Evaluation

Methodology

Using transformers framework on both CPU (baseline) and Ascend NPU (test) with identical random seed. Compare:

  • Last Hidden State (1024-dim per token)
  • Logits (vocab_size 151,669)

Metrics:

MetricDefinitionPass Threshold
Cosine SimilarityVector direction alignment>0.99
MAEMean Absolute Error—
RMSERoot Mean Square Error—
Mean Rel ErrorMean relative error percentage<1%
Max Rel ErrorMax relative error percentage—

Test Inputs

#Input Text
1What is the capital of France?
2The capital of France is Paris.
3Paris is a beautiful city.
4Explain the theory of relativity.
5Machine learning is a subset of artificial intelligence.
6The Earth orbits around the Sun.
7Quantization reduces model size and improves inference speed.
8The mitochondria is the powerhouse of the cell.

Hidden State Comparison

#Cosine SimMAERMSEMean Rel%Max Rel%
11.0000005.45e-067.51e-060.0076%5.92%
21.0000005.42e-067.51e-060.0027%1.34%
31.0000004.88e-066.64e-060.0041%1.20%
41.0000004.25e-066.51e-060.0014%0.15%
51.0000005.46e-067.57e-060.0014%0.09%
61.0000004.43e-068.22e-060.0027%1.43%
71.0000004.80e-066.90e-060.0015%0.14%
81.0000004.21e-066.61e-060.0022%0.60%
Average1.0000004.86e-067.18e-060.0029%1.36%

Logits Comparison

MetricValue
Avg Cosine Similarity1.000000
Avg MAE8.21e-06

Precision Conclusion

MetricMeasuredThresholdResult
Hidden State Cos Sim1.000000>0.99✅ Pass
Hidden State Mean Rel Error0.0029%<1%✅ Pass
Logits Cos Sim1.000000>0.99✅ Pass

✅ Ascend NPU outputs align perfectly with CPU baseline. Cosine similarity 1.000000, mean relative error 0.0029% — far below the 1% threshold. Ready for production deployment.

References

  • ModelScope: Qwen3-Reranker-0.6B
  • Qwen3-Embedding GitHub
  • vLLM-Ascend