Persian GPT - 110M parameters, trained from scratch
A decoder-only transformer language model trained entirely from scratch on Persian Wikipedia text. No pretrained weights, no pretrained tokenizer, no distillation — the model, the tokenizer, and the training corpus were all built for this project.
Model summary
| Property | Value |
|---|---|
| Parameters | 110.4M |
| Architecture | Decoder-only transformer (GPT-style) |
| Layers | 12 |
| Hidden size | 768 |
| Attention heads | 12 |
| FFN size | 3072 |
| Context length | 1024 |
| Vocabulary | 32,000 (BPE, trained from scratch) |
| Positional encoding | Learned absolute |
| Normalization | Pre-LayerNorm |
| Activation | GELU |
| Weight tying | Yes |
| Precision | fp16 |
Evaluation
| Model | Test perplexity |
|---|---|
| Unigram (add-1) | 1590.26 |
| 5-gram (interpolated) | 171.60 |
| This model | 14.52 |
11.8x improvement over the 5-gram baseline. Best val loss: 2.6391. Test loss: 2.6756.
Training details
- Corpus: Persian Wikipedia (cleaned) — 855,724 documents, 244M tokens
- Tokenizer: 32,000-token BPE trained from scratch, ZWNJ preserved
- Hardware: Google Colab Pro, NVIDIA A100 80GB
- Optimizer: AdamW (beta1=0.9, beta2=0.95, weight decay 0.1)
- LR schedule: Linear warmup (500 steps) + cosine decay to 10% of peak
- Peak LR: 3e-4
- Effective batch: 64 (32 x 2 accumulation)
- Epochs: 2 (7,450 optimizer steps)
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"aradmanamnaoon/persian-lm-from-scratch",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
"aradmanamnaoon/persian-lm-from-scratch",
trust_remote_code=True,
)
Limitations
- Register: trained only on Wikipedia — produces encyclopedic prose, not conversational Persian.
- Factual accuracy: no grounding mechanism. Do not use for factual QA.
- Scale: 244M tokens for 110M params. Larger models will outperform this one.
- License: inherits CC-BY-SA-3.0 from the training data.
The safetensors file is updated and it is a slightly better version
Citation
@misc{persian_gpt_110m, title = {Persian GPT - 110M parameters, trained from scratch}, author = {Arad Manamnaoon}, year = {2026}, url = {https://huggingface.co/aradmanamnaoon/persian-lm-from-scratch} }