Instructions to use tomaarsen/Qwen3-Reranker-0.6B-seq-cls with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use tomaarsen/Qwen3-Reranker-0.6B-seq-cls with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("tomaarsen/Qwen3-Reranker-0.6B-seq-cls") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Transformers
How to use tomaarsen/Qwen3-Reranker-0.6B-seq-cls with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("tomaarsen/Qwen3-Reranker-0.6B-seq-cls") model = AutoModelForSequenceClassification.from_pretrained("tomaarsen/Qwen3-Reranker-0.6B-seq-cls", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Standard way for reranker prompt templates?
I see sentence-transformers has a way of having simple prefix prompts. Like "query" -> "query: ", which gets prepended before tokenization. I was wondering if there is such a standard way that is more general? Qwen reranker seems to have little complex prompt requirements.
<|im_start|>system
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".<|im_end|>
<|im_start|>user
<Instruct>: {instruct}
<Query>: {query}
<Document>{document}<|im_end|>
<|im_start|>assistant
<think>
</think>
Hello!
The big prompt is indeed very inconvenient/tricky. My hope is to update the CrossEncoder support in Sentence Transformers so that users 1) won't have to use the template manually and 2) users can use prompt and prompt_name to specify additional instructions, if the model use them. I'm not sure when I'll have time for that, as my focus right now is on Sparse embedding models.
- Tom Aarsen