Qwen/Qwen3-Embedding-8B
- License
- apache-2.0
- Size
- not mirrored yet
No official torrent yet — requesting it tells the flock what to host next. You cannot seed a catalog-only page.
Cataloged from Qwen/Qwen3-Embedding-8B
All models by Qwen →No official torrent yet — requesting it tells the flock what to host next. You cannot seed a catalog-only page.
Cataloged from Qwen/Qwen3-Embedding-8B
All models by Qwen →

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.
Qwen3-Embedding-8B has the following features:
For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our blog, GitHub.
Note:
MRL Supportindicates whether the embedding model supports custom dimensions for the final embedding.Instruction Awarenotes 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.
With Transformers versions earlier than 4.51.0, you may encounter the following error:
📌 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%.
You can either run / deploy TEI on NVIDIA GPUs as:
Or on CPU devices as:
And then, generate the embeddings sending a HTTP POST request as:
Note: For compared models, the scores are retrieved from MTEB online leaderboard on May 24th, 2025.
If you find our work helpful, feel free to give us a cite.
KeyError: 'qwen3'# Requires transformers>=4.51.0# Requires sentence-transformers>=2.7.0
from sentence_transformers import SentenceTransformer
# Load the modelmodel = SentenceTransformer("Qwen/Qwen3-Embedding-8B")
# We recommend enabling flash_attention_2 for better acceleration and memory saving,# together with setting `padding_side` to "left":# model = SentenceTransformer(# "Qwen/Qwen3-Embedding-8B",# model_kwargs={"attn_implementation": "flash_attention_2", "device_map": "auto"},# tokenizer_kwargs={"padding_side": "left"},# )
# The queries and documents to embedqueries = [ "What is the capital of China?", "Explain gravity",]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.",]
# Encode the queries and documents. Note that queries benefit from using a prompt# Here we use the prompt called "query" stored under `model.prompts`, but you can# also pass your own prompt via the `prompt` argumentquery_embeddings = model.encode(queries, prompt_name="query")document_embeddings = model.encode(documents)
# Compute the (cosine) similarity between the query and document embeddingssimilarity = model.similarity(query_embeddings, document_embeddings)print(similarity)# tensor([[0.7493, 0.0751],# [0.0880, 0.6318]])# Requires transformers>=4.51.0
import torchimport torch.nn.functional as F
from torch import Tensorfrom transformers import AutoTokenizer, AutoModel
def last_token_pool(last_hidden_states: Tensor, attention_mask: Tensor) -> Tensor: left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0]) if left_padding: return last_hidden_states[:, -1] else: sequence_lengths = attention_mask.sum(dim=1) - 1 batch_size = last_hidden_states.shape[0] return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]
def get_detailed_instruct(task_description: str, query: str) -> str: return f'Instruct: {task_description}\nQuery:{query}'
# Each query must come with a one-sentence instruction that describes the tasktask = 'Given a web search query, retrieve relevant passages that answer the query'
queries = [ get_detailed_instruct(task, 'What is the capital of China?'), get_detailed_instruct(task, 'Explain gravity')]# No need to add instruction for retrieval documentsdocuments = [ "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."]input_texts = queries + documents
tokenizer = AutoTokenizer.from_pretrained('Qwen/Qwen3-Embedding-8B', padding_side='left')model = AutoModel.from_pretrained('Qwen/Qwen3-Embedding-8B')
# We recommend enabling flash_attention_2 for better acceleration and memory saving.# model = AutoModel.from_pretrained('Qwen/Qwen3-Embedding-8B', attn_implementation="flash_attention_2", torch_dtype=torch.float16).cuda()
max_length = 8192
# Tokenize the input textsbatch_dict = tokenizer( input_texts, padding=True, truncation=True, max_length=max_length, return_tensors="pt",)batch_dict.to(model.device)outputs = model(**batch_dict)embeddings = last_token_pool(outputs.last_hidden_state, batch_dict['attention_mask'])
# normalize embeddingsembeddings = F.normalize(embeddings, p=2, dim=1)scores = (embeddings[:2] @ embeddings[2:].T)print(scores.tolist())# [[0.7493016123771667, 0.0750647559762001], [0.08795969933271408, 0.6318399906158447]]# Requires vllm>=0.8.5import torchimport vllmfrom vllm import LLMdef get_detailed_instruct(task_description: str, query: str) -> str: return f'Instruct: {task_description}\nQuery:{query}'# Each query must come with a one-sentence instruction that describes the tasktask = 'Given a web search query, retrieve relevant passages that answer the query'queries = [ get_detailed_instruct(task, 'What is the capital of China?'), get_detailed_instruct(task, 'Explain gravity')]# No need to add instruction for retrieval documentsdocuments = [ "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."]input_texts = queries + documentsmodel = LLM(model="Qwen/Qwen3-Embedding-8B", task="embed")outputs = model.embed(input_texts)embeddings = torch.tensor([o.outputs.embedding for o in outputs])scores = (embeddings[:2] @ embeddings[2:].T)print(scores.tolist())# [[0.7482624650001526, 0.07556197047233582], [0.08875375241041183, 0.6300010681152344]]docker run --gpus all -p 8080:80 -v hf_cache:/data --pull always ghcr.io/huggingface/text-embeddings-inference:1.7.2 --model-id Qwen/Qwen3-Embedding-8B --dtype float16docker run -p 8080:80 -v hf_cache:/data --pull always ghcr.io/huggingface/text-embeddings-inference:cpu-1.7.2 --model-id Qwen/Qwen3-Embedding-8B --dtype float16curl http://localhost:8080/embed \ -X POST \ -d '{"inputs": ["Instruct: Given a web search query, retrieve relevant passages that answer the query\nQuery: What is the capital of China?", "Instruct: Given a web search query, retrieve relevant passages that answer the query\nQuery: Explain gravity"]}' \ -H "Content-Type: application/json"@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}}