BroadRouter
Get started

Arabic prompt engineering: register, RTL, numerals and mixed text

By the BroadNet Inference team · 5 min read · Published · Updated

Good Arabic output comes from explicit instructions: name the register (MSA or a specific dialect), the audience, the numeral style (Western 0–9 or Eastern Arabic ٠–٩), the formatting allowed, and how to treat English terms. Render replies with dir="auto" or isolation marks so mixed Arabic and English displays in the right order.

To get good Arabic from an LLM, state every choice the model would otherwise guess: Modern Standard Arabic or a named dialect, the audience and tone, Western (123) or Eastern Arabic (١٢٣) digits, the date and currency format, how to write English terms, and whether to add diacritics. Then fix right-to-left display in your UI, not in the prompt.

How do you specify register and dialect?

Arabic has a formal written standard, Modern Standard Arabic (MSA, الفصحى), and many spoken dialects. Business text is usually MSA; chat, marketing and voice products sometimes use dialect. Tell the model exactly which:

Instead of Say
Reply in Arabic. Reply in clear, simple Modern Standard Arabic suitable for retail customers.
Use Gulf dialect. Write in Saudi (Najdi-leaning) Gulf Arabic, informal but respectful, as a young brand would.
Be friendly. Warm and polite. Use “حضرتك” for Egyptian customers; avoid slang.

Some practical rules:

  • “Simple MSA” is the safest default. It is understood everywhere and sounds professional. Models write it more reliably than dialect.
  • Name the country, not “Gulf” or “Levant”. Saudi, Emirati and Kuwaiti speech differ; so do Lebanese and Jordanian.
  • Address form. Arabic marks gender in “you”. Pick a default (masculine singular is the common neutral form in UI text) or ask the model to use gender-neutral phrasing where possible, for example with the noun form “يرجى إدخال” (please enter) instead of the imperative “أدخل/أدخلي”.
  • Diacritics. Say “no diacritics” for normal text. Most models add few by default, but some add them to names or poetry-style replies.

For dialect input, see how LLMs handle Gulf, Egyptian and Levantine Arabic.

How do you control numerals, dates and currency?

Arabic text uses two digit sets: Western digits (0–9) and Eastern Arabic digits (٠١٢٣٤٥٦٧٨٩). Which set readers expect differs by country and by medium, and models will mix them unless told. Decide per product, based on what your existing materials in that market already use:

  • Western digits are easiest for parsing, search and data entry.
  • Eastern Arabic digits match a more traditional look. If you need them, convert at display time and keep Western digits in your data.

Also specify:

  • Dates: Gregorian, Hijri or both, and the format (for example 2026-11-14 or ١٤ نوفمبر ٢٠٢٦). Note that month names differ by region: نوفمبر in Egypt and the Gulf, تشرين الثاني in the Levant and Iraq.
  • Currency: symbol or code, and position. “ر.س” or “SAR”? Before or after the number? Give one example.
  • Decimal separator: ”.” or the Arabic decimal sign ”٫”.

A single worked example in the prompt fixes most of this: “Write prices like: 1,250.00 ر.س”.

How do you fix right-to-left display problems?

Most “the Arabic is broken” bug reports are display problems, not model problems. When Arabic and Latin text or numbers share a line, the Unicode bidirectional algorithm decides the visual order based on the paragraph direction. If your chat bubble is left-to-right, a reply such as “تم شحن طلبك رقم 4821.” can show the full stop at the wrong end.

Fix it in the UI:

  • Set dir="auto" (or dir="rtl" for Arabic-only views) on the element that displays each message. See MDN on the dir attribute and the W3C guidance on right-to-left markup.
  • When you insert values (names, order numbers, English product names) into Arabic templates, wrap them in <bdi> in HTML, or Unicode isolates (U+2068 FIRST STRONG ISOLATE … U+2069 POP DIRECTIONAL ISOLATE) in plain text.
  • In the prompt, ask for formatting your surface can show. WhatsApp and SMS: plain text, no Markdown tables. Web chat: Markdown is fine if your renderer handles RTL lists. Code blocks should stay left-to-right.

If you stream replies, set the direction on the container before the first token arrives, so text does not jump; see the streaming guide.

How should the model mix Arabic and English?

