AfriEmo-LS-MoE

Language-Script Mixture-of-Experts for African Multilingual Emotion Classification

Overview

AfriEmo-LS-MoE is a multilingual Mixture-of-Experts model developed for multi-label emotion classification across 15 African languages using the AfriEmo dataset.

The model uses AfriBERTa-large as its shared multilingual encoder and employs a Language-Script Mixture-of-Experts (LS-MoE) architecture.

The architecture groups languages according to their writing systems rather than their linguistic families.

Languages sharing the same writing script are assigned to the same specialized classification expert, while languages using different scripts are assigned to different expert heads.

The model combines shared multilingual representations with independently parameterized expert classification heads.

This configuration investigates whether writing-system similarities provide useful signals for expert specialization in African multilingual emotion detection.

Dataset: AfriEmo

AfriEmo is a multilingual African emotion classification dataset containing 56,308 instances across 15 languages.

The dataset supports research on multilingual emotion recognition across African languages with different linguistic and orthographic characteristics.

The languages included are:

Code Language
amh Amharic
ary Moroccan Arabic
hau Hausa
ibo Igbo
kin Kinyarwanda
orm Oromo
pcm Nigerian Pidgin
por Mozambican Portuguese
som Somali
swa Swahili
tir Tigrinya
vmw Makhuwa
xho Xhosa
yor Yoruba
zul Zulu

Classification Task

AfriEmo is formulated as a multi-label emotion classification task involving six emotion categories.

The model predicts emotion labels associated with multilingual African text.

Unlike conventional single-label classification, multi-label classification allows an input text to be associated with multiple emotion categories.

The model uses sigmoid-based classification for emotion prediction.

Macro-F1 is the primary evaluation metric, computed across the emotion labels.

Model Architecture

AfriEmo-LS-MoE employs a shared-encoder Mixture-of-Experts architecture.

1. Shared Multilingual Encoder

AfriBERTa-large serves as the shared pretrained multilingual encoder.

It extracts contextual representations from African language text.

The encoder is shared across all supported languages.

2. Language Metadata

Each input retains its language identifier and associated writing-script information.

The script metadata determines the expert assignment during training and evaluation.

3. Language-Script Router

A deterministic routing mechanism assigns each language to an expert based on its writing system.

Languages sharing the same script are assigned to the same expert classification head.

4. Specialized Expert Heads

Each expert contains independently parameterized classification weights.

The expert heads share the common AfriBERTa-large encoder but learn specialized emotion classification parameters.

5. Multi-Label Emotion Prediction

The selected expert receives the shared encoder representation and generates predictions for the six emotion categories.

Sigmoid activation is applied to produce multi-label emotion probabilities.

Language-Script Mixture-of-Experts (LS-MoE)

LS-MoE organizes languages according to their writing systems.

The routing configuration uses three script groups:

Script Group Languages
Ethiopic Amharic, Tigrinya
Arabic/Latin Moroccan Arabic
Latin Hausa, Igbo, Kinyarwanda, Oromo, Nigerian Pidgin, Mozambican Portuguese, Somali, Swahili, Makhuwa, Xhosa, Yoruba, Zulu

The expert assignment is deterministic and remains fixed during training and evaluation.

Unlike Language-Family MoE, LS-MoE does not consider linguistic family relationships when assigning languages to experts.

Instead, writing-system similarity provides the primary routing signal.

This configuration investigates whether orthographic characteristics contribute to effective multilingual expert specialization.

Experimental Results

AfriEmo using AfriBERTa-large

The research evaluates six configurations:

Configuration Average Macro-F1 (%)
Multilingual Fine-Tuning (MFT) 39.5
Language-Wise MoE (LW-MoE) 34.1
Language-Script MoE (LS-MoE) 39.5
Language-Family MoE (LF-MoE) 37.3
Family-Script MoE (FS-MoE) 37.0
Random-MoE 36.7

Per-Language Results

The following table presents the reported per-language Macro-F1 scores for LS-MoE using AfriBERTa-large.

