ALJIACHI / Mizan-Embeddings-0.4B

huggingface.co
Total runs: 15
24-hour runs: 2
7-day runs: 5
30-day runs: 14
Model's Last Updated: October 08 2026
sentence-similarity

Introduction of Mizan-Embeddings-0.4B

Model Details of Mizan-Embeddings-0.4B

Mizan-Embeddings-0.4B

Mizan-Embeddings-0.4B is an Arabic text embedding model for semantic search and retrieval. It maps sentences, passages and long documents (up to 8,192 tokens ) to a 1024-dimensional vector space.

It is the larger member of the Mizan-Embeddings family (after Mizan-Embeddings-0.1B ): a 28-layer ModernBERT encoder that was first pre-trained from scratch on Arabic text with an Arabic tokenizer, then fine-tuned for retrieval in two contrastive stages.

Model Details
  • Model Type: Sentence Transformer (bi-encoder)
  • Architecture: ModernBERT-large (28 layers, hidden size 1024, 16 heads, alternating local 128-token / global attention, RoPE)
  • Parameters: 395M
  • Tokenizer: Arabic byte-level BPE, 50,280 tokens
  • Maximum Sequence Length: 8192 tokens
  • Output Dimensionality: 1024
  • Pooling: mean pooling
  • Similarity Function: cosine similarity
  • Prompts / instructions: none (queries and documents are encoded the same way)
  • Language: Arabic
  • License: apache-2.0
Full Model Architecture
SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'module_output_name': 'token_embeddings', 'architecture': 'ModernBertModel'})
  (1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'mean', 'include_prompt': True})
)
Usage
pip install -U sentence-transformers
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("ALJIACHI/Mizan-Embeddings-0.4B")

queries = ["ما هي فوائد شرب الماء للجسم؟"]
documents = [
    "يساعد شرب كميات كافية من الماء على تنظيم حرارة الجسم وتحسين الهضم والحفاظ على صحة الكلى.",
    "تحتوي الخضروات الورقية على نسبة عالية من الألياف والفيتامينات المفيدة للجسم.",
    "تعد القاهرة من أكبر المدن في القارة الأفريقية من حيث عدد السكان.",
]

query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# (1, 1024) (3, 1024)

similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.7207, 0.2488, 0.0833]])

For long documents keep the default max_seq_length of 8192; for short passages you can lower it ( model.max_seq_length = 512 ) to speed up encoding. Flash Attention 2 is recommended on GPU:

import torch
model = SentenceTransformer(
    "ALJIACHI/Mizan-Embeddings-0.4B",
    model_kwargs={"torch_dtype": torch.float16, "attn_implementation": "flash_attention_2"},
)
Evaluation

Mizan-Embeddings benchmark

Model Params Dim Islamic & Arabic Retrieval Open-Domain Retrieval Arabic MTEB (3 tasks) Average
Mizan-Embeddings-0.4B 395M 1024 0.726 0.493 0.851 0.690
BAAI/bge-m3 568M 1024 0.704 0.508 0.832 0.681
jinaai/jina-embeddings-v4 3.8B 2048 0.704 0.489 0.843 0.678
ALJIACHI/Mizan-Embeddings-0.1B 149M 768 0.702 0.490 0.809 0.667
google/embeddinggemma-300m 308M 768 0.674 0.471 0.840 0.662

All scores are on a 0-1 scale; Average is the unweighted mean of the three columns.

  • Islamic & Arabic Retrieval: mean nDCG@10 over three in-house Arabic retrieval sets: ranking candidate rulings for Islamic jurisprudence (fiqh) questions, retrieving them from the full pool of ~5.2k rulings, and Arabic open-domain question answering over ~4.6k passages. These sets were used for model selection during fine-tuning, so this column is slightly optimistic for the Mizan models.
  • Open-Domain Retrieval: mean nDCG@10 over three public Arabic test sets whose queries were never used for training or model selection: Qur'an question answering (IslamicEval 2025, 1,266 passages), native Arabic questions over Wikipedia (SadeemQuestionRetrieval, 23k passages), and long-document retrieval (MLDR Arabic test, 7.6k articles encoded at up to 8,192 tokens).
  • Arabic MTEB (3 tasks): mean of the official MTEB main scores on AJGT.v2 (classification, accuracy), STS17 ar-ar (semantic similarity, Spearman) and PublicHealthQA Arabic (retrieval, nDCG@10).
Arabic MTEB (×100)
Model AJGT.v2 STS17 (ar-ar) PublicHealthQA Mean
Mizan-Embeddings-0.4B 85.14 83.98 86.25 85.12
BAAI/bge-m3 84.11 80.76 84.64 83.17
jinaai/jina-embeddings-v4 82.39 83.28 87.14 84.27
ALJIACHI/Mizan-Embeddings-0.1B 82.32 81.86 78.56 80.91
google/embeddinggemma-300m 85.15 80.62 86.28 84.02

All models were run by us with the same code, at max_seq_length min(model limit, 8192) (embeddinggemma-300m: 2048), using each model's recommended query / document prompts.

Training

Training ran in three phases.

1. Arabic pre-training (masked language modelling)

