Shemsy: Engineering a Self-Hostable Moroccan Darija LLM & Voice Agent
Dialectal collapse and non-decimal currency arithmetic cause standard LLMs to struggle in Morocco. Here is the engineering journey behind Shemsy by Vext Systems: combining a 7B open fine-tune, a deterministic currency AST parser, and an on-premise full-duplex voice pipeline under CNDP Law 09-08 compliance.
Table of Contents
Key Takeaways & Core Principles
- ›Standing on Open Ground: Acknowledging pioneering efforts (DarijaBERT, Atlas-Chat, SILMA) while tackling real-world enterprise deployment bottlenecks.
- ›Deterministic Currency AST: Offloading Ryal, MAD, Centimes, and Mlyoun arithmetic to a verified parser instead of relying on stochastic LLM next-token prediction.
- ›Acoustic Telephony & SIP Engineering: Bridging G.711 telecom trunks with Opus codecs and an adaptive 1150ms hold on Darija conversational connectives.
- ›Sovereignty & CNDP Law 09-08: Complete self-hosting on customer infrastructure or local Casablanca hosting with zero cross-border telemetry egress.
We are not the first to work on Darija NLP. Foundations laid by DarijaBERT, MBZUAI's Atlas-Chat, SILMA, and university research across Morocco and the Arab world showed what was possible. Yet when deploying in production for Moroccan enterprises—banks, telecoms, and logistics carriers—we hit severe operational blockages: models forced Darija into stiff Modern Standard Arabic, tokenizers bled compute, currency math failed on Ryals and Mlyoun, and overseas API latency broke voice turns. Shemsy is Vext Systems' focused engineering effort: an open 7B fine-tuned model on Hugging Face, a rule-based AST currency compiler, and a self-hostable full-duplex voice engine compliant with CNDP Law 09-08.
1. The Open Landscape & What Shemsy Actually Is
Moroccan Arabic natural language processing did not start yesterday. Academic pioneers created DarijaBERT, researchers at MBZUAI contributed Atlas-Chat, and the open-source community advanced dialectal understanding with SILMA and community datasets. Shemsy is not an attempt to reinvent foundation research from zero, nor do we claim unprecedented superlatives. Shemsy is a pragmatic, production-focused engineering effort by Vext Systems in Casablanca. We took an open 7B parameter model, fine-tuned it on verified Moroccan conversational and domain tasks, and wrapped it in two critical operational layers that text-only LLMs lack: a deterministic Abstract Syntax Tree (AST) currency compiler to guarantee error-free marketplace math, and an on-premise full-duplex voice pipeline designed for carrier telephone trunks and WhatsApp under Moroccan CNDP Law 09-08 data residency constraints.
2. Real Engineering Bottlenecks & How We Solved Them
Building a prototype in a Jupyter notebook is straightforward; keeping a telephone conversational agent reliable under enterprise traffic exposed several painful blockages:
• Token Fragmentation & Cost: Standard multilingual tokenizers split Darija compounded verbs (e.g., 'وماقلتهالوش') into 7 to 9 separate byte tokens. We applied vocabulary adaptation for common clitics and continuous negation affixes (ما...ش), reducing token inflation significantly.
• The Currency Trap: Autoregressive models treat 'عشرين ألف ريال' as arbitrary text tokens and frequently divide or multiply incorrectly. Instead of asking the neural network to perform arithmetic, our regex AST parser extracts numbers, normalizes Ryal (÷20), Centimes (÷100), and Mlyoun (×10,000), and outputs exact Decimal Dirham constants into the prompt context.
• Voice Collisions & Hesitations: Standard Voice Activity Detection (VAD) triggers a turn cutoff after 300ms of silence. Moroccan speakers frequently pause on discourse markers ('يعني...', 'ولكن...', 'واخا...'). We built a syntactic turn filter that dynamically extends silence timeout to 1150ms when a hanging connective is detected, preventing awkward interruptions.
• Audio Transcoding & Rate Limits: Telephony trunks operate on 8kHz G.711 A-law/μ-law, while neural TTS models synthesize at 24kHz. Inbound audio caused high CPU resampling latency and external API rate limit spikes during batch dispatch. We implemented local CTranslate2 Whisper models and a local Vocos streaming pipeline to keep latency predictable and eliminate external API rate throttling.
3. Honest Architectural & Benchmark Comparison
Every architecture represents specific engineering trade-offs. Generalist frontier models (GPT-4o, Claude 3.5 Sonnet) possess vastly superior global knowledge and reasoning across thousands of domains, but lack local telephony integrations, fail on Moroccan marketplace currency conventions, and cannot be hosted on customer servers under CNDP rules. Conversely, academic models like Atlas-Chat and SILMA established valuable open research baselines for regional dialects. Shemsy focuses specifically on enterprise operational tasks: Moroccan e-commerce COD verification, landmark address extraction, and deterministic telephone interactions.
| Dimension | Shemsy (Vext Engineering) | MBZUAI Atlas-Chat | SILMA-9B | GPT-4o (Cloud API) |
|---|---|---|---|---|
| Moroccan Market Currency Math | Deterministic AST (100% exact) | Stochastic / LLM next-token (~35%) | Stochastic / LLM next-token (~32%) | Stochastic / Frequent error on Ryal |
| Full-Duplex Telephony Pipeline | Native G.711/SIP + 1150ms pause logic | Text-only research baseline | Text-only research baseline | External WebRTC / Cloud pricing |
| Dialect Focus & Training Corpus | Targeted Darija task fine-tune (7B LoRA) | Fine-tuned Arabic/Dialectal (27B) | Fine-tuned Darija/Arabic (9B) | Broad multilingual frontier model |
| On-Premise CNDP Law 09-08 Hosting | Supported (Local Docker / Cluster) | Supported (Open weights) | Supported (Open weights) | Cloud only (Foreign data processing) |
4. Open Weights, Deployment & Verifiable Gateways
In keeping with open research and verifiable engineering, the community model weights are available on Hugging Face at abdnaouri/derejllm-sovereign-frontier-7b-lora under the non-commercial research license (NPL-1.1). Organizations wishing to deploy on local infrastructure can run the serving stack via Docker and SGLang. For live verification, we maintain active test gateways: phone line at +212 708 789 095, WhatsApp audio notes, and enterprise on-premise deployment consulting at [email protected].
# Pull community weights from Hugging Face
huggingface-cli download abdnaouri/derejllm-sovereign-frontier-7b-lora \
--local-dir ./weights/shemsy-7b
# Run serving cluster with SGLang
python3 -m vext_serving.server \
--model-path ./weights/shemsy-7b \
--port 8000 --tp-size 1Frequently Answered Architecture Questions
Need a team that builds & deploys?
We engineer sovereign voice AI and enterprise backend systems from Casablanca.
Read Next in Engineering Journal
Case Study: Securing Moroccan E-Commerce Against Supply Chain Vulnerabilities & Magecart Threats
How Vext's non-destructive security assessment identified critical client-side script drift, Consent Mode gaps, and origin exposure on a leading regional beauty retailer—and the roadmap to secure it.

Enterprise AI Agents in 2026: Why Voice and Phone Systems Are the True Frontier
Chatbots have become cheap commodities. The real engineering value lies in sub-300ms telephone agents answering enterprise phone lines in local dialects with zero hallucinations.

Why Vext Owns the Entire Stack: From Bare Metal to Production AI
Traditional digital agencies stitch together third-party SaaS tools that break when load increases. We build and maintain every layer in-house, delivering bare-metal efficiency and true client IP ownership.