Real Arabic business text mixes languages: product names, technical terms, units, code. Decide the rule and say it:

  • “Keep brand and product names in their original Latin spelling.”
  • “Write technical terms in Arabic with the English term in parentheses the first time: واجهة برمجة التطبيقات (API).”
  • “Never transliterate English words into Arabic letters” or the opposite, if your audience prefers “الإيميل” over “البريد الإلكتروني”.
  • “If the user writes in English, reply in English. If they write in Arabizi, reply in Arabic script.” More on that in handling Arabizi.

Should the system prompt be in English or Arabic?

Both work. English instructions with Arabic content are common and easy to maintain if your team does not all read Arabic. Arabic instructions can nudge tone and vocabulary in the right direction. Whichever you choose, keep one language per system prompt, and put an Arabic example of the desired output inside it either way. Arabic instructions can cost more tokens than the same rules in English; compare both in the free Arabic token counter. Our tokenizer efficiency data shows how many tokens the same Arabic and English sentences take across 16 tokenizers.

A complete example:

import os
from openai import OpenAI

client = OpenAI(base_url="https://inference.broadnet.ai/v1", api_key=os.environ["BROADNET_API_KEY"])

SYSTEM = """You are the support assistant for an Egyptian electronics store.
Language: reply in simple Modern Standard Arabic. If the customer writes in English, reply in English.
Tone: warm, polite, concise. At most 3 sentences.
Numbers: Western digits. Prices like: 12,499 ج.م
Dates: Gregorian, like: 14 نوفمبر 2026
Names: keep brand and model names in Latin letters (iPhone 17, Galaxy S26).
Formatting: plain text only, no Markdown, no diacritics.
Example reply:
شكراً لتواصلك معنا. سعر Galaxy S26 حالياً 12,499 ج.م، والتوصيل متاح خلال يومين."""

r = client.chat.completions.create(
    model="broadnet/qwen3.8-27b",
    max_tokens=2000,  # reasoning comes first
    messages=[{"role": "system", "content": SYSTEM},
              {"role": "user", "content": "عايز أعرف سعر الايفون ١٧ وهل في تقسيط؟"}],
)
print(r.choices[0].message.content)

The customer writes in Egyptian Arabic (“I want to know the price of the iPhone 17, and is there instalment payment?”) using Eastern digits. The prompt makes the reply MSA with Western digits. The example reply in the prompt reads: “Thank you for contacting us. The Galaxy S26 currently costs 12,499 EGP, and delivery is available within two days.”

How do you get structured output in Arabic?

When you need JSON, keep keys in English and values in Arabic. Say whether numbers should be numbers or strings, and which digit set to use inside strings. Ask for null instead of guesses. See structured output with JSON schema.

How do you test Arabic prompts?

Build a set of 30 to 50 real prompts per market, run them through each candidate model, and have a native speaker of that market grade register, correctness and naturalness. BroadNet reports that Qwen3.8 27B wrote fluent Arabic and understood Gulf and Egyptian dialects in its tests; DeepSeek V4.1 Flash and GLM 5.3 are on the same API, so switching is a one-line change. Compare their prices on the pricing page or in the DeepSeek V4.1 Flash vs Qwen3.8 27B comparison, and measure tokens on real Arabic text, since Arabic often takes more tokens per word than English. For the wider model-selection checklist, see choosing an LLM API for Arabic.

Arabic prompt checklist

  • Register and country named.
  • Address form (gender) decided.
  • Digits, dates, currency and decimal separator specified with an example.
  • Formatting matched to the display surface.
  • English terms and brand names rule stated.
  • dir="auto" and isolation in the UI.
  • Native-speaker review on a fixed test set.

Questions

Should I write the system prompt in Arabic or English?

Both work on current models. English instructions are easier for most teams to maintain; Arabic instructions sometimes give a more natural tone. Keep each system prompt in one language and compare both on your own test set.

Why does my Arabic text show punctuation in the wrong place?

That is a display problem, usually a container with left-to-right direction. Set dir="rtl" or dir="auto" on the element that shows the reply.

How do I stop the model adding diacritics?

Say "Do not add diacritics (tashkeel)" in the prompt. Ask for them only where they help, such as learning materials or ambiguous names.

How do I make an LLM use Eastern Arabic numerals?

Say it in the system prompt and show one example, such as "Write prices like: ١٬٢٥٠ ر.س". Models mix digit sets when the rule is missing. If you parse the output, ask for Western digits in JSON fields and convert for display instead.

Which model writes the best Arabic?

Test on your own prompts. BroadNet reports fluent Arabic writing from Qwen3.8 27B in its tests, along with Gulf and Egyptian dialect understanding.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity