Model Card for Model ID

GemMarocโ€‘27B

Unlocking Moroccanโ€ฏDarija proficiency in a stateโ€‘ofโ€‘theโ€‘art large language model, trained with a minimalโ€‘data, greenโ€‘AI recipe that preserves Gemmaโ€‘27Bโ€™s strong reasoning abilities while adding fluent Darija generation.


Model at a glance

Details
Model ID AbderrahmanSkiredj1/GemMaroc-27b-it
Base model google/gemma-3-27b
Architecture Decoderโ€‘only Transformer (Gemma 3)
Parameters 27โ€ฏbillion
Context length 2โ€ฏ048 tokens
Training regime Supervised fineโ€‘tuning (LoRA โ†’ merged) on 50โ€ฏK highโ€‘quality Darija/English instructions TULUโ€‘50K slice
Compute budget 48 GPUยทh (8โ€ฏร—โ€ฏH100โ€‘80GB ร— 6โ€ฏh) โ€“ โ‰ˆโ€ฏ26โ€ฏkWh / 10โ€ฏkgโ€ฏCOโ‚‚e
License Apache 2.0

Why another Darija model?

  • Inclusive AIโ€ƒ>โ€ฏ36โ€ฏmillion speakers of Moroccan Arabic remain underserved by open LLMs.
  • Qualityโ€‘overโ€‘quantityโ€ƒA carefully curated 50โ€ฏK instruction set surfaces Darija competence without sacrificing crossโ€‘lingual reasoning.
  • Green AIโ€ƒGemMaroc achieves Atlasโ€‘Chatโ€‘level Darija scores using <โ€ฏ2โ€ฏ% of the energy.

Benchmark summary

Model Darijaโ€ฏMMLU Darijaโ€ฏHellaSwag GSM8K @5 HellaSwag (EN)
Atlasโ€‘Chatโ€‘27B 61.9โ€ฏ% 48.4โ€ฏ% 82.0โ€ฏ% 77.8โ€ฏ%
GemMarocโ€‘27B 61.6โ€ฏ% 60.5โ€ฏ% 84.2โ€ฏ% 79.3โ€ฏ%

Zeroโ€‘shot accuracy; full table in the paper.


Quick start

from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

model_id = "AbderrahmanSkiredj1/GemMaroc-27b-it"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model     = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype="auto",
    device_map="auto"
)

pipe = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    device_map="auto",
    max_new_tokens=1024,
    temperature=0.7,
    repetition_penalty=1.2,
    no_repeat_ngram_size=3,
)

messages = [
    {"role": "user", "content": "ุดู†ูˆ ู‡ูŠ ู†ุธุฑูŠุฉ โ€˜butterfly effectโ€™ุŸ ูุณู‘ุฑู‡ุง ุจุฏุงุฑุฌุฉ ูˆู†ู‚ู‘ุท ู…ุซุงู„ ุจุณูŠุท."}
]

prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
print(pipe(prompt)[0]["generated_text"][len(prompt):])

Chat template (Gemma 3 format)

The tokenizer provides a bakedโ€‘in Jinja template that starts with a beginโ€‘ofโ€‘sequence token (<bos>), then alternates user/model turns, each wrapped by <start_of_turn> โ€ฆ <end_of_turn> markers. When you set add_generation_prompt=True it ends after the opening model tag so the model can continue:

<bos><start_of_turn>user
{user message}<end_of_turn>
<start_of_turn>model

The assistant will keep generating tokens until it decides to emit <end_of_turn>.

prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)

No manual token juggling requiredโ€”the call above handles BOS, turn delimiters, and newline placement automatically.


Preโ€‘quantised checkpoints will be published under the same repo tags (gemmarocโ€‘27bโ€‘awqโ€‘int4, gemmarocโ€‘27bโ€‘ggufโ€‘q4_k_m).


Training recipe (oneโ€‘paragraph recap)

  1. Dataโ€ƒTranslate a 44โ€ฏK reasoning slice of TULU 50K into Darija, keeping 20โ€ฏ% English for crossโ€‘lingual robustness.
  2. LoRA SFTโ€ƒRank 16, ฮฑโ€ฏ=โ€ฏ32, 3โ€ฏepochs, bf16, context 2โ€ฏ048.
  3. Merge & pushโ€ƒMerge LoRA into base weights (peft.merge_and_unload), convert to safetensors, upload.

Limitations & ethical considerations

  • Sentiment and abstractive summarisation still trail stateโ€‘ofโ€‘theโ€‘art.
  • Tokeniser is unchanged; rare Darija spellings may fragment.
  • Model may inherit societal biases present in preโ€‘training data.
  • No RLHF / RLAIF safety alignment yet โ€“ apply a moderation layer in production.

Citation

If you use GemMaroc in your work, please cite:

@misc{abderrahman2025gemmaroc,
  author       = {Skiredj, Abderrahman and Azhari, Ferdaous and Atou, Houdaifa and Tazi, Nouamane and Berrada, Ismail},
  title        = {{GemMaroc: Unlocking Darija Proficiency in LLMs with Minimal Data}},
  year         = {2025},
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.15492072},
  url          = {https://doi.org/10.5281/zenodo.15492072}
}

Downloads last month
10
Safetensors
Model size
4B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for MathematicianNLPer/GemMaroc-4b-deita

Finetuned
(455)
this model

Dataset used to train MathematicianNLPer/GemMaroc-4b-deita