- Haman Persian Article Graph-LLM 125M
- Model at a glance
- About the Model and Developer
- Architecture and Technical Specifications
- Installation and Download
- Command-Line Inference
- Python API
- Generation Settings and Graph Memory
- Training Data and Method
- Evaluation
- Hardware Requirements
- Repository Files
- Continuing Training
- Intended Uses
- Limitations and Out-of-Scope Uses
- License and Attribution
- Citation
- Company and Links
- Model at a glance
Haman Persian Article Graph-LLM 125M
English | فارسی
We developed Haman Persian Article Graph-LLM 125M at Aria Haman Mehr Parseh Knowledge-Based Software Company as the first Iranian LLM whose model architecture was designed and implemented in Iran for structured Persian article generation. In this model, we combine a Transformer language model with a GCN over a corpus-level lexical graph and use context-gated graph-token fusion. We trained the model weights from random initialization and built the tokenizer, graph, and training pipeline for Persian; this release is not instruction-tuned or intended as a factual authority.
Model at a glance
| Item | Value |
|---|---|
| Model family | Haman |
| Developer | Aria Haman Mehr Parseh Knowledge-Based Software Company |
| Primary language | Persian (Farsi) |
| Task | Causal next-token prediction and structured article generation |
| Unique parameters | 124,978,951 |
| Context length | 256 tokens |
| Architecture | 10-layer Transformer + GCN |
| Graph | 31,995 nodes and 68,759 edges |
| Training dataset | Haman Persian Wikipedia Articles 186K — 176,611 training and 9,295 validation records |
| Training | 2 epochs; approximately 396.9M token exposures including augmentation |
| Validation | Loss 3.4645; perplexity 31.9595; UNK rate 5.36% |
| Runtime | rakhshai-graph-nlp 2.2.1; PyTorch |
| License | Haman Model License 1.0 |
About the Model and Developer
This is the first released model in the Haman model family. We developed it at Aria Haman Mehr Parseh Knowledge-Based Software Company using the Graph-LM architecture and Persian workflow implemented in the public Rakhshai Graph-based NLP project. This public project covers Persian normalization, tokenization, corpus preparation, graph construction, model architecture, training, evaluation, and inference.
We trained the checkpoint weights from random initialization. We did not use an external pretrained language model, distillation, pretrained embeddings, or LLM-generated synthetic data. We also produced the corpus graph and word-level tokenizer for the same Persian training workflow.
The technical basis for describing this release as “the first Iranian LLM whose model architecture was designed and implemented in Iran” is the combination of these properties in one published checkpoint:
- model-level architecture designed and implemented in Iran: a decoder-only causal Transformer coupled to a GCN encoder through context-gated graph-token fusion at the model input;
- 124,978,951 unique parameters trained from random initialization, without an external base language model, distillation, pretrained embeddings, or LLM-generated synthetic data;
- a 32,000-token Persian word-level tokenizer and a Persian corpus graph with 31,995 nodes and co-occurrence and stemming relations, built specifically for this model; and
- an end-to-end normalization, corpus-preparation, graph-construction, training, evaluation, and inference stack implemented in the public Iranian Rakhshai project, with checkpoint configurations, metrics, and artifacts released alongside the model.
In this definition, “Iranian-produced architecture” refers to the model-level design, composition, and implementation—and to the training stack—produced in Iran; it does not claim that standard building blocks such as the Transformer or GCN were invented in Iran. “First” is scoped to this combined set of technical and development-origin criteria, not to a claim of quality superiority over every other model.
Our underlying Rakhshai Graph-Based NLP product is certified as a knowledge-based product in Iran under the title “Graph-Based Natural Language Processing Service Library for the Persian Language.” We published the certification announcement and verification details separately; the certification applies to the underlying product, not to this model’s weights.
Architecture and Technical Specifications
| Component | Specification |
|---|---|
| Language-model backbone | Decoder-only causal Transformer |
| Hidden size | 768 |
| Transformer layers | 10 |
| Attention heads | 12 |
| Feed-forward size | 3,072 |
| Positional encoding | RoPE, theta 10,000 |
| Feed-forward block | SwiGLU |
| Normalization | RMSNorm |
| Vocabulary | 32,000-token Persian word-level tokenizer |
| Token/LM-head weights | Tied/shared |
| Graph encoder | GCN, hidden size 768 |
| Graph relations | Word co-occurrence and stemming |
| Graph fusion | Context-gated fusion at the input token level |
| Graph scope | Static corpus graph |
| Checkpoint precision | FP32 |
The reported parameter count is based on unique tensor storage. A naive sum over the state dictionary counts the shared token-embedding/LM-head matrix twice and yields 149,554,951; the physical model contains 124,978,951 unique parameters.
Installation and Download
Python 3.10 or newer is required. Install the exact runtime version used to validate this release, then download the model repository:
python -m pip install "rakhshai-graph-nlp @ git+https://github.com/bazpardazesh-org/Rakhshai-Graph-based-NLP.git@2.2.1"
python -m pip install "huggingface_hub>=0.34"
hf download aria-haman/haman-fa-article-graph-llm-125m \
--exclude training_state.pt \
--local-dir ./haman-fa-article-graph-llm-125m
This is a custom Graph-LM checkpoint. It does not load through transformers.AutoModel, AutoModelForCausalLM, or a Transformers pipeline. Use the rakhshai-graph-nlp runtime shown below.
Command-Line Inference
We recommend the following settings as a conservative starting point for this checkpoint. They match the defaults shipped with the package. Use --device cuda only when CUDA is available.
rgnn-cli article-generate \
--model ./haman-fa-article-graph-llm-125m \
--topic "نوروز" \
--audience "عمومی" \
--tone "دانشنامهای" \
--sections 2 \
--min-new-tokens 80 \
--max-new-tokens 320 \
--temperature 0.25 \
--top-k 8 \
--repetition-penalty 1.45 \
--graph-memory off \
--device cpu \
--output-format markdown \
--output-path ./article.md
Set --output-format json and change --output-path to obtain structured JSON. When no output path is provided, the result is printed to standard output.
Python API
This example downloads the repository, automatically selects CPU or CUDA, generates one article, and exposes both Markdown and JSON forms.
from pathlib import Path
import torch
from huggingface_hub import snapshot_download
from rakhshai_graph_nlp.llm.article import (
ArticleGenerationConfig,
generate_persian_article,
)
model_dir = snapshot_download(
repo_id="aria-haman/haman-fa-article-graph-llm-125m",
local_dir="./haman-fa-article-graph-llm-125m",
ignore_patterns=["training_state.pt"],
)
device = "cuda" if torch.cuda.is_available() else "cpu"
article = generate_persian_article(
ArticleGenerationConfig(
model_dir=model_dir,
topic="نوروز",
audience="عمومی",
tone="دانشنامهای",
sections=2,
min_new_tokens=80,
max_new_tokens=320,
temperature=0.25,
top_k=8,
repetition_penalty=1.45,
graph_memory=False,
device=device,
)
)
markdown_text = article.full_markdown
json_text = article.to_json()
Path("article.md").write_text(markdown_text, encoding="utf-8")
Path("article.json").write_text(json_text, encoding="utf-8")
print(markdown_text)
generate_persian_article returns a PersianArticle object with title, introduction, sections, conclusion, full_markdown, metadata, to_dict(), and to_json().
Generation Settings and Graph Memory
For this release, we selected temperature 0.25, top-k 8, repetition penalty 1.45, two sections, 80 minimum new tokens, 320 maximum new tokens, and graph memory off as the defaults. For experimentation, we recommend temperature 0.25–0.40, top-k 8–20, repetition penalty 1.30–1.45, and two or three sections. Lower temperature and top-k values generally reduce drift but do not guarantee factuality.
The checkpoint always loads the trained static corpus graph and GCN when those artifacts are present. The graph_memory option controls an additional prompt-conditioned retrieval path backed by graph_memory.pt; turning it off does not disable the model's trained graph encoder. We keep this additional path off by default because, in our initial local tests, enabling it increased topic drift for some samples. Users can still enable it explicitly with --graph-memory on.
Training Data and Method
We trained the model from scratch on the public Haman Persian Wikipedia Articles 186K dataset, a cleaned and structured Persian Wikipedia corpus that we prepared with the native Rakhshai article workflow. The published splits use the same record counts, validation ratio, and seed recorded for this checkpoint: 176,611 training records and 9,295 validation records, using a 5% validation ratio and seed 42. The tokenizer saw 131,907,224 training tokens and 6,977,645 validation tokens.
The dataset is distributed under Creative Commons Attribution-ShareAlike 4.0. The model weights and model package are released separately under the Haman Model License 1.0.
We trained the model for two epochs on an NVIDIA A100 40GB GPU. Each epoch processed 198,436,671 training-token exposures after augmentation, for approximately 396.9M exposures in total. The main training objective was causal next-token prediction. Contrastive regularization was active separately with weight 0.05; masked-token, edge, neighbor, node-relation, graph-text-alignment, and sentence-graph auxiliary tasks were disabled. Other recorded settings include Adam-style optimization, a peak learning rate of 2e-4, cosine scheduling, 3% warmup, batch size 64, dropout 0.1, and mixed-precision training.
A public Google Colab training notebook documents the released training configuration, public-dataset corpus reconstruction, checkpoint validation, resume procedure, and full-checkpoint packaging workflow. It is a reproducible workflow record, but it does not guarantee bit-for-bit identical weights across different Colab runtimes or GPUs.
Historical source and output paths in the JSON files are retained as training provenance and are not runtime requirements.
Evaluation
Evaluation used the held-out 5% validation split and the checkpoint's own word-level tokenizer.
| Metric | Value |
|---|---|
| Best validation next-token loss | 3.4644704751 |
| Best validation perplexity | 31.9595319229 |
| Validation tokens | 6,977,645 |
| Validation unknown tokens | 374,345 |
| Validation UNK rate | 5.3649% |
| Best epoch | 2 |
Perplexity values are only directly comparable when tokenization and evaluation data are equivalent.
Unedited output excerpt
The following is a short, unedited excerpt from a locally generated candidate. It illustrates current behavior and is not a factual reference:
حفاظت از محیط زیست مقدمه: حفاظت از محیطزیست یا حفاظت از حیات، یک مفهوم عمومی است که در آن، به عنوان مثال، حفاظت از سلامت و حفاظت از طبیعت، به ویژه برای حفاظت از تنوع زیستی، تعریف میشود. بخش 1: محافظت از محیط زیستی این اصطلاح همچنین میتواند به عنوان یک اصطلاح کلی برای حفاظت زیستمحیطی استفاده شود، اما بهطور خاص به معنای حفاظت از گونههای طبیعی و گیاهی است. حفاظت از زیست محیطی (به اختصار)، به حفاظت از اکوسیستمها در برابر تغییرات اقلیمی و سایر عوامل بیماریزا میپردازد.
Hardware Requirements
| Component | Practical minimum | Recommended |
|---|---|---|
| Python | 3.10+ | Version supported by the installed PyTorch build |
| CPU | 64-bit x86_64 or arm64 | 4+ logical cores |
| Available memory | 4 GB free | 8 GB or more system RAM |
| Free storage | 1 GB | 3 GB including the Python environment |
| GPU | Not required | Optional CUDA GPU with 4 GB+ VRAM |
In a measured Darwin arm64 CPU run, resident memory was approximately 1.34 GiB after loading and approximately 2.01 GiB while generating 160 new tokens. Longer contexts and outputs may require more memory.
Repository Files
| File | Purpose |
|---|---|
model.pt |
FP32 model weights |
config.json |
Model architecture |
tokenizer.json |
Persian word-level tokenizer |
graph.pt / graph_config.json |
Static corpus graph and metadata |
graph_memory.pt / graph_memory_config.json |
Optional prompt-conditioned graph memory |
generation_config.json |
Saved generation defaults |
article_llm_config.json |
Training configuration and native-training declaration |
metrics.json |
Training history, data statistics, and evaluation metrics |
checkpoint_manifest.json |
Checkpoint layout |
training_state.pt |
Optimizer state and saved training progress for exact training resumption; not required for inference |
SHA256SUMS |
Integrity hashes for core artifacts |
LICENSE |
Model license |
Continuing Training
Inference does not require training_state.pt, so the inference download examples above exclude it. For exact optimizer-state resumption, use the training_state.pt file included at the repository root. It is approximately 1 GB and contains the optimizer state and saved training progress. Add it to an existing inference-only download with:
hf download aria-haman/haman-fa-article-graph-llm-125m training_state.pt \
--local-dir ./haman-fa-article-graph-llm-125m
To resume, use the same rakhshai-graph-nlp version, retain access to the prepared corpus, and reproduce the architecture and training values in article_llm_config.json. Pass the downloaded checkpoint directory containing model.pt and training_state.pt to --resume-from; review all available options before starting a run:
rgnn-cli article-train --help
Continuing training is a training workflow, not a requirement for generation.
Intended Uses
- Research and reproducibility for Persian graph-enhanced causal language modeling.
- Local experiments with structured Persian article generation.
- Continued pretraining, decoding research, and graph ablations.
- Human-supervised drafting where every output is reviewed and corrected.
Limitations and Out-of-Scope Uses
- This is an early 125M-parameter base checkpoint, not an instruction-tuned chat model.
- The 256-token context limits long-form coherence; long outputs can drift, repeat, or stop incompletely.
- The tokenizer has no byte fallback and its validation UNK rate is 5.36%.
- The model may fabricate dates, names, sources, scientific statements, and historical claims.
- Output must not be treated as verified knowledge or published without human review.
- It is not suitable for autonomous medical, legal, financial, safety-critical, or high-impact decisions.
- Training on Wikipedia-derived text can reproduce biases, uneven coverage, and errors present in the source corpus.
- No dedicated safety alignment, instruction tuning, or comprehensive bias evaluation is included in this release.
License and Attribution
The model weights and model package are released under the Haman Model License 1.0. Commercial use is permitted subject to its terms, including attribution to the model and Aria Haman Mehr Parseh Knowledge-Based Software Company. The source-code project is separately licensed under MIT; the code license does not replace the model license. Users are responsible for the licensing and legal status of their inputs, outputs, and downstream datasets.
Citation
@misc{ariahaman_haman_article_graph_llm_125m_2026,
title = {Haman Persian Article Graph-LLM 125M},
author = {{Aria Haman Mehr Parseh Knowledge-Based Software Company}},
year = {2026},
howpublished = {Hugging Face model repository},
url = {https://huggingface.co/aria-haman/haman-fa-article-graph-llm-125m}
}
Company and Links
- Model: https://huggingface.co/aria-haman/haman-fa-article-graph-llm-125m
- Company: https://ariahaman.ir/en/
- Source project: https://github.com/bazpardazesh-org/Rakhshai-Graph-based-NLP
- Training notebook: Google Colab
- Knowledge-based certification announcement: https://rakhshai.com/news/rakhshai-graph-nlp-daneshbonyan/
- Downloads last month
- 178
