--- datasets: - T0KII/MASRISET-V4-DOWNSTREAM-SPLIT language: - ar base_model: - T0KII/MASRIBERTV4 pipeline_tag: text-classification --- # MASRIHEAD-Unified: Cascading Multi-Task Egyptian NLU **Global Average Macro F1:** 0.7170 **Language:** Egyptian Arabic (`ar-EG`) **Base Architecture:** `T0KII/MASRIBERTV4` + `FastText` + `BiLSTM/BiGRU` **License:** CC-BY-NC-4.0 ## Overview MASRIHEAD-Unified is a highly specialized, multi-task Natural Language Understanding (NLU) engine designed natively for the Egyptian Arabic dialect. Developed for the KALAMNA conversational AI ecosystem, it executes three simultaneous downstream tasks: **Sarcasm Detection**, **Sentiment Analysis**, and **Emotion Classification**. Unlike standard linear multi-task models, this network utilizes a **Cascading Neural Architecture** (Mathematical Intertwining) that explicitly routes upstream pragmatic predictions (Sarcasm) into downstream semantic heads (Sentiment and Emotion) to mimic human linguistic processing. ## 🧠 Architectural Details ### 1. Dual-Encoder Feature Fusion (1792-Dimensions) The model processes text through two entirely orthogonal feature extractors before fusing them into a dense representation: * **Contextual Semantics (Transformer):** `T0KII/MASRIBERTV4` (110M parameters) handles whole-sentence semantic comprehension. * **Morphological Syntax (RNN):** `facebook/fasttext-arz-vectors` (300d) feeds into a parallel BiLSTM (2x256) and BiGRU (2x256) to capture street-level syntax, neologisms, and heavy Franco-Arabic morphological variations. ### 2. The Cascading Multi-Task Routing To combat the high ambiguity of Egyptian dialects, the classification heads are mathematically intertwined. 1. **Sarcasm Head (2-Class):** Evaluates the base 1792-dimension fusion layer. 2. **Sentiment Head (3-Class):** Ingests the 1792-dimension fusion layer **+** the 2 Sarcasm logits (1794d). 3. **Emotion Head (4-Class):** Ingests the base layer **+** Sarcasm logits **+** Sentiment logits (1797d). ## 📊 Performance Benchmarks The model was trained dynamically via a sparse-matrix `CrossEntropyLoss` function (`ignore_index=-100`) on the `T0KII/MASRISET-V4-DOWNSTREAM-SPLIT` dataset (~121,000 rows). | Task | Output Classes | Macro F1 Score | | :--- | :--- | :--- | | **Sentiment** | `Negative(0)`, `Neutral(1)`, `Positive(2)` | **0.7822** | | **Sarcasm** | `Literal(0)`, `Sarcastic(1)` | **0.7342** | | **Emotion** | `Anger(0)`, `Joy(1)`, `Neutral(2)`, `Sadness(3)`| **0.6347** | | **Global Average** | - | **0.7170** |