Skip to main content

ParsBench

ParsBench provides toolkits for benchmarking Large Language Models (LLMs) based on the Persian language. It includes various tasks for evaluating LLMs on different topics, benchmarking tools to compare multiple models and rank them, and an easy, fully customizable API for developers to create custom models, tasks, scores, and benchmarks.

Key Features

  • Variety of Tasks: Evaluate LLMs across various topics.
  • Benchmarking Tools: Compare and rank multiple models.
  • Customizable API: Create custom models, tasks, scores, and benchmarks with ease.

Evaluating your AI app (new)

Building a Persian chatbot or agent with the OpenAI SDK, OpenAI Agents SDK, LangGraph, Pydantic AI, Agno, or CrewAI? ParsBench now evaluates your app, not just models — tool-call matching across Jalali/Gregorian calendars, digit scripts and rial/toman amounts, Persian judge rubrics, a Persian user simulator, and pytest/CI integration:

from parsbench.appeval import AppEvaluator, Golden, ToolCall

evaluator = AppEvaluator(goldens=[
    Golden(input="بلیط تهران-مشهد برای ۵ مهر می‌خوام",
           tools=[ToolCall("search_flights", date="2026-09-27")],
           contains=["250 هزار تومان"])])
print(evaluator.evaluate(my_bot))

See runnable examples for every major framework in examples/.

  • See your runsparsbench view opens a local viewer: live progress, traces, simulation replays, diffs, exports, and charts. No extra dependencies, nothing to configure.

parsbench view

Motivation

I was trying to fine-tune an open-source LLM for the Persian language. I needed some evaluation to test the performance and utility of my LLM. It leads me to research and find this paper. It's great work that they prepared some datasets and evaluation methods to test on ChatGPT. They even shared their code in this repository.

So, I thought that I should build a handy framework that includes various tasks and datasets for evaluating LLMs based on the Persian language. I used some parts of their work (Datasets, Metrics, Basic prompt templates) in this library.

Installation

Requires Python ≥ 3.12. ParsBench 0.2.x targets current library versions (transformers 5, datasets 5, numpy 2), which need Python 3.12+. If you're on Python 3.10/3.11, pin the previous release: pip install "parsbench==0.1.7".

Install ParsBench using pip:

pip install parsbench

The Persian Math task additionally needs the Math Equivalence package, installed manually:

pip install git+https://github.com/hendrycks/math.git

Usage

Evaluating a PreTrained Model

Load the pre-trained model and tokenizer from the HuggingFace and then, evaluate the model using the PersianMath task:

from transformers import AutoModelForCausalLM, AutoTokenizer

from parsbench.models import PreTrainedTransformerModel
from parsbench.tasks import PersianMath

model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen2-72B-Instruct",
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-72B-Instruct")

tf_model = PreTrainedTransformerModel(model=model, tokenizer=tokenizer)

with PersianMath() as task:
    results = task.evaluate(tf_model)

Benchmarking Multiple Models with Multiple Tasks

For example, we run our local models using Ollama:

ollama run qwen2
ollama run aya

Then we benchmark those models using the ParsBench.

from parsbench.benchmarks import CustomBenchmark
from parsbench.models import OpenAIModel
from parsbench.tasks import ParsiNLUMultipleChoice, PersianMath, ParsiNLUReadingComprehension

qwen2_model = OpenAIModel(
    api_base_url="http://localhost:11434/v1/",
    api_secret_key="ollama",
    model="qwen2:latest",
)
aya_model = OpenAIModel(
    api_base_url="http://localhost:11434/v1/",
    api_secret_key="ollama",
    model="aya:latest",
)

benchmark = CustomBenchmark(
    models=[qwen2_model, aya_model],
    tasks=[
        ParsiNLUMultipleChoice,
        ParsiNLUReadingComprehension,
        PersianMath,
    ],
)
result = benchmark.run(
    prompt_lang="fa",
    prompt_shots=[0, 3],
    n_first=100,
    sort_by_score=True,
)
result.show_radar_plot()

Benchmark Bar Plot

Available Tasks

Task Name Score Name Dataset
ParsiNLU Sentiment Analysis Exact Match (F1) ParsiNLU
ParsiNLU Entailment Exact Match (F1) ParsiNLU
ParsiNLU Machine Translation En -> Fa Bleu ParsiNLU
ParsiNLU Machine Translation Fa -> En Bleu ParsiNLU
ParsiNLU Multiple Choice Exact Match (Accuracy) ParsiNLU
ParsiNLU Reading Comprehension Common Tokens (F1) ParsiNLU
Persian NER NER Exact Match (F1) PersianNER
Persian Math Math Equivalence (Accuracy) Source
ConjNLI Entailment Exact Match (F1) Source
Persian MMLU (Khayyam Challenge) Exact Match (Accuracy) Khayyam Challenge
FarsTail Entailment Exact Match (F1) FarsTail
Persian News Summary Rouge PNSummary
XL-Sum Rouge XLSum

You can import the class of above tasks from parsbench.tasks and use it for evaluating your model.

Example Notebooks

  • Benchmark Aya models: aya
  • Benchmark Ava models: ava
  • Benchmark Dorna models: dorna
  • Benchmark MaralGPT models: maralgpt

Sponsors

Here are the names of companies/people who helped us to keep maintaining this project. If you want to donate this project, see this page.

  • AvalAI: They gave us free OpenAI API credit several times in their "AvalAward" program. It helped us for doing R&D and benchmarking GPT models.
  • Basalam: They voluntarily helped us to run the benchmarks on open-weight models and build the ParsBench Leaderboard.

Contributing

Contributions are welcome! Please refer to the contribution guidelines for more information on how to contribute.

Citation

If you use ParsBench in your research, please cite it as follows:

@software{parsbench2025,
  author = {Shahriar Shariati Motlagh},
  title = {ParsBench: A Toolkit for Benchmarking Persian Language Models},
  url = {https://github.com/ParsBench/ParsBench},
  year = {2025},
}

Or in text format:

Shariati Motlagh, S. (2025). ParsBench: A Toolkit for Benchmarking Persian Language Models. GitHub repository: https://github.com/ParsBench/ParsBench

License

ParsBench is distributed under the Apache-2.0 license.

Contact Information

For support or questions, please contact: shahriarshm81@gmail.com Feel free to let me know if there are any additional details or changes you'd like to make!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parsbench-0.3.0.tar.gz (215.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parsbench-0.3.0-py3-none-any.whl (254.0 kB view details)

Uploaded Python 3

File details

Details for the file parsbench-0.3.0.tar.gz.

File metadata

  • Download URL: parsbench-0.3.0.tar.gz
  • Upload date:
  • Size: 215.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/25.5.0

File hashes

Hashes for parsbench-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ab08045e0378d30a2bfa411cae8ab6824717b278edd88d84e7632fdf66ea9ecc
MD5 6f0813d404ae096f2d3f30ac564adfef
BLAKE2b-256 76c9cd60660ee5cec9e6b0f6a1078fdfbea12f5bf0189bea3d9cac4b3e4aeb86

See more details on using hashes here.

File details

Details for the file parsbench-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: parsbench-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 254.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/25.5.0

File hashes

Hashes for parsbench-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec6c874fe938c9c07b6d363fbbe89340473fd964c4dbf0f9057f9a531de30bed
MD5 7d2107f692116c025ada6a1f63ecbd52
BLAKE2b-256 003bc9e4a0cda10c9b14ea378a083e1e14295cfad39332e3b75729695e83e787

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page