aiamourad/AdabNER

Python

0

10 commits

updated Jun 30, 2026

See the code

README

AdabNER: Arabic Digital Archive Books with Nested Entity Recognition

Paper Dataset Model Code License


At a Glance

BooksGenresTokensEntity mentionsEntity typesNestedIAA $\kappa$
13810876K78,5302118.96%0.938

Abstract

Most studies on Arabic Named Entity Recognition (NER) have focused on news texts and social media posts, while the large and rich corpus of literary Arabic books has been underrepresented. We introduce AdabNER, the first large-scale nested NER dataset for Modern Standard Arabic (MSA) literary texts, comprising the first 6,000 words annotated from each of 138 books spanning ten literary genres, including history, biography, literary criticism, and travel literature, and covering works from the 1880s to the 2020s. The corpus comprises about 876K tokens, manually annotated using a nested 21 entity tag annotation scheme, yielding 78,530 entity mentions, 18.96% of which are nested. We fine-tuned five pre-trained Arabic BERT encoders in two settings: stratified and leave-book-out, achieving F1 scores of 0.86 and 0.83 with AraBERTv2, respectively. We also evaluated five large language models through few-shot in-context learning, including open-source models and the closed-source Gemini 3 Pro, with Gemini 3 Pro achieving the highest LLM F1 score of 0.59. Supervised results degraded under out-of-domain evaluation; however, joint multi-domain training reduced this gap to less than a 1% F1 loss, demonstrating that domain-diverse training data is key to robust Arabic NER, though broader validation beyond the experiments reported is needed. AdabNER and its annotation guidelines are publicly available at https://doi.org/10.5281/zenodo.19468385.


Dataset

The dataset is currently undergoing final processing and will be released soon. For non-commercial research use only — see License.

AdabNER corpus + guidelinesdoi.org/10.5281/zenodo.19468385
Best model (AraBERTv2) — coming soonhuggingface.co/aiamourad/AdabNER
Wojood (OOD experiments)sina.birzeit.edu/wojood

Place splits under data/adabner/ and data/wojood/ before running experiments.


Corpus

Construction

SourceHindawi Library digital collection
Sampling1 book per genre per decade; first 6,000 words after removing front matter
Taxonomy18 OntoNotes types + OCC / CURR / UNIT → 21 types
Nesting frameworkWojood & ACE nested annotation framework

Genres

Biographies · Geography · History · Literary Criticism · Literature · Novels · Philosophy · Politics · Social Sciences · Travel Literature

Statistics

Books138 (1 per genre per decade)
Sentences26,162 · ~189 per book · mean 33.5 words
Tokens~876K
Entity mentions78,530
Nested entities14,082 (18.96%)
Max nesting depth3
Same-type nesting<1% (handled with B-ORG, B-ORG_2 indexing)

Model & Training

Architecture

AdabNER frames nested NER as a multi-label token classification task. Each token's contextual representation from the BERT encoder passes through a dropout layer ($p = 0.1$) and a single linear classification head with sigmoid activation over $43$ BIO labels ($21$ entity types $\times \{\mathrm{B}, \mathrm{I}\}$, plus $\mathrm{O}$). Because the labels are predicted independently rather than through a softmax, a token may carry several active labels at once, which is what allows overlapping mentions to be recovered in a single forward pass. The rare cases of same-type nesting (under $1\%$ of mentions) are resolved with indexed labels such as B-ORG and B-ORG_2.

Supervised Fine-Tuning

Five Arabic encoders are fine-tuned under both the stratified and leave-book-out splits. The objective is focal loss, chosen to counter the severe class imbalance introduced by the BIO scheme and the long tail of entity types. Each configuration is run across three random seeds, and reported scores are the mean over those runs.

HyperparameterValue
OptimizerAdamW
Learning rate$6 \times 10^{-5}$
Batch size$16$
Max sequence length$512$
LossFocal loss ($\alpha = 0.75$, $\gamma = 1.0$)
Decision threshold$0.5$
Epochs$50$, early stopping (patience $= 5$) on validation macro-$F_1$
Seeds$\{42, 1, 123\}$
Hardware$3 \times$ NVIDIA RTX A6000 (48 GB)

In-Context Learning

The large language models are evaluated under a $5$-shot setting, with demonstrations drawn through stratified diverse example selection to cover the entity taxonomy. Models are prompted to return structured JSON and decoded greedily (temperature $= 0$). Open-source models are served with vLLM (tensor parallelism $= 8$) on A100-80GB GPUs, while Gemini 3 Pro and Qwen3-235B are queried asynchronously through Vertex AI.


Repository Structure

