Instructions to use adelpro/atm-v2-web with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use adelpro/atm-v2-web with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("adelpro/atm-v2-web") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers.js
How to use adelpro/atm-v2-web with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('feature-extraction', 'adelpro/atm-v2-web'); - Notebooks
- Google Colab
- Kaggle
Arabic Triplet Matryoshka V2 (ATM-V2) โ INT8 ONNX (Web / transformers.js)
This is an INT8 dynamic-quantized ONNX export of
Omartificial-Intelligence-Space/Arabic-Triplet-Matryoshka-V2, the
state-of-the-art Arabic embedding model (ATM2), laid out for the
transformers.js (@huggingface/transformers) web runtime. It powers the
"ุจุงูุฐูุงุก ุงูุงุตุทูุงุนู" (AI) semantic-search tab of the open-mushaf Quran reader
in the browser (PWA).
The model maps Arabic sentences and verses to a 768-dimensional dense vector space for semantic search, similarity, IR, and clustering. It is fine-tuned from aubmindlab/bert-base-arabertv02 and described in the paper GATE: General Arabic Text Embedding for Enhanced Semantic Textual Similarity with Hybrid Loss Training.
Model Description
Arabic-Triplet-Matryoshka-V2-Model is a state-of-the-art Arabic language embedding model based on the sentence-transformers framework and specifically designed to capture the rich semantic nuances of Arabic text.
| Attribute | Value |
|---|---|
| Base model | aubmindlab/bert-base-arabertv02 |
| Embedding dimension | 768 |
| Parameters | 135M |
| Pretrained model format | fp32 safetensors |
| This export | INT8 dynamic-quantized ONNX (onnx/model_quantized.onnx) |
| Runtime | @huggingface/transformers (transformers.js) WASM backend |
| License | Apache-2.0 |
Key Features
- State-of-the-Art Performance: Achieved 0.85 on STS17 and 0.64 on STS22.v2 with an average score of 74.5 on Arabic semantic similarity.
- MatryoshkaLoss Training: Nested embeddings at multiple resolutions.
- Full Arabic Support: Handles the complexity and morphological richness of Arabic.
- Browser-ready: runs in-browser via transformers.js with the
q8dtype.
Training Details
- Loss functions:
MatryoshkaLoss+MultipleNegativesRankingLoss. - Dataset:
akhooli/arabic-triplets-1m-curated-sims-len(1M samples). - Epochs: 3 ยท Final loss: 0.718 ยท Embedding dim: 768.
Performance
From the original model card (Arabic semantic similarity benchmarks):
| Model | Dim | Params | STS17 | STS22-v2 | Avg |
|---|---|---|---|---|---|
| ATM-V2 (this repo base) | 768 | 135M | 85 | 64 | 75 |
See the upstream
Omartificial-Intelligence-Space/Arabic-Triplet-Matryoshka-V2
card for the full comparison table.
Use Cases
- Semantic textual similarity, document retrieval, question answering, clustering, and classification of Arabic text.
- Client-side semantic search in the browser (as used by the open-mushaf PWA).
File layout (transformers.js)
This repo hosts the web layout expected by transformers.js:
config.json
tokenizer.json
tokenizer_config.json
special_tokens_map.json
onnx/model_quantized.onnx
With the pipeline configured as dtype: 'q8', transformers.js resolves the
q8 precision to onnx/model_quantized.onnx. The repo must remain
public โ transformers.js fetches these files over plain HTTPS with no auth.
A companion native layout lives in
adelpro/atm-v2-int8-onnx.
Usage (@huggingface/transformers)
import { pipeline } from '@huggingface/transformers';
const extractor = await pipeline('feature-extraction', 'adelpro/atm-v2-web', {
dtype: 'q8',
device: 'wasm',
});
const out = await extractor('ุงูุฑููุญูู
ููู ุนููููู
ู ุงููููุฑูุขูู', {
pooling: 'mean',
normalize: true,
});
// out.data is the 768-dim L2-normalized embedding.
Note: the vector index built for this model uses mean pooling + L2 normalization with no
query:/passage:prefixes (the upstream model card shows plainencode(), not an E5-style prefix convention). Keep query and stored passages in the same unprefixed space. The WASM backend runs single-threaded to avoid SharedArrayBuffer / cross-origin isolation requirements.
Limitations
- May not perform optimally on highly technical / domain-specific Arabic that was underrepresented in training.
- A one-word short query (e.g. a proper noun) embeds weakly relative to long passages; semantically-linked epithets may not surface at high cosine.
- Int8 dynamic quantization introduces small weight-precision loss compared to the fp32 original.
Ethical Considerations
Intended for research and applications that benefit Arabic language processing. Biases that may exist in the training data should be considered.
Citation
Cite the upstream paper when referencing this model's methodology:
@article{nacar2025gate,
title={GATE: General Arabic Text Embedding for Enhanced Semantic Textual Similarity with Matryoshka Representation Learning and Hybrid Loss Training},
author={Nacar, Omer and Koubaa, Anis and Sibaee, Serry and Al-Habashi, Yasser and Ammar, Adel and Boulila, Wadii},
journal={arXiv preprint arXiv:2505.24581},
year={2025}
}
Acknowledgements
Built on aubmindlab/bert-base-arabertv02 and the akhooli/arabic-triplets-1m-curated-sims-len dataset.
Derived from Omartificial-Intelligence-Space/Arabic-Triplet-Matryoshka-V2 (Apache-2.0). This ONNX export is the browser runtime model for the open-mushaf-native Quran reader.
- Downloads last month
- -
Model tree for adelpro/atm-v2-web
Base model
aubmindlab/bert-base-arabertv02