Qwen3.5-0.8B Persian Agent

مدل زبانی فارسی سبک و سریع بر پایه‌ی Qwen3.5-0.8B؛ برای گفت‌وگوی روان فارسی، پیروی از دستورها و فراخوانی ابزار (Tool Calling)، مناسب اجرا روی لپ‌تاپ، موبایل و سرورهای کم‌هزینه.

  • آموزش کامل همه‌ی پارامترها (بدون LoRA) روی حدود ۳۸ هزار نمونه
  • پرپلکسیتی فارسی از ۱۳.۱۴ به ۱۰.۵۲ (حدود ۲۰٪ بهتر از مدل پایه)
  • نسخه‌های GGUF آماده برای llama.cpp، LM Studio، Ollama و PocketPal روی گوشی (از ۵۳۳ مگابایت)

Qwen3.5-0.8B Persian Agent is a compact, Persian-first (Farsi) assistant built on Qwen/Qwen3.5-0.8B. It is fully fine-tuned (all ~0.75B parameters, no LoRA) to improve natural Persian chat, instruction following and agentic tool / function calling, while keeping the base model's English skills. It runs comfortably on CPUs, laptops and phones.

Base model Qwen/Qwen3.5-0.8B (hybrid Gated DeltaNet + Gated Attention)
Languages Persian (primary), English
Parameters ~0.75B (tied embeddings)
Fine-tuning Full-parameter SFT, 2 stages
Context used in training 1,536 tokens
Mode Non-thinking (direct answers)
Formats Safetensors (Transformers), GGUF (llama.cpp, LM Studio, Ollama, PocketPal)
License Apache 2.0 (inherited from base model)

Files

File Size Min RAM (approx.) Notes
model.safetensors 1.50 GB (FP16) 3 GB Transformers, vLLM, further fine-tuning
GGUF repo: Q8_0 812 MB 1.5 GB ✅ Recommended. Near-lossless
GGUF repo: Q5_K_M 578 MB 1.2 GB Good balance of size and quality
GGUF repo: Q4_K_M 533 MB 1 GB Smallest; Persian imatrix, SSM gates kept at Q8_0

GGUF files live in MohammadBeigi/Qwen3.5-0.8B-Persian-Agent-GGUF. All GGUFs use the classic (unfused) Qwen3.5 tensor layout, so they load in older llama.cpp builds and mobile apps too. The embedded chat template always closes the <think> block, so apps that turn "thinking" on by default (e.g. PocketPal) still get direct answers.

Quick start

Transformers (requires transformers>=5)

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "MohammadBeigi/Qwen3.5-0.8B-Persian-Agent"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")

messages = [
    {"role": "system", "content": "تو یک دستیار فارسی‌زبان هستی؛ کوتاه، دقیق و صمیمی جواب بده."},
    {"role": "user", "content": "یک برنامه‌ی ساده برای صبحانه‌ی سالم در طول هفته پیشنهاد بده."},
]
inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, enable_thinking=False,
    return_tensors="pt", return_dict=True,
).to(model.device)
out = model.generate(**inputs, max_new_tokens=512, do_sample=True, temperature=0.7, top_p=0.8, top_k=20)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))

llama.cpp

llama-cli -hf MohammadBeigi/Qwen3.5-0.8B-Persian-Agent-GGUF:Q8_0 --jinja \
  --temp 0.7 --top-p 0.8 --top-k 20 \
  -sys "تو یک دستیار فارسی‌زبان هستی که پاسخ‌های روشن، کاربردی و بدون حاشیه می‌دهد."

Ollama

ollama run hf.co/MohammadBeigi/Qwen3.5-0.8B-Persian-Agent-GGUF:Q8_0

LM Studio / PocketPal (Android, iOS): search for MohammadBeigi/Qwen3.5-0.8B-Persian-Agent-GGUF and download a GGUF (Q4_K_M or Q5_K_M for phones). Recommended sampling: temperature 0.7, top-p 0.8, top-k 20.

Tool calling example