bert/   train_adabner.py          # BERT: 5 encoders × 2 splits × 3 seeds
llm/    eval_cohere.py            # ICL: aya-expanse-32b, c4ai-command-r (vLLM)
        eval_gemini.py            # ICL: Gemini 3 Pro (Vertex AI async)
        eval_qwen.py              # ICL: Qwen2.5-72B (vLLM)
        eval_qwen_235b.py         # ICL: Qwen3-235B (Vertex AI async)
ood/    eval_wojood.py            # Train Wojood → zero-shot transfer to AdabNER
        eval_adabner_on_wojood.py # AdabNER model → zero-shot transfer to Wojood
        mmd_analysis.py           # MMD domain shift analysis
joint/  train_joint.py            # Joint training: AdabNER + Wojood
src/    model.py  dataset.py  metrics.py  preprocessing.py  llm_utils.py
data/   adabner/  wojood/

Setup

pip install -r requirements.txt

All scripts run from the repository root:

python bert/train_adabner.py          # BERT experiments
python llm/eval_gemini.py             # LLM ICL
python ood/eval_wojood.py             # OOD evaluation
python joint/train_joint.py           # Joint training

Results written to results/.


Results

BERT-based Models (AdabNER)

ModelSplitMicro PMicro RMicro $F_1$Macro $F_1$
AraBERTv2Stratified0.85±.0030.87±.0030.86±.0030.83±.006
AraBERTv2Leave-Book-Out0.82±.0140.85±.0040.83±.0060.81±.007
ARBERTv2Stratified0.82±.0070.85±.0020.83±.0040.81±.006
ARBERTv2Leave-Book-Out0.79±.0190.83±.0110.81±.0050.78±.006
AraBERTv1Stratified0.80±.0070.82±.0030.81±.0050.78±.011
CAMeLBERTStratified0.79±.0060.81±.0060.80±.0060.78±.008
ARBERTStratified0.76±.0110.80±.0060.79±.0080.75±.015

In-Context Learning — 5-shot (AdabNER)

ModelSplitMicro PMicro RMicro $F_1$Macro $F_1$
Gemini 3 ProLeave-Book-Out0.55±.0090.64±.0200.59±.0070.57±.005
Gemini 3 ProStratified0.59±.0070.49±.0400.53±.0260.51±.023
Qwen3-235BLeave-Book-Out0.30±.0120.53±.0030.38±.0090.35±.021
Qwen2.5-72BLeave-Book-Out0.30±.0200.53±.0040.38±.0170.35±.026
aya-expanse-32bStratified0.32±.0130.44±.0130.37±.0060.32±.009
c4ai-command-rStratified0.22±.0080.38±.0070.27±.0040.24±.003

LLMs struggle with nested Arabic: fine-tuned encoders dominate ($F_1 = $ 0.86) vs. the best LLM ($F_1 = $ 0.59).

Out-of-Domain Transfer & Joint Training (AraBERTv2 · Micro $F_1$)

SettingTest SetMicro $F_1$
AdabNER → AdabNERAdabNER0.860
Joint → AdabNERAdabNER0.853
Wojood → AdabNERAdabNER0.590
Wojood → WojoodWojood0.920
Joint → WojoodWojood0.921
AdabNER → WojoodWojood0.660

Joint training solves domain collapse. Cross-domain transfer drops from 0.86 to 0.66 due to temporal and lexical shifts; joint training recovers cross-domain performance to within $<1\%$ $F_1$ of in-domain on both datasets.

All results averaged over 3 seeds. Full tables in the paper.


Citation

@inproceedings{mourad-jarrar-2026-adabner,
    title     = "{A}dab{NER}: {A}rabic Digital Archive Books with Nested Entity Recognition",
    author    = "Mourad, Aya and Jarrar, Mustafa",
    booktitle = "Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
    month     = jul,
    year      = "2026",
    address   = "San Diego, California, United States",
    publisher = "Association for Computational Linguistics",
    url       = "https://aclanthology.org/2026.acl-long.1541/",
    pages     = "33382--33396",
    ISBN      = "979-8-89176-390-6",
}

Acknowledgments

This work was supported by the Sorbonne Center for Artificial Intelligence (SCAI) and the SOUND.AI project, funded by the European Union's Horizon programme.


License

The AdabNER dataset is for non-commercial research use only.

The corpus is derived from the Hindawi Books digital collection. The Hindawi Foundation has granted explicit permission to publish this dataset for non-commercial research purposes, with the following conditions:

  • Use for non-commercial research purposes only
  • Do not redistribute to third parties
  • Acknowledge the Hindawi Foundation in any publication that uses the dataset

The code in this repository is released under the MIT License.

