Ethical Constraints Enforcement for Tool-Using Arabic LLM Agents
Loading...
Files
Date
Journal Title
Journal ISSN
Volume Title
Publisher
Unuversity Setif 1 Ferhat Abbas . Faculty of Sciences
Abstract
The rapid expansion of Large Language Models (LLMs) into agentic applications has intro-duced a new class of safety and alignment challenges that existing safeguard frameworks are ill-equipped to address. In multilingual settings, and particularly for Arabic, dialectal diver-sity creates additional attack surfaces: content moderation systems trained predominantly on Modern Standard Arabic (MSA) are systematically blind to harmful inputs expressed in re-gional dialects such as Algerian Darja, or in code-mixed registers such as Arabizi and Franco-Arabic. When LLMs are further augmented with tool-calling capabilities, adversarial users gain the ability to manipulate not only model outputs but also external actions, a threat vec-tor known as indirect policy bypass that no prior Arabic safety framework has systematically addressed.
In this work, we propose AMAN-LLM (Ethical Constraints Enforcement for Tool-Using Arabic LLM Agents), a modular four-layer pipeline designed to enforce ethical constraints across the full agentic lifecycle. The framework integrates a dialect-aware Input Sanitizer performing UTF-8 normalisation, de-obfuscation, and Arabizi decoding; Layer 1 ethical in-put filtering via MARBERT and AraBERT classifiers fine-tuned on the OSACT5 hate-speech dataset and a bespoke Algerian Arabic Adversarial Corpus (AAAC); Layer 2 policy gover-nance through a YAML-configurable rule engine covering thirteen violation categories in-cluding prompt injection, PII leakage, and jurisdiction-specific financial compliance; Layer 3 output validation enforcing groundedness, hallucination detection, and safety checks on LLM-generated responses; and Layer 4 reflective self-critique implementing a constitutional critique-and-rewrite loop grounded in Arabic-language safety principles. The system is in-stantiated on Aya Expanse 8B as the tool-augmented agent core and evaluated on a purpose-built benchmark of 118 test cases spanning Modern Standard Arabic, Algerian Darja, Arabizi, and code-mixed Franco-Arabic, structured around four research questions.
Empirical evaluation across RQ1–RQ4 demonstrates strong and consistent performance across all pipeline layers. The dialect-aware Layer 1 classifier achieved an accuracy of 89.2% and an F1-score of 91.6%, with an obfuscation detection rate of 88.9% across all Arabic input modalities (RQ1). End-to-end evaluation yielded an Attack Success Rate of 5.68%, with Layer 4 contributing the largest delivering the only significant incremental reduction beyond Layer 1 — lowering ASR by approximately 73.7% relative to the L1–L2–L3 configuration
— and a block precision of 88.5% (RQ2). The Input Sanitizer achieved 100% normalisation accuracy at a near-zero average latency of 0.19 ms, directly improving downstream detection effectiveness (RQ4). Layer 4 individually attained an F1-score of 97.3%, a 100% unsafe-response blocking rate, and a 94.7% self-correction rate; its average latency of 14.6 s and P95 of 22.1 s make it the dominant computational cost, though preliminary evidence confirms that
risk-stratified selective routing is feasible for low-risk outputs (RQ3). Hallucinated outputs were eliminated entirely through the combined action of Layers 3 and 4, and end-to-end median latency was measured at 28.8 ms.
This work provides a principled, extensible, and culturally-grounded architecture for eth-ical constraint enforcement in Arabic LLM agent systems. By addressing the intersection of Algerian dialectal diversity, agentic threat models, and multi-layer policy enforcement, AMAN-LLM fills a critical gap in Arabic NLP safety research and establishes a replicable blueprint for trustworthy, responsible deployment of LLM agents in Arabic-speaking con-texts.
