Relationships, not sequence alone
Bring graph structure into the pipeline so connections among words, documents, topics, and linguistic relations become part of the model's representation.
At Haman Labs, we build infrastructure that makes relationships among Persian words, sentences, and documents part of a model's intelligence—from raw text to graphs, language models, and extensible products—so our technology can understand Persian more deeply.
In simple terms, the platform takes Persian text and provides one path for building graphs, training and running models, analyzing or generating text, and connecting the result to a product—so Persian can be understood more deeply and Persian speakers can receive more accurate outputs.
Normalize characters, clean and tokenize text, and prepare a corpus for processing and training.
Represent word and document relations, text similarity, syntax, and semantics as simple or multi-relation graphs.
Learn from graph structure and relations with models such as GCN, GraphSAGE, GAT, and RGCN.
Bring graph information and Transformer tokens together so the model can use both sequence and relation when understanding or generating text.
Follow one reproducible path from data preparation and training to evaluation, prediction, inference, and text generation.
Classify Persian text and extract keywords, concepts, entities, and semantic signals.
Rank important sentences with graph evidence, create extractive summaries, and recommend nearby documents.
Store knowledge in nodes and relations, retrieve relevant context, and expose the evidence behind a result.
The lower-level Graph-LM engine generates text, while the current llm.article workflow prepares, trains, audits, and generates structured Persian articles.
Use the Python API, CLI, Web UI, or MCP from applications, development environments, and chatbots; MCP project resources remain controlled and read-only.
The current RGN release focuses on Persian text processing, modeling and generation, linguistic graph construction, and product integration.
We are not building just another text-processing tool. We are building open infrastructure that helps models represent the structure, context, and relationships of Persian more effectively—and gives Iranian researchers and builders a foundation they can inspect, extend, and own.
“From deeper understanding of Persian words and sentences to native Iranian language models—knowledge rooted in our language and built to work with the world.”
Bring graph structure into the pipeline so connections among words, documents, topics, and linguistic relations become part of the model's representation.
Build the tokenizer, graph, training engine, evaluation, and inference stack for Persian—not a thin wrapper around an external ready-made model.
Shorten the route from research to product for developers, researchers, and teams shaping the future of Persian artificial intelligence.
Rakhshai Graph-based NLP (RGN) is our open-source infrastructure for turning raw Persian data into multi-relation graphs, graph models, and deployable language workflows. It brings data preparation, graph construction, training, evaluation, inference, and external-tool integration into one coherent path.
The lower layer for tokenization, graph building, graph encoders, graph-token fusion, training, graph memory, and text generation.
The high-level layer for task-specific native models, beginning with llm.article for preparing, auditing, training, and generating structured Persian articles.
Build co-occurrence, word-document, document-similarity, dependency, semantic, and multi-relation graphs to represent connections hidden by linear text.
Graph encoders alongside a causal Transformer and a learnable gate, allowing the model to decide how strongly text and graph representations should contribute in context.
Persian text classification, semantic analysis, graph-signal extraction, and practical training, evaluation, and prediction paths.
Graph-evidence sentence ranking, extractive summarization, and related-content retrieval built around textual structure.
A stable Python API, command-line tooling, a Persian RTL web interface, and structured outputs for integration into products.
Clone the repository, create a virtual environment, and install the machine-learning base. The final command runs a built-in CPU example that checks installation, word-document graph construction, and the GCN model.
This path exercises the general project and engine capabilities. The Haman article model in the next section runs through the higher-level llm.article workflow.
git clone https://github.com/bazpardazesh-org/Rakhshai-Graph-based-NLP.git
cd Rakhshai-Graph-based-NLP
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[ml]"
# Built-in CPU smoke example
rgnn-cli --model gcn --device cpu
A native language model for structured article generation—and a working demonstration of how Rakhshai Graph-based NLP (RGN) moves from architecture research to a reproducible training and generation workflow.
At Aria Haman Mehr Parseh, we developed this model for structured Persian article generation. It takes a topic, audience, tone, and section count, then returns an article in Markdown or JSON.
The first Iranian LLM with an Iranian-produced architecture
The architecture combines a decoder-only Transformer with a corpus-level lexical GCN and context-gated graph-token fusion. Its weights were trained from random initialization, while the tokenizer, graph, and training pipeline were built for Persian.
Download the published weights from Hugging Face, then provide a topic, audience, tone, and section count to generate a structured article.
Run this model with article-generate. The generic generate command belongs to the lower-level rakhshai_graph_nlp.lm engine.
python -m pip install -e .
python -m pip install huggingface_hub
python -c 'from huggingface_hub import snapshot_download; snapshot_download(repo_id="aria-haman/haman-fa-article-graph-llm-125m", local_dir="models/haman-fa-article-graph-llm-125m")'
rgnn-cli article-generate \
--model models/haman-fa-article-graph-llm-125m \
--topic "آینده هوش مصنوعی در آموزش فارسی" \
--audience "دانشجویان" \
--tone "تحلیلی" \
--sections 4 \
--max-new-tokens 700 \
--output-format markdown \
--output-path haman-article.md
As the required compute infrastructure becomes available, we plan to add more practical and varied task-focused language models to this foundation soon.
Haman Persian Wikipedia Articles 186K makes the article model's data path inspectable and reproducible—from downloading records to preparing input for the article workflow.
Load the data with the datasets library and export it as JSONL. Then article-prepare converts the title and text records through wikipedia_prompt into corpus, training, and validation files.
Outputs include corpus.txt, train.txt, validation.txt, accepted and rejected records, and manifest.json.
python -m pip install -e ".[data]"
mkdir -p data
python - <<'PY'
from datasets import load_dataset
dataset = load_dataset(
"aria-haman/haman-fa-wikipedia-articles-186k",
split="train",
)
print(dataset.column_names)
dataset.to_json(
"data/haman-fa-wikipedia-articles-186k.jsonl",
force_ascii=False,
)
PY
rgnn-cli article-prepare \
--input data/haman-fa-wikipedia-articles-186k.jsonl \
--output-dir runs/haman-dataset-prepared \
--input-format jsonl \
--training-format wikipedia_prompt \
--min-body-chars 400 \
--validation-ratio 0.1
The MCP integration is a controlled, standards-based adapter around the Rakhshai Graph-based NLP (RGN) core—not a replacement architecture. It lets AI agents, IDEs, chatbots, and automated workflows use Persian graph intelligence.
In a live API evaluation, the same poem and question were sent to GPT-5.4 twice: once directly and once with RGN graph evidence supplied through MCP. The evidence-assisted response used four times as many relevant evidence signals in the automatic metric and received a 19% higher judged score.
در آینه، سایهام از من قدیمیتر بود
و نامم از دهانِ پنجره به باران میریخت
چراغی که خوابِ خاکستر میدید
راه را به پای گمشدهام نشان نمیداد
رود از کنار من گذشت
اما تشنگی در مشتهایم لانه کرده بود
گفتم: کدام سو خانه است؟
باد، کلیدی زنگزده را در سکوت چرخاند
Persian poetry is denser than everyday prose in symbolism, implicit meaning, and long-range relationships among images. This sample connects mirror, shadow, name, lamp, river, thirst, home, and key, so recognizing isolated words is not enough—the model must follow and explain the relationships among them.
This is a single-sample evaluation. It is useful evidence, but it does not replace broader testing across a diverse poetry benchmark.
Read the complete reproducible evaluation reportInstead of producing one isolated answer, an AI agent can break a goal into steps, call the right tools, inspect evidence, and hand the result to the next system. That makes agents a useful pattern for research, coding, support, document analysis, and workflow automation.
Through MCP, RGN gives these agents controlled access to Persian analysis, graph construction, Graph Memory, and explainability.
Persian input becomes graph evidence, relevant memory, and explainable context, while project resources remain bounded to approved, read-only paths.
Rakhshai Graph-based NLP (RGN) is not an endpoint. It is a foundation for models and products that understand Persian more deeply while keeping their technical knowledge open to the community that builds them.
Normalization and tokenization through multi-relation graphs, graph neural models, classification, summarization, and text generation.
Task-specific models trained on Persian corpora, with the ability to measure the real contribution of graph components under a native recipe.
Expand datasets, evaluation metrics, and disaggregated reports to compare models, measure output quality, and quantify the real contribution of graph components.

Haman Labs and Rakhshai Graph-based NLP (RGN) are part of our long-term path toward Persian-centered technology, AI infrastructure, and extensible knowledge tools. For us, native technology begins with Iran's language, culture, and data while remaining interoperable with open standards and global tools.
The “Graph-Based Natural Language Processing Service Library” based on Rakhshai Graph-based NLP (RGN) has received knowledge-based product certification in Iran.
This project has been researched, funded, and developed by the private sector. Our ultimate aim is not technology alone: we want AI to serve peace, friendship, and dialogue—and to reveal the expressive, semantic, and knowledge-bearing power of Persian in the age of artificial intelligence.
Rakhshai Graph-based NLP (RGN) is released under the MIT License. Its architecture, command-line tools, Python API, documentation, and model-building workflows are available in the project repository.