tools = [{
    "type": "function",
    "function": {
        "name": "convert_currency",
        "description": "تبدیل مبلغ بین ارزها با نرخ روز",
        "parameters": {
            "type": "object",
            "properties": {
                "amount": {"type": "number"},
                "from_currency": {"type": "string"},
                "to_currency": {"type": "string"},
            },
            "required": ["amount", "from_currency", "to_currency"],
        },
    },
}]

messages = [{"role": "user", "content": "۲۰۰ دلار الان چند تومن می‌شه؟"}]
inputs = tokenizer.apply_chat_template(
    messages, tools=tools, add_generation_prompt=True, enable_thinking=False,
    return_tensors="pt", return_dict=True,
).to(model.device)
out = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=False))

The model replies with a Qwen-style <tool_call> block (<function=convert_currency> with its parameters). When no provided tool fits the request, it is trained to answer directly instead of inventing a call.

Evaluation

Internal Persian evaluation (held-out Persian perplexity plus 14 targeted probes for fluency, knowledge, instruction following and tool use), compared with the original base model:

Model Persian PPL ↓ Persian probes ↑
Qwen/Qwen3.5-0.8B (base) 13.144 8/14 (57%)
This model 10.517 11/14 (79%)

Quantization quality (held-out Persian text, context 512, 30 chunks; lower is better):

File PPL
Q8_0 4.262
Q5_K_M 4.320
Q4_K_M 4.381

These are internal results, not standard public benchmarks; the probe set is small.

How it was built

Full-parameter fine-tuning on 2× NVIDIA T4 (DDP), AdamW 8-bit, cosine schedule, assistant-token loss, effective batch size 8, max length 1,536 tokens.

  1. Persian chat & instruction tuning (Stage 2, ~30.6k examples): curated mix of Persian SFT and QA data (Maux, Persian QA, general knowledge, ParsiNLU entailment, Persian math and reasoning, Persian-English thinking, Matina, ParsMap, Aya Persian), plus a small slice of SlimOrca to preserve English. LR 3e-5.
  2. Tool calling & abstention (Stage 3, ~7.5k examples): xLAM / APIGen and Hermes function-calling data, procedurally varied Persian tool trajectories (weather, loan installments, inventory search, calendar reminders, Toman currency conversion), negative examples that teach the model not to call irrelevant tools, and a Persian chat replay buffer. LR 1.5e-5.

Continued pretraining on raw Persian web text was tested and dropped, since it lowered downstream quality at this model size.

Limitations

  • A 0.8B model: good for chat, drafting, simple Q&A and lightweight agents, but it makes factual mistakes and can hallucinate, especially at high temperature. Verify important answers.
  • Trained for direct (non-thinking) answers; forcing thinking mode gives long, unhelpful reasoning.
  • Trained on sequences up to 1,536 tokens; very long conversations or large tool schemas may degrade quality.
  • Most tool-calling training data is English; Persian tool use works but is less robust than Persian chat.
  • Not intended for medical, legal or financial advice.

Citation

@misc{beigi2026qwen35persianagent,
  title        = {Qwen3.5-0.8B Persian Agent},
  author       = {Beigi, Mohammad},
  year         = {2026},
  howpublished = {\url{https://huggingface.co/MohammadBeigi/Qwen3.5-0.8B-Persian-Agent}}
}

License

Released under Apache 2.0, inherited from Qwen/Qwen3.5-0.8B. Training datasets keep their own licenses.

Contact

Mohammad Beigi Email: robamad1396@gmail.com Hugging Face: @MohammadBeigi

If this model is useful to you, please ⭐ like the repo. Feedback, bug reports and ideas are welcome in the Community tab.

Downloads last month
420
Safetensors
Model size
0.8B params
Tensor type
F16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for MohammadBeigi/Qwen3.5-0.8B-Persian-Agent

Finetuned
(1,105)
this model
Quantizations
1 model

Datasets used to train MohammadBeigi/Qwen3.5-0.8B-Persian-Agent