Diraya-3B-Instruct-Ar
is an
Arabic
reasoning-specialized language model fine-tuned from
Qwen2.5-3B
.
This model is part of the
DIRA (Diraya Arabic Reasoning AI)
collection, which focuses on enhancing the logical inference and mathematical reasoning capabilities of
Arabic
language models.
Key Features
Arabic-first reasoning
: Optimized specifically for complex reasoning tasks in Arabic
Structured reasoning format
: Trained to output reasoning in a clear XML format
Mathematical reasoning
: Enhanced ability to solve multi-step math problems
Instruction-tuned
: Follows instructions reliably in Arabic
Lightweight
: Based on the efficient 3B parameter model architecture
The model is designed to output structured reasoning in the following format:
<reasoning>
[Step-by-step reasoning process in Arabic]
</reasoning>
<answer>
[Final answer in Arabic]
</answer>
Example Usage
from unsloth import FastLanguageModel
max_seq_length = 1024# Can increase for longer reasoning traces
lora_rank = 64# Larger rank = smarter, but slower
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "Omartificial-Intelligence-Space/Diraya-3B-Instruct-Ar",
max_seq_length = max_seq_length,
load_in_4bit = True, # False for LoRA 16bit
fast_inference = True, # Enable vLLM fast inference
max_lora_rank = lora_rank,
)
# System prompt to enforce XML structure
system_prompt = """Respond in the following format in Arabic language only:<reasoning>...</reasoning><answer>...</answer>"""# Prepare user question
user_question = "كل يوم، تُطعم وندي كل دجاجة من دجاجاتها ثلاث أكواب من العلف المختلط. تقدم الدجاجات وجباتهم في ثلاث وجبات منفصلة. في الصباح، تعطي قطيعها من الدجاج 15 كوبًا من العلف. في فترة ما بعد الظهر، تعطي دجاجاتها 25 كوبًا أخرى من العلف. كم عدد أكواب العلف التي تحتاجها لتقديمها لدجاجاتها في الوجبة الأخيرة من اليوم إذا كان حجم قطيع وندي 20 دجاجة؟"# Prepare input for the model
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_question}
]
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# Generate response
inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.95
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
A comprehensive collection of grade school math problems translated to Arabic, requiring multi-step reasoning
Training and Evaluation Results
Training Progress
Figure: Composition of Rewards over Training Steps showing the evolution of model performance across different reward functions
The training utilized multiple reward functions to optimize different aspects of the model's performance:
Correctness Reward
(red): Measures the model's ability to generate the correct final answer
Integer Reward
(blue): Ensures the model outputs valid numerical responses
Format Rewards
(purple/gray): Promote proper XML structure adherence
XML Count Reward
(yellow): Fine-tunes the exact XML tag placement and completeness
As shown in the visualization, the model demonstrated consistent improvement across all reward dimensions throughout the training process. The upper values in rewards indicate higher-quality outputs that simultaneously satisfy multiple optimization criteria. This multi-objective training approach resulted in a model that not only produces correct answers but does so with clear, well-structured reasoning.
The model demonstrates strong performance on Arabic mathematical reasoning tasks, with particular strengths in:
Producing well-structured reasoning steps
Following the required XML output format
Arriving at correct numerical answers for multi-step problems
Citation
If you use this model in your research, please cite:
@misc{diraya3b,
title={Diraya-3B-Instruct-Ar: An Arabic Reasoning-Specialized Language Model},
author={Omartificial-Intelligence-Space},
year={2025},
howpublished={\url{https://huggingface.co/Omartificial-Intelligence-Space/Diraya-3B-Instruct-Ar}}
}
Acknowledgements
This model builds upon the Qwen2.5-3B model by the Qwen Team and utilizes optimization techniques from Unsloth. We acknowledge their valuable contributions to the field of language modeling.
@misc{qwen2.5,
title = {Qwen2.5: A Party of Foundation Models},
url = {https://qwenlm.github.io/blog/qwen2.5/},
author = {Qwen Team},
month = {September},
year = {2024}
}
@article{qwen2,
title={Qwen2 Technical Report},
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
journal={arXiv preprint arXiv:2407.10671},
year={2024}
}
Runs of Omartificial-Intelligence-Space Diraya-3B-Instruct-Ar on huggingface.co
12
Total runs
0
24-hour runs
1
3-day runs
5
7-day runs
10
30-day runs
More Information About Diraya-3B-Instruct-Ar huggingface.co Model
Diraya-3B-Instruct-Ar huggingface.co is an AI model on huggingface.co that provides Diraya-3B-Instruct-Ar's model effect (), which can be used instantly with this Omartificial-Intelligence-Space Diraya-3B-Instruct-Ar model. huggingface.co supports a free trial of the Diraya-3B-Instruct-Ar model, and also provides paid use of the Diraya-3B-Instruct-Ar. Support call Diraya-3B-Instruct-Ar model through api, including Node.js, Python, http.
Diraya-3B-Instruct-Ar huggingface.co is an online trial and call api platform, which integrates Diraya-3B-Instruct-Ar's modeling effects, including api services, and provides a free online trial of Diraya-3B-Instruct-Ar, you can try Diraya-3B-Instruct-Ar online for free by clicking the link below.
Omartificial-Intelligence-Space Diraya-3B-Instruct-Ar online free url in huggingface.co:
Diraya-3B-Instruct-Ar is an open source model from GitHub that offers a free installation service, and any user can find Diraya-3B-Instruct-Ar on GitHub to install. At the same time, huggingface.co provides the effect of Diraya-3B-Instruct-Ar install, users can directly use Diraya-3B-Instruct-Ar installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
Diraya-3B-Instruct-Ar install url in huggingface.co: