ibnsina-3b

⚠️ ابن‌سینا یک مدل کوچک است برای نوشتن، خلاصه، ترجمه و گفت‌وگو به فارسی — نه منبع اطلاعات درباره‌ی افراد، سیاست یا اخبار. برای مشاوره، پاسخ به سؤال‌های دانشی، حل ریاضی یا نوشتن کد ساخته نشده است؛ برای آن کارها از مدل‌های بزرگ استفاده کنید. کارش تولید متن فارسی، آفلاین و روی دستگاه خودتان است — و ممکن است جمله‌های روان اما نادرست بسازد؛ هر چیز مهم را خودتان راستی‌آزمایی کنید.

⚠️ IbnSina is a small model for writing, summarizing, translating and conversing in Persian — not a source of facts about people, politics, or news. It is not built for advice, knowledge questions, math, or code — use a large model for those. What it is for: offline Persian text generation on your own device. It can produce fluent but wrong sentences — verify anything that matters.

ابن‌سینا ۳B: مدل دوم خانواده‌ی ابن‌سینا، از صفر با فارسی آموزش دیده. این مدل با حدود ۱۰۰ میلیارد توکن — عمدتاً فارسی — پیش‌آموزش دیده و برای گفت‌وگو تنظیم شده است؛ با llama.cpp، ollama و LM Studio روی لپ‌تاپ اجرا می‌شود. وزن‌ها، کد و دستور ساخت آزادند (Apache-2.0). راهنمای فارسی

IbnSina-3B is the second model of the IbnSina family, pretrained from scratch on Persian-first data — most Persian models adapt an English-first base; this one never knew English first. IbnSina-3B (3.0 B parameters, Qwen3-style architecture) was trained on 99.6 B tokens, then instruction-tuned on a 57 k-conversation Persian recipe (sft_v2.1, 2026-09-10). It improves on IbnSina-1.5B on the knowledge benchmarks below. Code, data recipe and weights: github.com/ibnsina-llm · Persian README. Author: Sina Meraji · ORCID 0009-0002-8028-1932 · github.com/sinameraji.

Files

file use
ibnsina-3b-Q4_K_M.gguf laptop (≈1.8 GB)
ibnsina-3b-Q8_0.gguf near-lossless (≈3.2 GB)
ibnsina-3b-bf16.gguf full precision (≈6.0 GB; BF16 — the earlier F16 file overflowed on CUDA and was withdrawn)
Modelfile, system, template, params ollama (identity + scope banner as the default system prompt; a client system message is folded into the first user turn)

Quickstart (Mac / Windows / Linux)

Install ollama for your OS, then:

ollama run ibnsina/ibnsina-3b            # from ollama.com (https://ollama.com/ibnsina/ibnsina-3b)
ollama run hf.co/ibnsina-llm/ibnsina-3b  # or straight from this repo

Or in LM Studio: search ibnsina-llm/ibnsina-3b. For llama.cpp, download a GGUF from this repo: llama-cli -m ibnsina-3b-Q4_K_M.gguf.

Run

llama-cli -m ibnsina-3b-Q4_K_M.gguf                      # llama.cpp
ollama create ibnsina-3b -f Modelfile && ollama run ibnsina-3b

The GGUF carries the chat template. Format: <|user_start|>…<|user_end|><|assistant_start|>…<|assistant_end|>; the runtime adds <|bos|>. A system message is folded into the first user turn.

Model

architecture Qwen3-style (GGUF qwen3): 40 layers, d=2560, 20 heads / 4 KV heads (GQA), QK-norm, SwiGLU 7168, RMSNorm, RoPE, untied head
parameters 3.0 B
context 2048 tokens
tokenizer 32,768-token byte-level BPE (v2_32k_llama), Persian-dominant training sample, Llama-3 pre-tokenizer regex (llama-bpe) — shared with IbnSina-1.5B
pretraining 99.6 B tokens (≈2 epochs over 48 B unique tokens), 190,000 steps × 524k tokens, bf16, Muon + AdamW (nanochat loop), 8×H100
fine-tuning sft_v2.1: the 51 k judged sft_v2 conversations (17 categories) + 4.5 k synthetic entailment / paraphrase / strict-answer-format rows + the canonical identity set (×12, half with the system prompt folded in), plus 50 k multiple-choice auxiliary examples

