Downloads · 30 days
1K
5% of all-time downloads
ytu-ce-cosmos/modernbert-tr-reranker
modernbert-tr-reranker is a text ranking model from ytu-ce-cosmos. Use it for the text ranking task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
<p align="center" <img src="assets/logo.webp" width="20%" alt="ModernBERT Reranker" / </p <h1 align="center"ModernBERT-TR Reranker</h1
Downloads · 30 days
1K
5% of all-time downloads
All-time downloads
20.5K
Public
Parameters
149M
1.3 GB on disk
Likes
5
Public
Click a slice to open those files.
.onnx748 MB · 56%
From the Hugging Face model README
A 150M-parameter Turkish cross-encoder reranker to score (query, document) relevance.
ytu-ce-cosmos/modernbert-tr-base.Qwen/Qwen3-Reranker-8B.Reranking the top-100 of a first-stage retriever (ytu-ce-cosmos/modernbert-tr-embed) at max_seq=512. The uplift (Δ) is the reranker's contribution.
| Task | First-stage NDCG@10 | + Reranker | Δ |
|---|---|---|---|
| ArguAnaTR | 37.01 | 54.75 | +17.74 |
| SquadTRRetrieval | 75.94 | 90.11 | +14.17 |
| SciFactTR | 77.07 | 86.34 | +9.27 |
| TQuadRetrieval | 87.48 | 94.00 | +6.52 |
| CQADupstackGamingRetrievalTR | 56.44 | 61.10 | +4.66 |
| XQuADRetrieval | 95.03 | 97.86 | +2.83 |
| Mean Δ | +9.20 |
Question answering and counter argument distillation of Qwen3-Reranker-8B relevance scores into the 150M cross-encoder over Turkish question answering / information retrieval data using listwise KL.
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
tok = AutoTokenizer.from_pretrained("ytu-ce-cosmos/modernbert-tr-reranker")
model = AutoModelForSequenceClassification.from_pretrained("ytu-ce-cosmos/modernbert-tr-reranker").eval()
query = "Türkiye'nin başkenti neresidir?"
docs = ["Ankara, Türkiye'nin başkentidir.", "İstanbul en kalabalık şehirdir."]
enc = tok([query] * len(docs), docs, padding=True, truncation="longest_first",
max_length=8192, return_tensors="pt")
with torch.no_grad():
scores = model(**enc).logits.squeeze(-1)
ranking = sorted(zip(docs, scores.tolist()), key=lambda x: x[1], reverse=True)
from sentence_transformers import CrossEncoder
model = CrossEncoder("ytu-ce-cosmos/modernbert-tr-reranker")
scores = model.predict([(query, d) for d in docs])
The onnx/ folder has the full graph, the output is the relevance logit:
import onnxruntime, numpy as np
sess = onnxruntime.InferenceSession("onnx/model.onnx")
feed = {k: v.numpy() for k, v in enc.items() if k in {i.name for i in sess.get_inputs()}}
logits = sess.run(None, feed)[0].squeeze(-1)
text-embeddings-router --model-id ytu-ce-cosmos/modernbert-tr-reranker --dtype float16
# POST /rerank {"query": "soru", "texts": ["aday 1", "aday 2"]}
We used Turkish datasets msmarco-tr, squad-tr, fiqa-tr, nfcorpus-tr, quora-tr, scifact-tr for distillation by Qwen3-Reranker-8B, and Turkish counter-argument pairs from ArguAna machine-translated with TranslateGemma-27B. All training data was text-hash chceked against every MTEB(Turkish) test split.
apache-2.0.