A reranking model rescores retrieved documents and promotes the most relevant results, improving search precision when initial retrieval prioritizes speed over accuracy.
Prerequisites
First obtain and configure an API key and set the API key as an environment variable. If you need to use an SDK, install the SDK.
Rerank documents
Pass a query and a list of candidate documents to the API. The model returns the documents sorted by relevance.
Text reranking (qwen3-rerank)
- OpenAI compatible
- DashScope
Multimodal reranking (qwen3-vl-rerank)
The qwen3-vl-rerank model reranks text, images, and videos. The query can be text or an image, and documents can contain text, images, and videos.
Core features
Reranking with instructions (instruct)
The instruct parameter can guide the model to use different ranking strategies. Write instructions in English.
-
Question answering retrieval (default):
"Given a web search query, retrieve relevant passages that answer the query."Focuses on finding answers. For "How to prevent a cold?", "Washing hands frequently can prevent colds" scores higher than "A cold is a common illness," which is topically relevant but not an answer. -
Semantic similarity:
"Retrieve semantically similar text."Focuses on semantic equivalence, unaffected by wording. For example, "How do I change my password?" matches "What if I forgot my password?" (FAQ scenarios).
Return the top N results (top_n)
Use top_n to return only the highest-ranked documents. If top_n is not set, all documents are returned sorted by relevance. If top_n exceeds the input document count, all documents are returned.
Model overview
Model | Max documents | Max tokens per document | Max tokens per request | Supported languages | Use cases |
|---|---|---|---|---|---|
qwen3.7-text-rerank | 500 | 30,000 | 120,000 (recommended) | 201 major languages and dialects, including Chinese, English, Spanish, and French | Semantic text search, RAG applications |
qwen3-vl-rerank | Text: 100 Image: 40 Video: 4 | 8,000 | 120,000 | 33 languages, including Chinese, English, Japanese, and Korean | Multimodal search result reranking (text, image, video) |
qwen3-rerank | 500 | 4,000 | 120,000 | 100+ languages, including Chinese, English, Spanish, and French | Semantic text search, RAG applications |
gte-rerank-v2 | 500 | 4,000 | 30,000 | 50+ languages, including Chinese, English, Japanese, Korean, and Thai | Semantic text search, RAG applications |
- Max tokens per document: Max tokens for a single query or document. If a query or document exceeds this limit, the API returns an HTTP 400 error and does not truncate the input.
- Max documents: Maximum documents per request. For qwen3-vl-rerank, this limit varies by document type (text, image, video, or mixed).
- Max tokens per request: Calculated as
Query Tokens × Number of Documents + Total Document Tokens.