# Qwen3-Embedding

> Open multilingual text embedding and reranking models from the Qwen3 family

- Category: Retrieval & Knowledge (RAG) / Embedding Models & Inference
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/QwenLM/Qwen3-Embedding
- Website: https://qwenlm.github.io/blog/qwen3-embedding/
- Canonical page: https://ai-tldr.dev/tools/qwen3-embedding/

## In short

Qwen3-Embedding is a series of open text embedding and reranking models from Alibaba's Qwen team, built on the Qwen3 base models. It comes in three sizes (0.6B, 4B, and 8B) for both embedding and reranking, so you can trade off accuracy against speed and memory. It sits in the Embedding Models & Inference category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed Apache-2.0.

## Overview

Qwen3-Embedding is a series of open text embedding and reranking models from Alibaba's Qwen team, built on the Qwen3 base models. It comes in three sizes (0.6B, 4B, and 8B) for both embedding and reranking, so you can trade off accuracy against speed and memory.

The embedding models turn text into vectors you can use for search, clustering, classification, and retrieval-augmented generation. The reranking models take a query and a list of candidate passages and score how relevant each one is, which helps you reorder search results before sending them to an LLM. The two model types are meant to be used together.

It supports over 100 languages plus code, handles sequences up to 32K tokens, and lets you customize the task instruction per query. Embedding models also support Matryoshka Representation Learning (MRL), so you can shorten the output vector to fit your storage and latency budget.

## What it does

- Embedding and reranking models in 0.6B, 4B, and 8B sizes for both tasks
- Support for over 100 languages, including cross-lingual and code retrieval
- 32K token sequence length for embedding long documents
- Instruction-aware: each query can include a task description to improve results
- MRL support lets you truncate embeddings to a custom dimension
- Loads through Hugging Face Transformers or sentence-transformers

## Getting started

The easiest way to start is the 0.6B embedding model through sentence-transformers. You need transformers 4.51.0 or newer.

1. Install the libraries

   Install sentence-transformers, which pulls in a compatible version of transformers and torch.

```bash
pip install "transformers>=4.51.0" "sentence-transformers>=2.7.0"
```

2. Embed queries and documents

   Load the model, encode your queries with the built-in "query" prompt, encode your documents, and compute cosine similarity.

```python
from sentence_transformers import SentenceTransformer

# Load the model
model = SentenceTransformer("Qwen/Qwen3-Embedding-0.6B")

# The queries and documents to embed
queries = [
    "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. Queries benefit from the "query" prompt.
query_embeddings = model.encode(queries, prompt_name="query")
document_embeddings = model.encode(documents)

# Compute the (cosine) similarity between query and document embeddings
similarity = model.similarity(query_embeddings, document_embeddings)
print(similarity)
```

3. Use the right instruction per task

   For embedding models, writing a short, task-specific instruction in English for your queries typically improves results by 1-5%. Documents do not need an instruction.

## When to use it

- Build the retrieval step of a RAG pipeline that searches your documents before calling an LLM
- Power semantic or cross-lingual search across content in 100+ languages
- Rerank candidate passages with the Qwen3-Reranker models to improve search relevance
- Cluster or classify large text collections using the generated vectors
