A vegaml decision model that answers three typed questions about an Arabic tweet in one read:
| question | type | answers |
|---|---|---|
sentiment |
choice | positive, negative, neutral |
sarcasm |
boolean | probability the tweet is sarcastic |
dialect |
choice | msa, egyptian, gulf, levantine |
It does not generate text. The frozen reader (Jais-3-0.9B) reads the tweet, the vega-U physics engine settles on an answer, and every answer comes back with a calibrated probability.
This is a standalone, single merged model: the fine-tuned LoRA is folded into engine.safetensors, its calibration into vega_config.json, and the Jais-3-0.9B reader (weights, config, tokenizer) is bundled in backbone/. A snapshot of this repo runs with no other download and works fully offline or air-gapped.
The Jais-3-0.9B reader is not one vega-U ships a port for. It was attached with vegaml.attach on 6,000 unlabelled Arabic lines (5,000 training tweets and 1,000 MASSIVE ar-SA utterances); the base engine is unchanged by that step.
Jais-3 needs remote code. Its K2Horizon architecture is not in Transformers yet and vegaml does not pass trust_remote_code, so enable it before loading. Only do this for repos whose code you have reviewed (inception42/Jais-3-0.9B ships only configuration_k2_horizon.py and modeling_k2_horizon.py).
import transformers
for _n in ("AutoModelForCausalLM", "AutoTokenizer", "AutoConfig"):
_cls = getattr(transformers, _n); _f = _cls.from_pretrained.__func__
_cls.from_pretrained = classmethod(lambda k, *a, _f=_f, **kw: _f(k, *a, **{"trust_remote_code": True, **kw}))
import json, os, vegaml
from huggingface_hub import snapshot_download
path = snapshot_download("yasserrmd/vega-arabic-jais3-0.9b") # everything, including backbone/
v = vegaml.load(path) # loads the bundled reader, no other repo
questions = json.load(open(os.path.join(path, "arabic_questions.json"), encoding="utf-8"))
out = v.decide("الحين وش السالفة؟ كل يوم زحمة على الشارع ولا أحد يحل المشكلة", questions)
print(out["answers"]["sentiment"]["choice"], out["answers"]["dialect"]["choice"])
For an air-gapped machine, copy the downloaded folder across and call vegaml.load("/path/to/folder"). Calling vegaml.load("yasserrmd/vega-arabic-jais3-0.9b") with the repo id also works, but then vegaml fetches the reader from inception42/Jais-3-0.9B instead of using backbone/.
Keep the question wording in arabic_questions.json: it is what the model was trained on. Because the fine-tune is merged into the engine, it also applies to any other question you ask; for unrelated decision tasks use the stock nandakishorm/vega-U engine.
Official ArSarcasm-v2 test split, 2988 tweets. Base = the vega-U engine zero-shot with the same reader and questions. ECE = expected calibration error (lower is better). The merged model was re-scored after merging and matches the unmerged adapter; the standalone folder was load-tested with the network disabled.
| question | n | base acc | base macro-F1 | base ECE % | merged acc | merged macro-F1 | merged ECE % |
|---|---|---|---|---|---|---|---|
| sentiment | 2988 | 0.284 | 0.210 | 24.52 | 0.691 | 0.634 | 3.44 |
| sarcasm | 2988 | 0.718 | 0.465 | 9.39 | 0.753 | 0.714 | 1.86 |
| dialect | 2986 | 0.091 | 0.078 | 21.49 | 0.586 | 0.397 | 5.75 |
Gulf-dialect slice of the test split (319 tweets):
| question | n | base acc | base macro-F1 | base ECE % | merged acc | merged macro-F1 | merged ECE % |
|---|---|---|---|---|---|---|---|
| sentiment | 319 | 0.285 | 0.210 | 23.96 | 0.636 | 0.599 | 4.16 |
| sarcasm | 319 | 0.812 | 0.479 | 17.67 | 0.774 | 0.677 | 5.18 |
| dialect | 319 | 0.000 | 0.000 | 30.27 | 0.455 | 0.156 | 13.36 |
Dialect accuracy can drop below the base on the full test set: the base engine labels nearly everything MSA (77% of the test set), which scores well on accuracy and badly on macro-F1. Macro-F1 is the fairer number for dialect.
Seven systems, five test sets, the same three questions for every system (arabic_questions.json). Best value in each column in bold.
| system | ArSarcasm sentiment acc | ArSarcasm sarcasm F1 | ArSarcasm dialect F1 | QADI dialect F1 | QADI UAE tagged Gulf | iSarcasmEval F1 | iSarcasmEval F1-sarcastic | AJGT acc | HARD acc |
|---|---|---|---|---|---|---|---|---|---|
| vega-arabic Jais-3-0.9B (this model) | 0.690 | 0.712 | 0.397 | 0.371 | 0.542 | 0.688 | 0.472 | 0.922 | 0.850 |
| vega-arabic Qwen3.5-4B | 0.685 | 0.709 | 0.399 | 0.310 | 0.349 | 0.679 | 0.448 | 0.902 | 0.840 |
| vega-arabic Qwen3.5-0.8B | 0.648 | 0.679 | 0.335 | 0.264 | 0.328 | 0.645 | 0.392 | 0.825 | 0.816 |
| laya-ara (Laya Arabic fine-tune) | 0.460 | 0.632 | 0.172 | 0.281 | 0.578 | 0.578 | 0.252 | 0.810 | 0.797 |
| laya-multilingual (stock) | 0.505 | 0.524 | 0.216 | 0.239 | 0.406 | 0.496 | 0.076 | 0.790 | 0.773 |
| Qwen3.5-4B, prompted | 0.487 | 0.428 | 0.299 | 0.251 | 0.234 | 0.323 | 0.281 | 0.771 | 0.879 |
| Jais-3-0.9B, prompted | 0.675 | 0.515 | 0.175 | 0.091 | 0.000 | 0.501 | 0.274 | 0.900 | 0.710 |
What each test set measures:
| test set | what it tests | n | metric |
|---|---|---|---|
| ArSarcasm-v2 test | in-domain tweets (official split) | 2988 | sentiment accuracy, sarcasm and dialect macro-F1 |
| QADI test | country-labelled tweets from 14 Gulf, Egyptian/Sudanese and Levantine countries, mapped to gulf / egyptian / levantine; Maghreb dropped; no MSA in the gold labels | 2632 | macro-F1 over the 3 dialects; share of the 192 UAE tweets tagged gulf |
| iSarcasmEval Arabic, task A test | sarcasm in tweets from a separate, later collection with author-provided labels, 14% sarcastic | 1400 | macro-F1, and F1 of the sarcastic class (the shared-task metric) |
| AJGT | Jordanian dialect tweets, positive / negative | 1799 | accuracy, P(positive) vs P(negative) |
| HARD | hotel reviews from Booking.com, stratified sample, rating 1-2 negative, 4-5 positive | 2000 | accuracy, P(positive) vs P(negative) |
No test tweet appears in the training data (checked by exact text after cleaning; one AJGT duplicate was removed).
Speed and memory, A100 40GB, all three questions on one tweet per call, warm, 100 timed calls; throughput over 490 tweets (batched for Laya and the prompted LLMs, one call per tweet for vega):
| system | peak GPU memory | latency per tweet (median) | p95 | throughput |
|---|---|---|---|---|
| vega-arabic Jais-3-0.9B (this model) | 2.37 GB | 49.8 ms | 52.1 ms | 20.1 tweets/s |
| vega-arabic Qwen3.5-4B | 8.72 GB | 87.1 ms | 90.8 ms | 11.5 tweets/s |
| vega-arabic Qwen3.5-0.8B | 1.67 GB | 68.2 ms | 70.1 ms | 14.5 tweets/s |
| laya-ara (Laya Arabic fine-tune) | 2.16 GB | 31.3 ms | 33.5 ms | 332.8 tweets/s |
| laya-multilingual (stock) | 2.16 GB | 30.7 ms | 31.6 ms | 336.1 tweets/s |
| Qwen3.5-4B, prompted | 11.75 GB | 119.7 ms | 136.1 ms | 8.0 tweets/s |
| Jais-3-0.9B, prompted | 2.84 GB | 44.6 ms | 47.0 ms | 26.8 tweets/s |
How the baselines were run:
pip install laya) answer the same question file in one forward pass; the boolean question is sent as Laya's noul type. laya-ara is a fine-tune of laya-multilingual on MASSIVE-ar, OSACT4 and XNLI-ar (MSA-style data), released for research and non-commercial use.causal-conv1d kernel (PyTorch reference fallback), so the two Qwen-based vega models are slower than they can be.What the numbers say: all three vega-arabic models beat every baseline on sarcasm, in-domain and on iSarcasmEval. vega-arabic Jais-3-0.9B is the best system on ArSarcasm sentiment, QADI dialect F1 and AJGT, and vega-arabic Qwen3.5-4B is best on ArSarcasm dialect F1. vega-arabic Qwen3.5-0.8B falls just below laya-ara on QADI dialect F1 (0.264 vs 0.281). Two places where another system wins: prompted Qwen3.5-4B is better on HARD hotel reviews, which are longer, formal-leaning text unlike the training tweets, and laya-ara tags slightly more UAE tweets as Gulf while scoring lower on overall QADI F1. Laya is far faster in batched throughput.
Scripts and raw per-item predictions: training/benchmark/.
ArSarcasm-v2 (MIT), 15,548 tweets. Changes made by prepare_arabic.py:
@user, hashtag underscores turned into spaces, letter elongation capped at 3, tatweel removed. Emojis kept.Rank-32 gated LoRA on seven engine projections plus a gate network (835,937 trainable parameters), then merged as W + (alpha/rank) B A. The trained gate was fully open on this task (mean 1.000), so the merge is exact for these questions. Reader frozen throughout. Class-balanced cross-entropy (inverse square-root frequency), 6 epochs, AdamW with a one-cycle schedule, lr 3e-4, single A100. Thermal calibration and conformal thresholds fitted on the validation split.
backbone/: the Jais-3-0.9B reader, an unmodified copy of inception42/Jais-3-0.9B (Apache-2.0)engine.safetensors: the vega-U engine with the fine-tune merged inport.safetensors, stats.npz, vega_config.json: the reader's port into the shared space, feature statistics, config and calibrationarabic_questions.json: the three question definitionstraining/: prepare_arabic.py, vega_finetune_arabic.py, merge_adapter.py, dataset stats, raw benchmark JSON and the load testThe bundled reader is redistributed unmodified under its own license (Apache-2.0). vegaml and vega-U by Nanda Kishor M (Apache-2.0). Jais-3-0.9B by its authors. ArSarcasm-v2 by Ibrahim Abu Farha and Walid Magdy (MIT).
backbone/model-00000-of-00001.safetensors 2.2 GBengine.safetensors 57 MBport.safetensors 13 MBstats.npz 87 kBinception42/Jais-3-0.9B