Tokenizer efficiency on held-out Persian: 1.29 tokens/word vs 1.73 (Qwen3.5) and 1.64 (Gemma 3).

Data

The IbnSina-1.5B pretraining mix (Persian web from CulturaX, mC4 and FineWeb-2, classifier-filtered; English educational text; code; math and Iranian school textbooks; Persian literature; Wikipedia; fa–en parallel text) plus 2.1 B tokens of judged synthetic Persian (synthetic-persian-v1). Only sources whose licences permit an Apache-2.0 release are included; the per-source licence table and the mix manifest are in the GitHub repo.

Evaluation

PersianMedQA — IbnSina vs the 2026 frontier and other small models (frontier rows as of 2026-08-30; identical zero-shot protocol)

Log-likelihood multiple-choice scoring, identical protocol and harness for both models.

task IbnSina-3B (v2.1, this release) IbnSina-3B (v2, 2026-09-09) IbnSina-1.5B random
ParsiNLU-MC 32.4 % 34.6 % 31.8 % 25 %
ParsiNLU-MC / common knowledge 44.6 % 46.3 % 25 %
ParsiNLU-MC / literature 28.9 % 30.6 % 25 %
ParsiNLU-MC / math and logic 23.7 % 26.9 % 25 %
PersianMedQA (5,235 questions) 30.5 % 30.9 % 26.8 % 25 %
ParsiNLU-Entailment 39.9 % 29.9 % 33.7 % 33 %
ParsiNLU-QQP 52.2 % 48.3 % 50.7 % 50 %

Small-model caveat: v2.1 lifts entailment clearly above chance (+10 points over v2) and paraphrase detection slightly (+3.9), at the cost of about 2 points on ParsiNLU-MC (n = 1,050, roughly 1.5 standard errors) and none on PersianMedQA (n = 5,235). Both rows are shown so the trade is visible. Read the classification rows as properties of this checkpoint, not of the recipe: a second training run of the same v2.1 recipe (same data, base checkpoint and token batch; single A100, micro-batch 2) did not reproduce the gain — entailment 30.0 %, QQP 45.8 %, ParsiNLU-MC 31.0 %, PersianMedQA 29.9 % — i.e. it collapsed back to near-constant answers, while the shipped checkpoint follows the entailment/contradiction labels even when the letter mapping is reversed (40.2 % vs 40.4 %). The knowledge cost of the v2.1 mix (about 2–4 points on ParsiNLU-MC, under 1 point on PersianMedQA) appears in both runs. The second run is not published. Treat all of these as baselines, not capabilities. In free-form use the model sometimes ignores strict output-format instructions (for example "answer with the option number only") and answers in a sentence instead, and it can state wrong figures with confidence.

A family technical report (IbnSina-1.5B / 3B / 30B: recipe, data, scaling, evaluation alongside the 2026 frontier on Persian exam benchmarks such as PersianMedQA) is coming after the 30B release later this month.

Changelog

  • v2.1 (2026-09-10) — SFT revised: a diagnostic on v2 showed the entailment/paraphrase scores were a genuine gap (near-constant answers following a label prior; not a scoring artifact), so 4.5 k synthetic NLI / paraphrase / strict-format rows and 12× identity rows were added to the SFT mix (no pretraining change, no benchmark data used — ParsiNLU is evaluation-only). Result: entailment 29.9 → 39.9 %, QQP 48.3 → 52.2 %, PersianMedQA 30.9 → 30.5 %, ParsiNLU-MC 34.6 → 32.4 %; held-out SFT bits-per-byte 0.2499 → 0.2486. ibnsina-3b-f16.gguf withdrawn (FP16 activation overflow on CUDA in llama.cpp produced junk output; CPU and Q8_0/Q4_K_M were unaffected) and replaced by ibnsina-3b-bf16.gguf.
  • 2026-09-09 20:45 JST — published on ollama.com as ibnsina/ibnsina-3b (v2.1 build, same Q4_K_M layer as this repo, system/template/params included).
  • v2.1 note (2026-09-09, later the same day) — a second training run of the v2.1 recipe did not reproduce the entailment/QQP gain (see Evaluation); the shipped weights are unchanged, the caveat was strengthened.
  • 2026-09-09 (identity fix)system, template, params and the Modelfile were added/corrected: the original Modelfile had no system prompt and its template dropped client system messages, so the model could invent a persona. Verified on clean ollama pull.
  • v2 (2026-09-09) — first public release.

