Logo Lanfrica

OthmanSALAHI/script-switching-darija

Domain:

natural language processing

Record type:

software
Creator:
Oth
Host:
This project investigates the vulnerability of state-of-the-art Arabic transformer models to "script-switching"β€”the practice of writing Arabic dialects (like Moroccan Darija) using Latin characters and numbers (Arabizi). By treating transliteration as a zero-effort adversarial attack, we demonstrate that models like AraBERT and DarijaBERT suffe # Evaluating Script-Switching Robustness πŸ›‘οΈ ### Robustness Auditing of Arabic Transformer Models against Arabizi Adversarial Evasion --- ## πŸ“Œ Overview This repository contains the code and white paper for a controlled robustness audit of Arabic transformer models in the context of Moroccan misinformation detection. We investigate a critical and largely unexplored vulnerability: **Script-Switching**. Millions of Moroccan social media users write in **Arabizi** (Arabic phonemes using Latin characters/numbers). While AI systems are highly accurate on Arabic script, they are often "blind" to Arabizi. This study demonstrates that script-switching acts as a **zero-effort adversarial attack** that can bypass state-of-the-art detection systems with no technical expertise. > **The Core Problem:** Most Arabic NLP models are trained and tested **exclusively on Arabic script**, creating a massive security gap on platforms where Arabizi is the dominant vernacular. --- ## πŸ”¬ Research Findings: The Robustness Paradox Our study reveals a counterintuitive reality: **Higher benchmark accuracy does not predict greater operational reliability.** | Model | Arabic F1 (Baseline) | Arabizi F1 (Adversarial) | Performance Drop | |---|---|---|---| | **DarijaBERT** | 0.7840 | 0.4979 | **βˆ’36.5%** | | **AraBERT-Twitter** | 0.8725 | 0.3406 | **βˆ’60.9%** | ### πŸ“Š Visual Analysis | Model | Baseline (Arabic) | Adversarial (Arabizi) | |---|---|---| | **DarijaBERT** | | | | **AraBERT-Twitter** | | | **Key Finding:** AraBERT-Twitter β€” the "stronger" model on standard Arabic β€” failed significantly harder on Arabizi, misclassifying **99%** of real news articles as fake. --- ## πŸ—οΈ Project Structure ``` code-switching/ β”œβ”€β”€ data/ β”‚ β”œβ”€β”€ train.csv # 16,000 training samples β”‚ β”œβ”€β”€ val.csv # 2,000 validation samples β”‚ β”œβ”€β”€ test.csv # 2,000 test samples (Arabic script) β”‚ └── test_arabizi.csv # 2,000 test samples (Arabizi β€” adversarial …