A high-performance open-source cross-encoder model for reranking Arabic long texts, fine-tuned from Alibaba-NLP/gte-multilingual-reranker-base with state-of-the-art results on Arabic reranking benchmarks.
Overview
Mizan-Rerank-v2 is a cross-encoder reranking model based on
Alibaba-NLP/gte-multilingual-reranker-base
, specifically fine-tuned for Arabic text reranking. It excels at reranking long documents (up to 8192 tokens) and outperforms both its base model and larger competitors on Arabic reranking benchmarks.
Key Features
Long Document Support
: Handles up to 8192 tokens using RoPE position embeddings with NTK scaling
Superior Arabic Performance
: Outperforms BAAI/bge-reranker-v2-m3 (568M) despite being nearly half the size
Arabic Language Optimization
: Fine-tuned on 1.2M+ Arabic query-document pairs from diverse sources
Position Embeddings:
RoPE with NTK scaling (factor 8.0)
Number of Output Labels:
1
Language:
Arabic (ar), English (en)
License:
Apache 2.0
Usage
Using Sentence Transformers
pip install -U sentence-transformers
from sentence_transformers import CrossEncoder
# Load model
model = CrossEncoder("ALJIACHI/Mizan-Rerank-v2", max_length=8192, trust_remote_code=True)
# Score query-document pairs
pairs = [
["ما هو تفسير الآية وجعلنا من الماء كل شيء حي",
"تعني الآية أن الماء هو عنصر أساسي في حياة جميع الكائنات الحية، وهو ضروري لاستمرار الحياة."],
["ما هو تفسير الآية وجعلنا من الماء كل شيء حي",
"تم اكتشاف كواكب خارج المجموعة الشمسية تحتوي على مياه متجمدة."],
["ما هو تفسير الآية وجعلنا من الماء كل شيء حي",
"تحدث القرآن الكريم عن البرق والرعد في عدة مواضع مختلفة."],
]
scores = model.predict(pairs)
print(scores)
# High score for the relevant passage, low scores for irrelevant ones# Or rank documents for a query
ranks = model.rank(
"ما هو تفسير الآية وجعلنا من الماء كل شيء حي",
[
"تعني الآية أن الماء هو عنصر أساسي في حياة جميع الكائنات الحية، وهو ضروري لاستمرار الحياة.",
"تم اكتشاف كواكب خارج المجموعة الشمسية تحتوي على مياه متجمدة.",
"تحدث القرآن الكريم عن البرق والرعد في عدة مواضع مختلفة.",
]
)
print(ranks)
# [{'corpus_id': 0, 'score': ...}, {'corpus_id': 1, 'score': ...}, ...]
Using Transformers Directly
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model = AutoModelForSequenceClassification.from_pretrained(
"ALJIACHI/Mizan-Rerank-v2",
trust_remote_code=True,
torch_dtype=torch.float16,
)
tokenizer = AutoTokenizer.from_pretrained("ALJIACHI/Mizan-Rerank-v2")
defget_relevance_score(query, passage):
inputs = tokenizer(query, passage, return_tensors="pt", padding=True, truncation=True, max_length=8192)
with torch.no_grad():
outputs = model(**inputs)
return torch.sigmoid(outputs.logits).item()
query = "ما هي فوائد فيتامين د؟"
passages = [
"يساعد فيتامين د في تعزيز صحة العظام وتقوية الجهاز المناعي، كما يلعب دوراً مهماً في امتصاص الكالسيوم.",
"يستخدم فيتامين د في بعض الصناعات الغذائية كمادة حافظة.",
"أطلقت وزارة الزراعة حملة وطنية لزيادة الوعي بأهمية الزراعة العضوية.",
]
scores = [(p, get_relevance_score(query, p)) for p in passages]
reranked = sorted(scores, key=lambda x: x[1], reverse=True)
for passage, score in reranked:
print(f"Score: {score:.4f} | {passage[:80]}...")
Training Details
Training Data
Trained on
1,199,634 query-document pairs
from diverse Arabic sources
Training Configuration
Parameter
Value
Base Model
Alibaba-NLP/gte-multilingual-reranker-base
Max Sequence Length
8192
Batch Size
2
Gradient Accumulation Steps
16
Effective Batch Size
32
Learning Rate
5e-7
LR Scheduler
Cosine
Warmup Ratio
0.1
Precision
FP16
Gradient Checkpointing
Enabled
Loss Function
BinaryCrossEntropyLoss (pos_weight=1.24)
Applications
Arabic search engines and information retrieval systems
RAG (Retrieval-Augmented Generation) pipelines
Islamic text search and jurisprudence Q&A
Digital library and archive search
Long-document Arabic content analysis
E-learning platforms with Arabic content
Framework Versions
Python: 3.10.14
Sentence Transformers: 5.4.1
Transformers: 4.55.4
PyTorch: 2.8.0+cu126
Accelerate: 1.10.0
Datasets: 3.5.0
Tokenizers: 0.21.0
Citation
@software{Mizan_Rerank_v2_2026,
author = {Ali Aljiachi},
title = {Mizan-Rerank-v2: Arabic Long-Context Text Reranking Model},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/ALJIACHI/Mizan-Rerank-v2}
}
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
Mizan-Rerank-V2 huggingface.co is an AI model on huggingface.co that provides Mizan-Rerank-V2's model effect (), which can be used instantly with this ALJIACHI Mizan-Rerank-V2 model. huggingface.co supports a free trial of the Mizan-Rerank-V2 model, and also provides paid use of the Mizan-Rerank-V2. Support call Mizan-Rerank-V2 model through api, including Node.js, Python, http.
Mizan-Rerank-V2 huggingface.co is an online trial and call api platform, which integrates Mizan-Rerank-V2's modeling effects, including api services, and provides a free online trial of Mizan-Rerank-V2, you can try Mizan-Rerank-V2 online for free by clicking the link below.
ALJIACHI Mizan-Rerank-V2 online free url in huggingface.co:
Mizan-Rerank-V2 is an open source model from GitHub that offers a free installation service, and any user can find Mizan-Rerank-V2 on GitHub to install. At the same time, huggingface.co provides the effect of Mizan-Rerank-V2 install, users can directly use Mizan-Rerank-V2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.