aiamourad/AdabNER

Python

0

10 commits

updated Jun 30, 2026

See the code

README

AdabNER: Arabic Digital Archive Books with Nested Entity Recognition

Paper Dataset Model Code License


At a Glance

BooksGenresTokensEntity mentionsEntity typesNestedIAA $\kappa$
13810876K78,5302118.96%0.938

Abstract

Most studies on Arabic Named Entity Recognition (NER) have focused on news texts and social media posts, while the large and rich corpus of literary Arabic books has been underrepresented. We introduce AdabNER, the first large-scale nested NER dataset for Modern Standard Arabic (MSA) literary texts, comprising the first 6,000 words annotated from each of 138 books spanning ten literary genres, including history, biography, literary criticism, and travel literature, and covering works from the 1880s to the 2020s. The corpus comprises about 876K tokens, manually annotated using a nested 21 entity tag annotation scheme, yielding 78,530 entity mentions, 18.96% of which are nested. We fine-tuned five pre-trained Arabic BERT encoders in two settings: stratified and leave-book-out, achieving F1 scores of 0.86 and 0.83 with AraBERTv2, respectively. We also evaluated five large language models through few-shot in-context learning, including open-source models and the closed-source Gemini 3 Pro, with Gemini 3 Pro achieving the highest LLM F1 score of 0.59. Supervised results degraded under out-of-domain evaluation; however, joint multi-domain training reduced this gap to less than a 1% F1 loss, demonstrating that domain-diverse training data is key to robust Arabic NER, though broader validation beyond the experiments reported is needed. AdabNER and its annotation guidelines are publicly available at https://doi.org/10.5281/zenodo.19468385.


Dataset

The dataset is currently undergoing final processing and will be released soon. For non-commercial research use only — see License.

AdabNER corpus + guidelinesdoi.org/10.5281/zenodo.19468385
Best model (AraBERTv2) — coming soonhuggingface.co/aiamourad/AdabNER
Wojood (OOD experiments)sina.birzeit.edu/wojood

Place splits under data/adabner/ and data/wojood/ before running experiments.


Corpus

Construction

SourceHindawi Library digital collection
Sampling1 book per genre per decade; first 6,000 words after removing front matter
Taxonomy18 OntoNotes types + OCC / CURR / UNIT → 21 types
Nesting frameworkWojood & ACE nested annotation framework

Genres

Biographies · Geography · History · Literary Criticism · Literature · Novels · Philosophy · Politics · Social Sciences · Travel Literature

Statistics

Books138 (1 per genre per decade)
Sentences26,162 · ~189 per book · mean 33.5 words
Tokens~876K
Entity mentions78,530
Nested entities14,082 (18.96%)
Max nesting depth3
Same-type nesting<1% (handled with B-ORG, B-ORG_2 indexing)

Model & Training

Architecture

AdabNER frames nested NER as a multi-label token classification task. Each token's contextual representation from the BERT encoder passes through a dropout layer ($p = 0.1$) and a single linear classification head with sigmoid activation over $43$ BIO labels ($21$ entity types $\times \{\mathrm{B}, \mathrm{I}\}$, plus $\mathrm{O}$). Because the labels are predicted independently rather than through a softmax, a token may carry several active labels at once, which is what allows overlapping mentions to be recovered in a single forward pass. The rare cases of same-type nesting (under $1\%$ of mentions) are resolved with indexed labels such as B-ORG and B-ORG_2.

Supervised Fine-Tuning

Five Arabic encoders are fine-tuned under both the stratified and leave-book-out splits. The objective is focal loss, chosen to counter the severe class imbalance introduced by the BIO scheme and the long tail of entity types. Each configuration is run across three random seeds, and reported scores are the mean over those runs.

HyperparameterValue
OptimizerAdamW
Learning rate$6 \times 10^{-5}$
Batch size$16$
Max sequence length$512$
LossFocal loss ($\alpha = 0.75$, $\gamma = 1.0$)
Decision threshold$0.5$
Epochs$50$, early stopping (patience $= 5$) on validation macro-$F_1$
Seeds$\{42, 1, 123\}$
Hardware$3 \times$ NVIDIA RTX A6000 (48 GB)

In-Context Learning

The large language models are evaluated under a $5$-shot setting, with demonstrations drawn through stratified diverse example selection to cover the entity taxonomy. Models are prompted to return structured JSON and decoded greedily (temperature $= 0$). Open-source models are served with vLLM (tensor parallelism $= 8$) on A100-80GB GPUs, while Gemini 3 Pro and Qwen3-235B are queried asynchronously through Vertex AI.


Repository Structure