Starting from ModernBERT-large with an Arabic tokenizer, the model was pre-trained on 20B tokens of Arabic web text: 18B tokens at 1,024-token sequences, then 2B tokens of long documents at 8,192 tokens to extend the context window.

2. Contrastive stage 1: general Arabic semantics
  • Data: 916k Arabic (anchor, positive, negative) triplets ( 97M tokens): natural language inference, paraphrase and question-passage pairs; pairs overlapping our in-house evaluation sets or the Arabic MTEB STS / NLI test sets were removed.
  • Objective: multiple-negatives ranking loss (InfoNCE) with in-batch negatives plus one hard negative per anchor, batch size 256 (GradCache), sequences up to 256 tokens.
  • Schedule: learning rate 2e-5, 5% linear warmup.
3. Contrastive stage 2: long-context retrieval
  • Data: 524k Arabic query-document pairs ( 0.67B tokens), each with 3 hard negatives mined with a dense retriever and filtered with a cross-encoder reranker to remove false negatives. Domains: Islamic jurisprudence questions and rulings, hadith, religious Q&A, encyclopedic question answering, general-domain QA and long-document retrieval (documents up to 8,192 tokens), plus a small share of NLI / paraphrase pairs.
  • Objective: multiple-negatives ranking loss with GradCache, batch size 256; each batch comes from a single source so in-batch negatives are same-domain, with no duplicate texts in a batch.
  • Schedule: learning rate 2e-5, 5% warmup, linear decay.
Framework Versions
  • Sentence Transformers 5.4.1, Transformers 4.55.4, PyTorch 2.8.0, Tokenizers 0.21.0, Flash Attention 2.8.3
Limitations
  • Trained mostly on Modern Standard Arabic: dialectal and social-media Arabic (e.g. tweets) is weaker than formal text.
  • Arabic only; it was not trained for other languages or cross-lingual retrieval.
  • 1024-dimensional vectors and ~2.5x the compute of Mizan-Embeddings-0.1B per text: re-index existing vector stores when switching models.
Citation
@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",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}

@misc{warner2024modernbert,
    title = {Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference},
    author = {Benjamin Warner and Antoine Chaffin and Benjamin Clavi{\'e} and Orion Weller and Oskar Hallstr{\"o}m and Said Taghadouini and Alexis Gallagher and Raja Biswas and Faisal Ladhak and Tom Aarsen and Nathan Cooper and Griffin Adams and Jeremy Howard and Iacopo Poli},
    year = {2024},
    eprint = {2412.13663},
    archivePrefix = {arXiv},
}

@misc{gao2021scaling,
    title = {Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
    author = {Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
    year = {2021},
    eprint = {2101.06983},
    archivePrefix = {arXiv},
}

Runs of ALJIACHI Mizan-Embeddings-0.4B on huggingface.co

15
Total runs
2
24-hour runs
2
3-day runs
5
7-day runs
14
30-day runs

More Information About Mizan-Embeddings-0.4B huggingface.co Model

More Mizan-Embeddings-0.4B license Visit here:

https://choosealicense.com/licenses/apache-2.0

Mizan-Embeddings-0.4B huggingface.co

Mizan-Embeddings-0.4B huggingface.co is an AI model on huggingface.co that provides Mizan-Embeddings-0.4B's model effect (), which can be used instantly with this ALJIACHI Mizan-Embeddings-0.4B model. huggingface.co supports a free trial of the Mizan-Embeddings-0.4B model, and also provides paid use of the Mizan-Embeddings-0.4B. Support call Mizan-Embeddings-0.4B model through api, including Node.js, Python, http.

Mizan-Embeddings-0.4B huggingface.co Url

https://huggingface.co/ALJIACHI/Mizan-Embeddings-0.4B

ALJIACHI Mizan-Embeddings-0.4B online free

Mizan-Embeddings-0.4B huggingface.co is an online trial and call api platform, which integrates Mizan-Embeddings-0.4B's modeling effects, including api services, and provides a free online trial of Mizan-Embeddings-0.4B, you can try Mizan-Embeddings-0.4B online for free by clicking the link below.

ALJIACHI Mizan-Embeddings-0.4B online free url in huggingface.co:

https://huggingface.co/ALJIACHI/Mizan-Embeddings-0.4B

Mizan-Embeddings-0.4B install

Mizan-Embeddings-0.4B is an open source model from GitHub that offers a free installation service, and any user can find Mizan-Embeddings-0.4B on GitHub to install. At the same time, huggingface.co provides the effect of Mizan-Embeddings-0.4B install, users can directly use Mizan-Embeddings-0.4B installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

Mizan-Embeddings-0.4B install url in huggingface.co:

https://huggingface.co/ALJIACHI/Mizan-Embeddings-0.4B

Url of Mizan-Embeddings-0.4B

Mizan-Embeddings-0.4B huggingface.co Url

Provider of Mizan-Embeddings-0.4B huggingface.co

ALJIACHI
ORGANIZATIONS

Other API from ALJIACHI

huggingface.co

Total runs: 398
Run Growth: 242
Growth Rate: 60.80%
Updated:October 04 2026