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.
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.
1import torch
2from transformers import AutoModelForSequenceClassification, AutoTokenizer
3
4tok = AutoTokenizer.from_pretrained("ytu-ce-cosmos/modernbert-tr-reranker")
5model = AutoModelForSequenceClassification.from_pretrained("ytu-ce-cosmos/modernbert-tr-reranker").eval()
6
7query = "Türkiye'nin başkenti neresidir?"
8docs = ["Ankara, Türkiye'nin başkentidir.", "İstanbul en kalabalık şehirdir."]
9enc = tok([query] * len(docs), docs, padding=True, truncation="longest_first",
10 max_length=8192, return_tensors="pt")
11with torch.no_grad():
12 scores = model(**enc).logits.squeeze(-1)
13ranking = sorted(zip(docs, scores.tolist()), key=lambda x: x[1], reverse=True)
1from sentence_transformers import CrossEncoder
2model = CrossEncoder("ytu-ce-cosmos/modernbert-tr-reranker")
3scores = model.predict([(query, d) for d in docs])
1import onnxruntime, numpy as np
2sess = onnxruntime.InferenceSession("onnx/model.onnx")
3feed = {k: v.numpy() for k, v in enc.items() if k in {i.name for i in sess.get_inputs()}}
4logits = sess.run(None, feed)[0].squeeze(-1)
1text-embeddings-router --model-id ytu-ce-cosmos/modernbert-tr-reranker --dtype float16
2# 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.