Sibawayh is a skill that makes an AI agent write correct Arabic and check it before answering. This page describes how we measure whether it works, and what the measurements do not show.
كيف نختبر «سيبويه»؟
Sibawayh is a skill that makes an AI agent write correct Arabic and check it before answering. This page describes how we measure whether it works, and what the measurements do not show.
اشرح مفهوم الـ caching في تطبيقات الويب لمدير غير تقني، وبيّن لماذا يجعل الموقع أسرع.
الـ Caching (التخزين المؤقت) يعني أن نحتفظ بنسخة جاهزة من المعلومات التي يكثر طلبها، فنقدّمها مباشرة بدلاً من تحضيرها من جديد في كل مرة.
بدون Caching: كلما طلب زبون قهوة، يذهب الموظف إلى المخزن ويطحن البُن ويغلي الماء.
الـ Caching يحفظ الصفحة الجاهزة بعد أول مرة، فيحصل عليها كل زائر بعده فوراً.
Marked: an English word used in place of the Arabic term, three times in this excerpt. The judge counts each as a register error.
التخزين المؤقت (Caching) هو أن يحتفظ النظام بنسخة جاهزة من المعلومات التي يكثر طلبها، فيقدّمها مباشرة بدلًا من أن يعيد إعدادها من الصفر في كل مرة.
دون تخزين مؤقت: كلما فتح زائر صفحة، يطلبها متصفحه من الخادم (Server)، فيبحث الخادم في قاعدة البيانات ويجمع المحتوى ويبني الصفحة ثم يرسلها.
مع التخزين المؤقت: يبني الخادم الصفحة مرة واحدة ويحفظ نسخة منها، ثم يرسل هذه النسخة الجاهزة إلى الزوار التاليين فورًا.
Nothing marked. The English term appears once, in parentheses after the Arabic one.
This is what the judge sees: one request and two unnamed answers. It does not know which one was written with the skill.
Excerpts from two real answers in the 23 November run of the test. The judge counted errors in both before anyone looked up which was which.
No single test covers a writing skill. The blind comparison measures the whole skill on realistic requests. The other three test parts of it that can be checked without a judge.
| Test | Question | Who decides | Result |
|---|---|---|---|
| Blind comparison | Does an agent make fewer Arabic errors with the skill than without it? | An AI judge from a different model family, three times | 2.26 → 0.07 errors per 100 words, 97% fewer; no over-corrections |
| Over-correction check | Does the checker flag Arabic that is already correct? | Every flag reviewed by hand | 0 false errors in 191 error flags on 806,509 words |
| Recall | What share of real errors does the checker catch? | Human annotators of two public corpora | 52% of all errors in student essays, 41% in news comments |
| Trigger test | Does the skill load for Arabic requests, and stay out of English ones? | Automatic | 20 of 20 |
The checker also has 163 unit tests, one or more for every rule and every bug fixed.
The same agent answers the same requests twice, once with the skill and once without. A judge that cannot tell the two apart counts the errors in each answer.
20 each of emails, social posts, documentation, technical explanations and translations into Arabic. 68 are written in Arabic and 32 in English asking for Arabic. They are in evals/prompts.tsv.
The first 50 were in use while the skill was being developed. The second 50 were written afterwards, and the skill was not changed after it answered them. The results below report the two halves separately.
Claude Code answers every request in a fresh, empty folder. In the skill run the folder holds a copy of the skill; in the baseline run it holds nothing. Both runs have the same tools and ignore the user's own settings, so an installed copy of the skill cannot leak into the baseline.
Each request and its two answers go into one file as Response A and Response B, in random order. The list of which is which stays outside the folder the judge can read.
GPT, run through Codex with read-only access, counts the errors in each response in five categories and says which response reads as more correct and natural. Claude does not grade its own output.
All 100 pairs are judged three times, each time in a new random A/B order, because the judge's counts vary from one reading to the next.
The counts are mapped back to baseline and skill and divided by the number of words. The skill passes only if it meets all three conditions: no over-corrections, at most half the baseline's errors per 100 words, and no category worse than the baseline.
Agreement, number and counted noun, case endings, verb mood. ثلاث مهندسين ← ثلاثة مهندسين
Hamza, ة and ه, ى and ي, tanween, joined or split words. إستخدام ← استخدام
English structures and idioms in Arabic words. تم إنشاء الملف من قبل المستخدم ← أنشأ المستخدم الملف
Dialect in formal text, and English words outside parentheses or code. الـ Caching ← التخزين المؤقت
Latin punctuation in Arabic text, spacing around punctuation, mixed digit systems, lines that start with a Latin word. نعم, ولكن? ← نعم، ولكن؟
A correct form changed into a wrong one. Forms that the Cairo Arabic Language Academy approves, such as يعتبر and حوالي, are not errors, and a skill that "fixes" them fails the test.
The judge's full instructions are in evals/ai_judge.md. It is told not to count an error when it is unsure.
Run on 25 November 2026 with release 0.4.0 of the skill; the answers without the skill are the same as in the 23 November run. In the three judgings the skill's answers had 96% to 98% fewer errors per 100 words (97% on average), no over-corrections, and no category worse than the baseline, so the bar was met each time.
100 pairs; 19,181 words without the skill and 22,344 with it.
| Errors per 100 words | Without | With |
|---|---|---|
| Register | 1.50 | 0.01 |
| Translationese | 0.39 | 0.05 |
| Formatting | 0.24 | 0.00 |
| Grammar | 0.13 | 0.01 |
| Spelling | 0.01 | 0.00 |
| Total | 2.26 | 0.07 |
About two thirds of the baseline's errors are register errors, and most of those are English technical terms written as if they were Arabic words, as in the example at the top of this page. The skill's largest effect is therefore on technical writing. Its remaining errors are mostly translationese: 11 or 12 in 100 answers, depending on the judging.
| Errors per 100 words | Without | With |
|---|---|---|
| Technical explanations | 4.41 | 0.05 |
| Documentation | 1.74 | 0.11 |
| Social posts | 1.72 | 0.06 |
| Translations | 0.93 | 0.13 |
| Emails | 0.31 | 0.01 |
| Errors per 100 words | Without | With | Change |
|---|---|---|---|
| First 50 requests | 2.15 | 0.01 | −99% |
| 50 new requests | 2.37 | 0.12 | −95% |
The skill was tuned on the first 50 requests, where it now makes almost no errors. The 50 new requests are the fairer measure, and there the result is 95% fewer errors, the same as in the 23 November run.
Asked which response reads as more correct and natural, the judge chose the skill's in 92 or 93 of the 100 pairs and the baseline's in 3 or 4. The rest were ties.
Full results: every request, both answers and the judge's counts.
The 23 November run, with release 0.3.0, gave 2.22 → 0.10 errors per 100 words (96% fewer). The answers are generated once per run and vary from run to run, so a difference of this size between two runs is not evidence that one release is better.
Release 0.4.0 adds a classical register (فصحى التراث) that the skill uses only when the request asks for it. We tried it on 20 requests: sermons, letters, a maqama, a counsel and a literary debate. The judge preferred the skill's answer to the answer without the skill in 17 to 19 of the 20 pairs, and to the answer of the previous release in 12 of 20. In a separate check it found no classical wording in the skill's answers to everyday requests.
This is a small trial, judged by an AI model, and it is separate from the comparison above. Method, figures and limits: evals/classical.md.
Full report and earlier runs: evals/full_eval.md.
The skill's first rule is never to flag correct Arabic. To measure that, the checker runs on Arabic that has already been edited: 100 featured articles from Arabic Wikipedia, 806,509 words. Every error it reports is read in context by hand when a rule is added or changed.
Half of the articles were used to tune the rules. The other half were held out and used for no change.
| Set | Words | Error flags | False |
|---|---|---|---|
| 50 articles used for tuning | 416,602 | 88 | 0 |
| 50 held-out articles | 389,907 | 103 | 0 |
The flags were real errors that featured articles still contain, such as إثنين، الإتجاه، شئ، يتسائل، خمسة عشرة سفينة.
Two weaker kinds of finding did less well. In the first review, automatic fixes made 1 wrong change in 278: a Persian letter cited on its own in a table of alphabets, which the rule now leaves alone. Warnings only ask the agent to look again at the context, and some of them are wrong, mostly on proper names and cited letters (the surname حتي, the wrestler بيغ شو).
Details: evals/corpus_check.md.
A checker that never flags anything would pass the test above, so recall is measured twice.
Two public corpora in which annotators corrected every word by hand: ZAEBUC, essays by first-year university students (9,932 words), and QALB-2014, comments on news articles by native speakers (50,309 words). Recall is the share of the words they corrected that a checker finding covers.
| Error type | Student essays | News comments |
|---|---|---|
| و written apart from its word | 98% | 86% |
| Hamza | 68% | 59% |
| ة and ه | 37% | 40% |
| ى and ي | 14% | 40% |
| All error types | 52% | 41% |
"All error types" includes grammar, word choice and punctuation choices that a script cannot judge. The skill leaves those to the agent's own review checklist, so the checker's recall is not the skill's recall. When the checker does catch a single-word error, its suggestion matches the annotators' correction 80% of the time in the essays and 91% in the comments.
A script takes clean lines from the held-out Wikipedia articles, puts one known error into each (for example ، becomes ,, or أ becomes ا), and checks whether the checker finds it. 200 sites per error type.
| Error injected | Caught |
|---|---|
| Space before ،, Persian letters, tatweel | 100% |
| Mixed digit systems | 99% |
| هاذا، لاكن، ذالك | 98% |
| لم، لن، أن before a verb that keeps its ن | 97% |
| Latin comma in Arabic text | 89% |
| ي written ى | 72% |
| Missing hamza | 65% |
| ة written ه | 54% |
| ى written ي | 10% |
The low rows are low on purpose. مدرسه is wrong but عليه is right, and إلي and علي are real words. Telling them apart needs grammar, so the checker flags only the shapes that are wrong in every context and the agent's checklist covers the rest.
Details: evals/benchmarks.md. The two corpora are not redistributed; their licences do not allow it.
A skill that does not load does nothing. Twenty requests check that it loads when Arabic is involved and stays out otherwise:
The requests are in evals/triggers.tsv.
Everything is in the repository and uses only the Python standard library. Generating answers needs the claude command line tool and uses your own usage.
git clone https://github.com/anasAsh/Sibawayh && cd Sibawayh
python3 -m unittest discover -s tests -t . # unit tests
python3 evals/run_triggers.py # trigger test
python3 evals/generate.py --mode baseline # answers without the skill
python3 evals/generate.py --mode skill # answers with it
python3 evals/pair.py --seed 1 judge key.csv # blind A/B pairs; keep key.csv away from the judge
python3 evals/judge_report.py scores.csv key.csv # unblind, totals, pass or fail
python3 evals/fetch_wiki.py --limit 50 # over-correction check
python3 evals/corpus_check.py evals/corpus/wiki
python3 evals/inject.py evals/corpus/wiki # recall with injected errors
Read all 100 requests, both answers to each and the judge's counts on the full results page. Every answer, blind key and score file from the runs on this page is in evals/results/. If you read Arabic natively and want to score a set of pairs, open an issue.