Language Macro-F1 (%)
Amharic 59.2
Moroccan Arabic 12.2
Hausa 67.7
Igbo 54.6
Kinyarwanda 47.3
Oromo 58.0
Nigerian Pidgin 49.2
Mozambican Portuguese 24.9
Somali 39.1
Swahili 23.2
Tigrinya 44.5
Makhuwa 19.5
Xhosa 30.3
Yoruba 35.4
Zulu 26.9
Average 39.5

Key Research Findings

Language-Script Mixture-of-Experts achieves an average Macro-F1 of 39.5% using AfriBERTa-large on AfriEmo.

This performance matches conventional Multilingual Fine-Tuning (MFT), which also achieves 39.5%.

LS-MoE outperforms the other evaluated Mixture-of-Experts configurations, including Language-Wise MoE, Language-Family MoE, Family-Script MoE, and Random-MoE.

At the language level, LS-MoE achieves strong results for Hausa, Igbo, and Oromo, with Macro-F1 scores of 67.7%, 54.6%, and 58.0%, respectively.

These findings indicate that writing-script-based expert specialization can provide competitive performance for African multilingual emotion classification.

However, the results do not establish a consistent advantage over conventional multilingual fine-tuning.

Encoder and Training Setup

The experimental configuration includes:

  • Dataset: AfriEmo
  • Encoder: AfriBERTa-large
  • Architecture: Shared-Encoder Mixture-of-Experts
  • Routing strategy: Language-Script MoE
  • Framework: PyTorch
  • NLP Library: Hugging Face Transformers
  • Maximum sequence length: 256 tokens
  • Optimizer: AdamW
  • Learning rate: 1e-5
  • Training epochs: 5
  • Training batch size: 16
  • Evaluation batch size: 32
  • Random seed: 84
  • Data split: 90% training and 10% testing
  • Primary evaluation metric: Macro-F1

Repository Contents

The repository contains the trained AfriBERTa-large LS-MoE checkpoint and supporting resources.

File Description
saved_moe_model/config.json Model configuration
saved_moe_model/model.safetensors Shared encoder weights
saved_moe_model/expert_heads.pt Expert classification parameters
saved_moe_model/expert_mapping.json Language-to-script expert mapping
saved_moe_model/tokenizer.json Tokenizer vocabulary
saved_moe_model/tokenizer_config.json Tokenizer configuration
per_language_macro_f1.csv Per-language Macro-F1 results

Intended Applications

AfriEmo-LS-MoE supports research and experimentation in:

  • African multilingual emotion detection.
  • Multi-label emotion classification.
  • Low-resource African language NLP.
  • Writing-script-based expert specialization.
  • Multilingual representation learning.
  • Mixture-of-Experts architectures.
  • African language technologies.
  • Multilingual social media analysis.

Research Contributions

This work investigates:

  1. A shared-encoder Mixture-of-Experts framework for African multilingual emotion classification.

  2. Language-script-based deterministic expert routing across 15 African languages.

  3. Specialized classification heads for languages sharing writing-system characteristics.

  4. Comparative evaluation of language-wise, language-script, language-family, family-script, and random expert-routing strategies.

  5. The effectiveness of AfriBERTa-large combined with script-based expert specialization.

Limitations and Future Work

The effectiveness of language-script-based expert specialization depends on the pretrained encoder, dataset, and classification task.

Languages sharing the same writing system may still exhibit substantial linguistic and semantic differences.

Furthermore, script-based grouping does not necessarily guarantee improved cross-lingual knowledge transfer.

Future work will investigate learned routing, data-driven language grouping, multiple expert configurations, and parameter-efficient adaptation.

Citation

"Language Family and Script as Routing Signals for African Multilingual Text Classification."-Submitted to TACL

The AfriEmo dataset should be cited in accordance with its original publication.

Acknowledgements

We acknowledge the AfriEmo dataset contributors, the AfriBERTa research community, and the African NLP research community for advancing multilingual African language technologies.

Downloads last month
25
Safetensors
Model size
0.1B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Attahir/AfriEMO-Afriberta-MOE-Script

Finetuned
(38)
this model

Dataset used to train Attahir/AfriEMO-Afriberta-MOE-Script