The Qwen3 Embedding model series is the latest proprietary model of the Qwen family, specifically designed for text embedding and ranking tasks. Building upon the dense foundational models of the Qwen3 series, it provides a comprehensive range of text embeddings and reranking models in various sizes (0.6B, 4B, and 8B). This series inherits the exceptional multilingual capabilities, long-text understanding, and reasoning skills of its foundational model. The Qwen3 Embedding series represents significant advancements in multiple text embedding and ranking tasks, including text retrieval, code retrieval, text classification, text clustering, and bitext mining.
Exceptional Versatility: The embedding model has achieved state-of-the-art performance across a wide range of downstream application evaluations. The 8B size embedding model ranks No.1 in the MTEB multilingual leaderboard (as of June 5, 2025, score 70.58), while the reranking model excels in various text retrieval scenarios.
Comprehensive Flexibility: The Qwen3 Embedding series offers a full spectrum of sizes (from 0.6B to 8B) for both embedding and reranking models, catering to diverse use cases that prioritize efficiency and effectiveness. Developers can seamlessly combine these two modules. Additionally, the embedding model allows for flexible vector definitions across all dimensions, and both embedding and reranking models support user-defined instructions to enhance performance for specific tasks, languages, or scenarios.
Multilingual Capability: The Qwen3 Embedding series offer support for over 100 languages, thanks to the multilingual capabilites of Qwen3 models. This includes various programming languages, and provides robust multilingual, cross-lingual, and code retrieval capabilities.
Model Overview
Qwen3-Reranker-0.6B has the following features:
Model Type: Text Reranking
Supported Languages: 100+ Languages
Number of Paramaters: 0.6B
Context Length: 32k
For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our blog, GitHub.
MRL Support indicates whether the embedding model supports custom dimensions for the final embedding.
Instruction Aware notes whether the embedding or reranking model supports customizing the input instruction according to different tasks.
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.
Usage
Using Sentence Transformers
Install Sentence Transformers:
pip install sentence_transformers
python
1from sentence_transformers import CrossEncoder
23model = CrossEncoder("Qwen/Qwen3-Reranker-0.6B")45query ="What is the capital of China?"6documents =[7"The capital of China is Beijing.",8"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.",9]1011pairs =[(query, doc)for doc in documents]12scores = model.predict(pairs)13print(scores)14# [ 7.625 -11.375]1516rankings = model.rank(query, documents)17print(rankings)18# [{'corpus_id': 0, 'score': 7.625}, {'corpus_id': 1, 'score': -11.375}]
By default, scores are raw logit differences. To get 0-1 probability scores, pass a Sigmoid activation function:
scores = model.predict([(query, doc) for doc in documents], activation_fn=torch.nn.Sigmoid())
The model uses a default prompt "query" which injects the instruction "Given a web search query, retrieve relevant passages that answer the query" into the chat template. You can provide a custom instruction via the prompts parameter:
python
1model = CrossEncoder(2"Qwen/Qwen3-Reranker-0.6B",3 prompts={"classification":"Classify whether the document matches the query topic"},4 default_prompt_name="classification",5)
Using Transformers
With Transformers versions earlier than 4.51.0, you may encounter the following error:
KeyError: 'qwen3'
python
1# Requires transformers>=4.51.02import torch
3from transformers import AutoModel, AutoTokenizer, AutoModelForCausalLM
45defformat_instruction(instruction, query, doc):6if instruction isNone:7 instruction ='Given a web search query, retrieve relevant passages that answer the query'8 output ="<Instruct>: {instruction}\n<Query>: {query}\n<Document>: {doc}".format(instruction=instruction,query=query, doc=doc)9return output
1011defprocess_inputs(pairs):12 inputs = tokenizer(13 pairs, padding=False, truncation='longest_first',14 return_attention_mask=False, max_length=max_length -len(prefix_tokens)-len(suffix_tokens)15)16for i, ele inenumerate(inputs['input_ids']):17 inputs['input_ids'][i]= prefix_tokens + ele + suffix_tokens
18 inputs = tokenizer.pad(inputs, padding=True, return_tensors="pt", max_length=max_length)19for key in inputs:20 inputs[key]= inputs[key].to(model.device)21return inputs
2223@torch.no_grad()24defcompute_logits(inputs,**kwargs):25 batch_scores = model(**inputs).logits[:,-1,:]26 true_vector = batch_scores[:, token_true_id]27 false_vector = batch_scores[:, token_false_id]28 batch_scores = torch.stack([false_vector, true_vector], dim=1)29 batch_scores = torch.nn.functional.log_softmax(batch_scores, dim=1)30 scores = batch_scores[:,1].exp().tolist()31return scores
3233tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-Reranker-0.6B", padding_side='left')34model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-Reranker-0.6B").eval()35# We recommend enabling flash_attention_2 for better acceleration and memory saving.36# model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-Reranker-0.6B", torch_dtype=torch.float16, attn_implementation="flash_attention_2").cuda().eval()37token_false_id = tokenizer.convert_tokens_to_ids("no")38token_true_id = tokenizer.convert_tokens_to_ids("yes")39max_length =81924041prefix ="<|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"42suffix ="<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n"43prefix_tokens = tokenizer.encode(prefix, add_special_tokens=False)44suffix_tokens = tokenizer.encode(suffix, add_special_tokens=False)4546task ='Given a web search query, retrieve relevant passages that answer the query'4748queries =["What is the capital of China?",49"Explain gravity",50]5152documents =[53"The capital of China is Beijing.",54"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.",55]5657pairs =[format_instruction(task, query, doc)for query, doc inzip(queries, documents)]5859# Tokenize the input texts60inputs = process_inputs(pairs)61scores = compute_logits(inputs)6263print("scores: ", scores)
vLLM Usage
python
1# Requires vllm>=0.8.52import logging
3from typing import Dict, Optional, List
45import json
6import logging
78import torch
910from transformers import AutoTokenizer, is_torch_npu_available
11from vllm import LLM, SamplingParams
12from vllm.distributed.parallel_state import destroy_model_parallel
13import gc
14import math
15from vllm.inputs.data import TokensPrompt
16171819defformat_instruction(instruction, query, doc):20 text =[21{"role":"system","content":"Judge whether the Document meets the requirements based on the Query and the Instruct provided. Note that the answer can only be \"yes\" or \"no\"."},22{"role":"user","content":f"<Instruct>: {instruction}\n\n<Query>: {query}\n\n<Document>: {doc}"}23]24return text
2526defprocess_inputs(pairs, instruction, max_length, suffix_tokens):27 messages =[format_instruction(instruction, query, doc)for query, doc in pairs]28 messages = tokenizer.apply_chat_template(29 messages, tokenize=True, add_generation_prompt=False, enable_thinking=False30)31 messages =[ele[:max_length]+ suffix_tokens for ele in messages]32 messages =[TokensPrompt(prompt_token_ids=ele)for ele in messages]33return messages
3435defcompute_logits(model, messages, sampling_params, true_token, false_token):36 outputs = model.generate(messages, sampling_params, use_tqdm=False)37 scores =[]38for i inrange(len(outputs)):39 final_logits = outputs[i].outputs[0].logprobs[-1]40 token_count =len(outputs[i].outputs[0].token_ids)41if true_token notin final_logits:42 true_logit =-1043else:44 true_logit = final_logits[true_token].logprob
45if false_token notin final_logits:46 false_logit =-1047else:48 false_logit = final_logits[false_token].logprob
49 true_score = math.exp(true_logit)50 false_score = math.exp(false_logit)51 score = true_score /(true_score + false_score)52 scores.append(score)53return scores
5455number_of_gpu = torch.cuda.device_count()56tokenizer = AutoTokenizer.from_pretrained('Qwen/Qwen3-Reranker-0.6B')57model = LLM(model='Qwen/Qwen3-Reranker-0.6B', tensor_parallel_size=number_of_gpu, max_model_len=10000, enable_prefix_caching=True, gpu_memory_utilization=0.8)58tokenizer.padding_side ="left"59tokenizer.pad_token = tokenizer.eos_token
60suffix ="<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n"61max_length=819262suffix_tokens = tokenizer.encode(suffix, add_special_tokens=False)63true_token = tokenizer("yes", add_special_tokens=False).input_ids[0]64false_token = tokenizer("no", add_special_tokens=False).input_ids[0]65sampling_params = SamplingParams(temperature=0,66 max_tokens=1,67 logprobs=20,68 allowed_token_ids=[true_token, false_token],69)707172task ='Given a web search query, retrieve relevant passages that answer the query'73queries =["What is the capital of China?",74"Explain gravity",75]76documents =[77"The capital of China is Beijing.",78"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.",79]8081pairs =list(zip(queries, documents))82inputs = process_inputs(pairs, task, max_length-len(suffix_tokens), suffix_tokens)83scores = compute_logits(model, inputs, sampling_params, true_token, false_token)84print('scores', scores)8586destroy_model_parallel()
📌 Tip: We recommend that developers customize the instruct according to their specific scenarios, tasks, and languages. Our tests have shown that in most retrieval scenarios, not using an instruct on the query side can lead to a drop in retrieval performance by approximately 1% to 5%.
Evaluation
Model
Param
MTEB-R
CMTEB-R
MMTEB-R
MLDR
MTEB-Code
FollowIR
Qwen3-Embedding-0.6B
0.6B
61.82
71.02
64.64
50.26
75.41
5.09
Jina-multilingual-reranker-v2-base
0.3B
58.22
63.37
63.73
39.66
58.98
-0.68
gte-multilingual-reranker-base
0.3B
59.51
74.08
59.44
66.33
54.18
-1.64
BGE-reranker-v2-m3
0.6B
57.03
72.16
58.36
59.51
41.38
-0.01
Qwen3-Reranker-0.6B
0.6B
65.80
71.31
66.36
67.28
73.42
5.41
Qwen3-Reranker-4B
4B
69.76
75.94
72.74
69.97
81.20
14.84
Qwen3-Reranker-8B
8B
69.02
77.45
72.94
70.19
81.22
8.05
Note:
Evaluation results for reranking models. We use the retrieval subsets of MTEB(eng, v2), MTEB(cmn, v1), MMTEB and MTEB (Code), which are MTEB-R, CMTEB-R, MMTEB-R and MTEB-Code.
All scores are our runs based on the top-100 candidates retrieved by dense embedding model Qwen3-Embedding-0.6B.
Citation
If you find our work helpful, feel free to give us a cite.
@article{qwen3embedding,
title={Qwen3 Embedding: Advancing Text Embedding and Reranking Through Foundation Models},
author={Zhang, Yanzhao and Li, Mingxin and Long, Dingkun and Zhang, Xin and Lin, Huan and Yang, Baosong and Xie, Pengjun and Yang, An and Liu, Dayiheng and Lin, Junyang and Huang, Fei and Zhou, Jingren},
journal={arXiv preprint arXiv:2506.05176},
year={2025}
}