Downloads · 30 days
10
11% of all-time downloads
Omartificial-Intelligence-Space
Omartificial-Intelligence-Space/gpt-oss-math-ar
gpt-oss-math-ar is a machine learning model from Omartificial-Intelligence-Space. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
Downloads · 30 days
10
11% of all-time downloads
All-time downloads
90
Public
Repo size
76.2 MB
Likes
3
Public
Click a slice to open those files.
.safetensors31.9 MB · 42%
From the Hugging Face model README

Arabic step-by-step math solver fine-tuned from gpt-oss-20B using LoRA (PEFT) on curated Arabic GSM8K-style problems. The model is instructed to reason in Arabic and explain each solution step clearly before giving the final answer.
unsloth/gpt-oss-20b-unsloth-bnb-4bitOmartificial-Intelligence-Space/gpt-oss-math-ar⚠️ Note on reasoning: The model is optimized to write out reasoning steps in Arabic. For sensitive use cases (exams, grading, or high-stakes evaluation), always verify outputs.
from unsloth import FastLanguageModel
from transformers import TextStreamer
import torch
max_seq_length = 1024
dtype = None # auto-detect
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="Omartificial-Intelligence-Space/gpt-oss-math-ar",
dtype=dtype,
max_seq_length=max_seq_length,
load_in_4bit=True,
full_finetuning=False,
)
messages = [
{"role": "system", "content": "reasoning language: Arabic\n\nYou are an Arabic AI math questions solver that solves math problems step-by-step and explian in Arabic language only."},
{"role": "user", "content": "بطات جانيت تضع 16 بيضة في اليوم. فهي تأكل ثلاث منها على الفطور كل صباح وتخبز الكعك لأصدقائها كل يوم بأربع منها. إنها تبيع ما تبقى منها في سوق المزارعين كل يوم مقابل دولارين لكل بيضة بطازجة. كم تجني من الدولار كل يوم في سوق المزارعين؟"},
]
inputs = tokenizer2.apply_chat_template(
messages,
add_generation_prompt = True,
return_tensors = "pt",
return_dict = True,
reasoning_effort = "low",
).to(model2.device)
from transformers import TextStreamer
_ = model2.generate(**inputs, max_new_tokens = 256, streamer = TextStreamer(tokenizer2))
Prompting tip: Keep the system message as above so the model stays in Arabic and explains step-by-step.
Primary dataset (fine-tuning): Omartificial-Intelligence-Space/Arabic-gsm8k-v2
Curated Arabic word problems with gold step-by-step solutions.
Evaluation set (unseen): Omartificial-Intelligence-Space/Arabic-gsm8k (main_test split)
[ { "content": "reasoning language: Arabic\n\nYou are an Arabic AI math questions solver that solves math problems step-by-step and explian in Arabic language only.", "role": "system" },
{ "content": "باعت نتاليا مشابك إلى 48 من أصدقائها في شهر أبريل، ثم باعت نصف ذلك العدد من المشابك في شهر مايو. كم عدد المشابك التي باعتها نتاليا في شهري أبريل ومايو معًا؟", "role": "user" },
{ "content": "باعت ناتاليا 48 ÷ 2 = 24 مشبكًا في مايو.\nباعت ناتاليا 48 + 24 = 72 مشبكًا في أبريل ومايو مجتمعين.\n#### 72", "role": "assistant" } ]
[ { "content": "reasoning language: Arabic\n\nYou are an Arabic AI math questions solver that solves math problems step-by-step and explian in Arabic language only.", "role": "system" },
{ "content": "تقرأ جولي كتاباً مؤلفاً من 120 صفحة. بالأمس، تمكنت من قراءة 12 صفحة، واليوم قرأت ضعف عدد الصفحات التي قرأتها بالأمس. إذا أرادت قراءة نصف ما تبقى من صفحات غداً، كم صفحة عليها أن تقرأ؟", "role": "user" },
{ "content": "قرأت مايلا اليوم 12 × 2 = 24 صفحة.\nلذلك فإن إجمالي ما قرأته منذ الأمس هو 12 + 24 = 36 صفحة.\nتبقى 120 - 36 = 84 صفحة ليتم قراءتها.\nوبما أنها تريد قراءة نصف الصفحات المتبقية غدًا، فيجب عليها أن تقرأ 84/2 = 42 صفحة.\n#### 42", "role": "assistant" } ]
Frameworks: Unsloth, Transformers, TRL (SFT)
Method: Supervised fine-tuning with LoRA adapters
model = FastLanguageModel.get_peft_model(
model,
r = 16,
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
"gate_proj", "up_proj", "down_proj"],
lora_alpha = 16,
lora_dropout = 0,
bias = "none",
use_gradient_checkpointing = "unsloth",
random_state = 3407,
use_rslora = False,
loftq_config = None,
)
from trl import SFTConfig, SFTTrainer
trainer = SFTTrainer(
model = model,
tokenizer = tokenizer,
train_dataset = dataset,
args = SFTConfig(
per_device_train_batch_size = 16,
gradient_accumulation_steps = 1,
warmup_steps = 100,
num_train_epochs = 3,
learning_rate = 2e-4,
logging_steps = 100,
optim = "adamw_8bit",
weight_decay = 0.01,
lr_scheduler_type = "linear",
seed = 3407,
output_dir = "outputs",
report_to = "none",
),
)
Hardware: Colab A100 40GB
Seed: 3407
Recommended generation (starting point):
max_new_tokens: 128–384 for typical word problemstemperature: 0.1–0.5 (lower for deterministic math)top_p: 0.8–0.95repetition_penalty: ~1.05 (optional)#### <النتيجة>Example:
[system] reasoning language: Arabic
You are an Arabic AI math questions solver that solves math problems step-by-step and explian in Arabic language only.
[user] لدى متجر 75 قطعة حلوى. باع 18 قطـعة في الصباح و 23 في المساء. كم تبقى؟
Omartificial-Intelligence-Space/Arabic-gsm8k (main_test)#### <number> line; optional step-accuracy analysis for intermediate calculations.Intended use
Limitations
Safety & responsible use
Author/Maintainer: Omer Nacar — Omartificial-Intelligence-Space
Model page: https://huggingface.co/Omartificial-Intelligence-Space/gpt-oss-math-ar
Please cite:
@model{gpt_oss_math_ar_oi_space,
title = {gpt-oss-math-ar: Arabic Step-by-Step Math Reasoning Adapter for gpt-oss-20B},
author = {Omer Nacar},
year = {2025},
howpublished = {\url{https://huggingface.co/Omartificial-Intelligence-Space/gpt-oss-math-ar}}
}
Also cite the base and tooling:
unsloth/gpt-oss-20b-unsloth-bnb-4bitOmartificial-Intelligence-Space/Arabic-gsm8k and Arabic-gsm8k-v2gpt-oss-math-ar (adapter on gpt-oss-20B) with Arabic step-by-step math reasoning and example inference code.