Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,10 +1,106 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
-
-
|
| 4 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- ar
|
| 4 |
+
license: apache-2.0
|
| 5 |
tags:
|
| 6 |
+
- mamba
|
| 7 |
+
- state-space-model
|
| 8 |
+
- arabic
|
| 9 |
+
- masked-language-modeling
|
| 10 |
+
- bidirectional
|
| 11 |
+
datasets:
|
| 12 |
+
- wikimedia/wikipedia
|
| 13 |
+
- uonlp/CulturaX
|
| 14 |
+
pipeline_tag: fill-mask
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# AraSSM-base
|
| 18 |
+
|
| 19 |
+
AraSSM is a bidirectional state-space (Mamba) encoder pretrained from scratch for Arabic via
|
| 20 |
+
masked language modeling. It is, to our knowledge, the first bidirectional Mamba/SSM encoder
|
| 21 |
+
pretrained specifically for Arabic, and was trained entirely on four consumer-grade NVIDIA RTX
|
| 22 |
+
2080Ti GPUs (11GB) rather than an accelerator cluster.
|
| 23 |
+
|
| 24 |
+
## Model description
|
| 25 |
+
|
| 26 |
+
Each AraSSM layer runs a forward and a backward selective-scan (Mamba) mixer over the same
|
| 27 |
+
input and merges the two outputs, giving the model full bidirectional context while keeping
|
| 28 |
+
$O(L)$ complexity in sequence length $L$, instead of the $O(L^2)$ complexity of self-attention.
|
| 29 |
+
|
| 30 |
+
| | |
|
| 31 |
+
|---|---|
|
| 32 |
+
| Layers | 12 |
|
| 33 |
+
| Hidden size ($d_{\text{model}}$) | 512 |
|
| 34 |
+
| State dimension | 16 |
|
| 35 |
+
| Parameters | ~105M |
|
| 36 |
+
| Max sequence length | 512 |
|
| 37 |
+
| Vocabulary size | 64,000 |
|
| 38 |
+
|
| 39 |
+
## Tokenizer
|
| 40 |
+
|
| 41 |
+
AraSSM uses the existing **AraBERTv02 tokenizer**
|
| 42 |
+
([`aubmindlab/bert-base-arabertv02`](https://huggingface.co/aubmindlab/bert-base-arabertv02))
|
| 43 |
+
rather than a custom-trained one. This tokenizer was not trained as part of this work; it is
|
| 44 |
+
reused as-is, both to decouple corpus preprocessing from tokenizer choice and to keep results
|
| 45 |
+
comparable to AraBERT-family baselines that use the same vocabulary. All credit for the
|
| 46 |
+
tokenizer belongs to its original authors.
|
| 47 |
+
|
| 48 |
+
## Training data
|
| 49 |
+
|
| 50 |
+
AraSSM is pretrained on a cleaned, deduplicated corpus of approximately 80GB of Arabic text
|
| 51 |
+
(79.6GB train / 0.4GB validation), combining Arabic Wikipedia and the Arabic portion of
|
| 52 |
+
CulturaX. Documents are stripped of diacritics and URLs, filtered for length and Arabic-script
|
| 53 |
+
ratio, chunked to at most 400 words, and deduplicated at the chunk level with a Bloom filter.
|
| 54 |
+
|
| 55 |
+
## Training procedure
|
| 56 |
+
|
| 57 |
+
- Objective: standard BERT-style masked language modeling (15% masking, 80/10/10 split)
|
| 58 |
+
- Optimizer: AdamW, lr 3e-4, weight decay 0.01, 10,000 warmup steps, linear decay
|
| 59 |
+
- Precision: fp16 (Turing GPUs do not support accelerated bf16)
|
| 60 |
+
- Effective batch size: 256 (batch size 8 x grad accumulation 8 x 4 GPUs)
|
| 61 |
+
- Compute: 4x RTX 2080Ti, ~960 GPU-hours (~10 days)
|
| 62 |
+
|
| 63 |
+
## How to use
|
| 64 |
+
|
| 65 |
+
AraSSM is a custom architecture (not a native `transformers` model class), so loading it
|
| 66 |
+
requires the model code from the project repository:
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
from huggingface_hub import PyTorchModelHubMixin
|
| 70 |
+
from models.mamba import MambaForMaskedLM # from the AraSSM repository
|
| 71 |
+
|
| 72 |
+
class HubMambaForMaskedLM(MambaForMaskedLM, PyTorchModelHubMixin):
|
| 73 |
+
pass
|
| 74 |
+
|
| 75 |
+
model = HubMambaForMaskedLM.from_pretrained("aliane29/arassm-base")
|
| 76 |
+
|
| 77 |
+
from transformers import AutoTokenizer
|
| 78 |
+
tokenizer = AutoTokenizer.from_pretrained("aliane29/arassm-base")
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## Intended use
|
| 82 |
+
|
| 83 |
+
This is a pretrained encoder intended to be fine-tuned on downstream Arabic NLU tasks
|
| 84 |
+
(classification, token classification, extractive question answering), similarly to how a
|
| 85 |
+
BERT-family encoder is used. It has not been fine-tuned for any specific task in this repository.
|
| 86 |
+
|
| 87 |
+
## Limitations
|
| 88 |
+
|
| 89 |
+
- Pretrained on Modern Standard Arabic and web text (Wikipedia + CulturaX); performance on
|
| 90 |
+
dialectal Arabic is not evaluated.
|
| 91 |
+
- Maximum sequence length is 512 tokens.
|
| 92 |
+
- Trained on a fixed, publicly available compute budget (4 consumer GPUs); larger-scale
|
| 93 |
+
Transformer baselines were pretrained on substantially larger accelerator-cluster budgets.
|
| 94 |
+
|
| 95 |
+
## Citation
|
| 96 |
+
|
| 97 |
+
If you use this model, please cite:
|
| 98 |
+
|
| 99 |
+
```bibtex
|
| 100 |
+
@misc{arassm2026,
|
| 101 |
+
title = {AraSSM: A Bidirectional State-Space Encoder for Arabic Masked Language Modeling},
|
| 102 |
+
author = {Aliane, Ahmed Amine and Aliane, Hassina and Semmar, Nasredine},
|
| 103 |
+
year = {2026},
|
| 104 |
+
note = {Preprint}
|
| 105 |
+
}
|
| 106 |
+
```
|