bert/   train_adabner.py          # BERT: 5 encoders × 2 splits × 3 seeds
llm/    eval_cohere.py            # ICL: aya-expanse-32b, c4ai-command-r (vLLM)
        eval_gemini.py            # ICL: Gemini 3 Pro (Vertex AI async)
        eval_qwen.py              # ICL: Qwen2.5-72B (vLLM)
        eval_qwen_235b.py         # ICL: Qwen3-235B (Vertex AI async)
ood/    eval_wojood.py            # Train Wojood → zero-shot transfer to AdabNER
        eval_adabner_on_wojood.py # AdabNER model → zero-shot transfer to Wojood
        mmd_analysis.py           # MMD domain shift analysis
joint/  train_joint.py            # Joint training: AdabNER + Wojood
src/    model.py  dataset.py  metrics.py  preprocessing.py  llm_utils.py
data/   adabner/  wojood/

Setup

pip install -r requirements.txt

All scripts run from the repository root:

python bert/train_adabner.py          # BERT experiments
python llm/eval_gemini.py             # LLM ICL
python ood/eval_wojood.py             # OOD evaluation
python joint/train_joint.py           # Joint training

Results written to results/.


Results

BERT-based Models (AdabNER)

ModelSplitMicro PMicro RMicro $F_1$Macro $F_1$
AraBERTv2Stratified0.85±.0030.87±.0030.86±.0030.83±.006
AraBERTv2Leave-Book-Out0.82±.0140.85±.0040.83±.0060.81±.007
ARBERTv2Stratified0.82±.0070.85±.0020.83±.0040.81±.006
ARBERTv2Leave-Book-Out0.79±.0190.83±.0110.81±.0050.78±.006
AraBERTv1Stratified0.80±.0070.82±.0030.81±.0050.78±.011
CAMeLBERTStratified0.79±.0060.81±.0060.80±.0060.78±.008
ARBERTStratified0.76±.0110.80±.0060.79±.0080.75±.015

In-Context Learning — 5-shot (AdabNER)

ModelSplitMicro PMicro RMicro $F_1$Macro $F_1$
Gemini 3 ProLeave-Book-Out0.55±.0090.64±.0200.59±.0070.57±.005
Gemini 3 ProStratified0.59±.0070.49±.0400.53±.0260.51±.023
Qwen3-235BLeave-Book-Out0.30±.0120.53±.0030.38±.0090.35±.021
Qwen2.5-72BLeave-Book-Out0.30±.0200.53±.0040.38±.0170.35±.026
aya-expanse-32bStratified0.32±.0130.44±.0130.37±.0060.32±.009
c4ai-command-rStratified0.22±.0080.38±.0070.27±.0040.24±.003

LLMs struggle with nested Arabic: fine-tuned encoders dominate ($F_1 = $ 0.86) vs. the best LLM ($F_1 = $ 0.59).

Out-of-Domain Transfer & Joint Training (AraBERTv2 · Micro $F_1$)

SettingTest SetMicro $F_1$
AdabNER → AdabNERAdabNER0.860
Joint → AdabNERAdabNER0.853
Wojood → AdabNERAdabNER0.590
Wojood → WojoodWojood0.920
Joint → WojoodWojood0.921
AdabNER → WojoodWojood0.660

Joint training solves domain collapse. Cross-domain transfer drops from 0.86 to 0.66 due to temporal and lexical shifts; joint training recovers cross-domain performance to within $<1\%$ $F_1$ of in-domain on both datasets.

All results averaged over 3 seeds. Full tables in the paper.


Citation

@inproceedings{mourad-jarrar-2026-adabner,
    title     = "{A}dab{NER}: {A}rabic Digital Archive Books with Nested Entity Recognition",
    author    = "Mourad, Aya and Jarrar, Mustafa",
    booktitle = "Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
    month     = jul,
    year      = "2026",
    address   = "San Diego, California, United States",
    publisher = "Association for Computational Linguistics",
    url       = "https://aclanthology.org/2026.acl-long.1541/",
    pages     = "33382--33396",
    ISBN      = "979-8-89176-390-6",
}

Acknowledgments

This work was supported by the Sorbonne Center for Artificial Intelligence (SCAI) and the SOUND.AI project, funded by the European Union's Horizon programme.


License

The AdabNER dataset is for non-commercial research use only.

The corpus is derived from the Hindawi Books digital collection. The Hindawi Foundation has granted explicit permission to publish this dataset for non-commercial research purposes, with the following conditions:

  • Use for non-commercial research purposes only
  • Do not redistribute to third parties
  • Acknowledge the Hindawi Foundation in any publication that uses the dataset

The code in this repository is released under the MIT License.