Intended use and limitations

Persian conversation, writing, summarisation, translation and everyday questions. Not for medical, legal or financial decisions; it states general information and points to professionals. It has no memory between conversations and knowledge frozen at training time, and makes factual mistakes more often than large models — verify anything that matters. No built-in internet access: it can emit calculator, date-conversion and search tool calls in nanochat's format; these work only in a host that executes them (the reference runtime in the GitHub repo does; llama.cpp and ollama do not).

Behaviour policy · سیاست رفتاری

Trained to answer in natural register-matching Persian, to say «نمی‌دانم» rather than invent, and to be symmetrically respectful: it declines to mock or insult any person or group — political or religious figures, ethnicities, genders, nationalities, on every side — while answering factual and theological questions normally, recounting documented history honestly, and presenting contested political questions as "supporters say / critics say" without a verdict.

این مدل آموزش دیده است که به فارسیِ طبیعی و هم‌سطح با لحن کاربر پاسخ دهد، به‌جای ساختن پاسخ بگوید «نمی‌دانم»، و احترام را متقارن رعایت کند: درخواست تمسخر یا توهین به هیچ شخص یا گروهی را نمی‌پذیرد — چهره‌های سیاسی و مذهبی، اقوام، جنسیت‌ها و ملیت‌ها، از هر طرف که باشند — اما به پرسش‌های واقعی و الهیاتی عادی پاسخ می‌دهد، تاریخ مستند را صادقانه روایت می‌کند، و پرسش‌های سیاسیِ مورد مناقشه را به شکل «موافقان می‌گویند / منتقدان می‌گویند» ارائه می‌کند، بی‌آنکه حکم بدهد. در موضوعات پزشکی و حقوقی اطلاعات عمومی می‌دهد و برای تصمیم‌ها به متخصص ارجاع می‌دهد؛ در شرایط بحرانی کوتاه و گرم پاسخ می‌دهد و شماره‌های امداد ایران را می‌گوید.

Licence

Apache-2.0 for weights and code. Training-data licences are per source (see repo). Included: public-domain, permissive and share-alike sources, plus the synthetic-persian-v1 set (Apache-2.0). Curated material without an explicit open licence (official school textbooks, curator-provided volumes) and one research-use parallel corpus (OPUS OpenSubtitles) were admitted per source by curator decision on 2026-08-28 and are recorded as such; NC/ND-licensed sources were excluded. No source text is redistributed.

Acknowledgments

Built with nanochat (Andrej Karpathy) and the Muon optimizer; distributed via llama.cpp. Data methods from datatrove and the FineWeb-Edu rubric; Persian poetry from Ganjoor. Persian NLP we build on or evaluate against: ParsiNLU, FarsInstruct, PerCoR, TARAZ, the EMNLP 2025 taarof study; and the Persian models that came before — PersianMind, Dorna, gpt2-fa. The pipeline, training runs and evaluations were executed by AI coding agents (Claude Code) under Sina Meraji's direction.

Citation

@software{ibnsina2026, title={IbnSina: an open Persian-first language model family}, author={Meraji, Sina}, year={2026}, url={https://github.com/ibnsina-llm}, note={ORCID 0009-0002-8028-1932}}
Downloads last month
129
GGUF
Model size
3B params
Architecture
qwen3
Hardware compatibility
Log In to add your hardware

4-bit

8-bit

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Papers for ibnsina-llm/ibnsina-3b