Datasets:
english string | arabic string | source string | translation string | system_prompt string | direction string | field string | code string | classifications string | messages list |
|---|---|---|---|---|---|---|---|---|---|
Abu Dhabi, 15th October, 2024 (WAM) -- In continuation of the national relief campaign, ‘UAE Stands with Lebanon’, Dubai Exhibition Centre (DEC) at Expo City Dubai will host a second aid collection drive on Sunday, 20th October, 2024. The public response to the campaign, launched under the directives of President His H... | دبي في 15 أكتوبر / وام / استكمالا للحملة الوطنية الإغاثية "الإمارات معك يا لبنان"، يشهد مركز المعارض بمدينة إكسبو دبي يوم الأحد المقبل وللمرة الثانية أنشطة تجميع المساعدات الإغاثية دعما للأشقاء اللبنانيين نظير الإقبال الجماهيري الكبير، تنفيذا لتوجيهات صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة (حفظه الله)، ومتا... | دبي في 15 أكتوبر / وام / استكمالا للحملة الوطنية الإغاثية "الإمارات معك يا لبنان"، يشهد مركز المعارض بمدينة إكسبو دبي يوم الأحد المقبل وللمرة الثانية أنشطة تجميع المساعدات الإغاثية دعما للأشقاء اللبنانيين نظير الإقبال الجماهيري الكبير، تنفيذا لتوجيهات صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة (حفظه الله)، ومتا... | Abu Dhabi, 15th October, 2024 (WAM) -- In continuation of the national relief campaign, ‘UAE Stands with Lebanon’, Dubai Exhibition Centre (DEC) at Expo City Dubai will host a second aid collection drive on Sunday, 20th October, 2024. The public response to the campaign, launched under the directives of President His H... | You are an expert Arabic↔English translator for the Emirates News Agency (WAM). Adhere strictly to WAM house style.
• Factual Integrity: Preserve all entities, titles, dates, and facts exactly as in source. Never correct, infer, or update. No additions or omissions unless a rule mandates it.
• Register: Formal, diplom... | ar2en | Body | ART-24-1088528 | General, LEBANON (LBN), UAE Humanitarian Aid, United Arab Emirates (UAE) | [
{
"role": "system",
"content": "You are a professional Arabic↔English translator."
},
{
"role": "user",
"content": "Translate the following Arabic text to English:\nدبي في 15 أكتوبر / وام / استكمالا للحملة الوطنية الإغاثية \"الإمارات معك يا لبنان\"، يشهد مركز المعارض بمدينة إكسبو دبي يوم الأحد ا... |
ABU DHABI, 16th September, 2025 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a congratulatory message to President Claudia Sheinbaum Pardo of Mexico on the occasion of her country's Independence Day. His Highness Sheikh Mohammed bin Rashid Al Maktoum, Vice President, Prime Minister and Ru... | أبوظبي في 16 سبتمبر/ وام/ بعث صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة "حفظه الله"، برقية تهنئة إلى فخامة كلاوديا شاينباوم باردو رئيسة الولايات المتحدة المكسيكية، بمناسبة ذكرى استقلال بلادها. كما بعث صاحب السمو الشيخ محمد بن راشد آل مكتوم نائب رئيس الدولة رئيس مجلس الوزراء حاكم دبي "رعاه الله"، وسمو الشيخ منص... | أبوظبي في 16 سبتمبر/ وام/ بعث صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة "حفظه الله"، برقية تهنئة إلى فخامة كلاوديا شاينباوم باردو رئيسة الولايات المتحدة المكسيكية، بمناسبة ذكرى استقلال بلادها. كما بعث صاحب السمو الشيخ محمد بن راشد آل مكتوم نائب رئيس الدولة رئيس مجلس الوزراء حاكم دبي "رعاه الله"، وسمو الشيخ منص... | ABU DHABI, 16th September, 2025 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a congratulatory message to President Claudia Sheinbaum Pardo of Mexico on the occasion of her country's Independence Day. His Highness Sheikh Mohammed bin Rashid Al Maktoum, Vice President, Prime Minister and Ru... | You are a bidirectional Arabic↔English translator for the Emirates News Agency (WAM). Follow these core principles:
• **Factual Integrity**: Treat all proper nouns, titles, ranks, dates, numbers, and institutional affiliations as immutable. Never update information to reflect post-publication reality. Translate only w... | ar2en | Body | ART-25-9475861 | MEXICO (MEX), Politics, President, United Arab Emirates (UAE), Vice President of the State | [
{
"role": "system",
"content": "You are a professional Arabic↔English translator."
},
{
"role": "user",
"content": "يُرجى تحويل النص العربي التالي إلى الإنجليزية مع الحفاظ على المعنى:\nأبوظبي في 16 سبتمبر/ وام/ بعث صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة \"حفظه الله\"، برقية تهنئة إلى... |
ABU DHABI, 16th December, 2022 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a congratulatory message to His Majesty King Hamad bin Isa Al Khalifa of Bahrain, on the occasion of the Kingdom's National Day. His Highness Sheikh Mohammed bin Rashid Al Maktoum, Vice President, Prime Minister a... | أبوظبي في 16 ديسمبر / وام / بعث صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة "حفظه الله" برقية تهنئة إلى أخيه صاحب الجلالة الملك حمد بن عيسى آل خليفة ملك مملكة البحرين الشقيقة، بمناسبة ذكرى اليوم الوطني للمملكة. كما بعث صاحب السمو الشيخ محمد بن راشد آل مكتوم نائب رئيس الدولة رئيس مجلس الوزراء حاكم دبي "رعاه الله"... | ABU DHABI, 16th December, 2022 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a congratulatory message to His Majesty King Hamad bin Isa Al Khalifa of Bahrain, on the occasion of the Kingdom's National Day. His Highness Sheikh Mohammed bin Rashid Al Maktoum, Vice President, Prime Minister a... | أبوظبي في 16 ديسمبر / وام / بعث صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة "حفظه الله" برقية تهنئة إلى أخيه صاحب الجلالة الملك حمد بن عيسى آل خليفة ملك مملكة البحرين الشقيقة، بمناسبة ذكرى اليوم الوطني للمملكة. كما بعث صاحب السمو الشيخ محمد بن راشد آل مكتوم نائب رئيس الدولة رئيس مجلس الوزراء حاكم دبي "رعاه الله"... | You are an elite Arabic↔English translation engine for Emirates News Agency (WAM) official news content. Adhere strictly to these principles:
• **Factual Integrity:** Preserve all names, titles, dates, numbers, and entities exactly as in the source. Never substitute based on external knowledge. No additions or omissio... | en2ar | Body | ART-22-4075019 | GCC, World | [
{
"role": "system",
"content": "You are a professional Arabic↔English translator."
},
{
"role": "user",
"content": "Provide the Arabic translation of the following English text:\nABU DHABI, 16th December, 2022 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a congratu... |
ABU DHABI, 27th December, 2022 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan today discussed, during a telephone conversation, with Mohamed Ould Ghazouani, President of Mauritania, the bilateral relations between their countries, and the prospects for boosting cooperation to serve the interests of ... | أبوظبي في 27 ديسمبر/وام/ أجرى صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة "حفظه الله" اتصالاً هاتفياً مع فخامة محمد ولد الشيخ الغزواني رئيس الجمهورية الإسلامية الموريتانية الشقيقة.. بحثا خلاله العلاقات الأخوية بين دولة الإمارات وموريتانيا وفرص تنمية التعاون المشترك وتوسيع آفاقه بما يخدم مصالح البلدين وشعبيهما ال... | ABU DHABI, 27th December, 2022 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan today discussed, during a telephone conversation, with Mohamed Ould Ghazouani, President of Mauritania, the bilateral relations between their countries, and the prospects for boosting cooperation to serve the interests of ... | أبوظبي في 27 ديسمبر/وام/ أجرى صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة "حفظه الله" اتصالاً هاتفياً مع فخامة محمد ولد الشيخ الغزواني رئيس الجمهورية الإسلامية الموريتانية الشقيقة.. بحثا خلاله العلاقات الأخوية بين دولة الإمارات وموريتانيا وفرص تنمية التعاون المشترك وتوسيع آفاقه بما يخدم مصالح البلدين وشعبيهما ال... | You are an expert Arabic↔English translator for the Emirates News Agency (WAM). Follow WAM's institutional style guide strictly.
• Factual Fidelity & Register: Treat all titles, dates, numbers, and entities as immutable facts—never update based on external knowledge. Maintain a formal, journalistic, diplomatic registe... | en2ar | Body | ART-22-8366248 | GCC, United Arab Emirates (UAE), World | [
{
"role": "system",
"content": "You are an expert Arabic↔English translator for the Emirates News Agency (WAM). Follow WAM's institutional style guide strictly.\n\n• Factual Fidelity & Register: Treat all titles, dates, numbers, and entities as immutable facts—never update based on external knowledge. Maint... |
ABU DHABI, 18th December, 2025 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a message of congratulations to H.H. Sheikh Tamim bin Hamad Al Thani, Emir of Qatar, on the occasion of his country's National Day. His Highness Sheikh Mohammed bin Rashid Al Maktoum, Vice President, Prime Ministe... | أبوظبي في 18 ديسمبر/ وام/ بعث صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة "حفظه الله"، برقية تهنئة إلى أخيه صاحب السمو الشيخ تميم بن حمد آل ثاني أمير دولة قطر الشقيقة، بمناسبة ذكرى اليوم الوطني لبلاده. كما بعث صاحب السمو الشيخ محمد بن راشد آل مكتوم نائب رئيس الدولة رئيس مجلس الوزراء حاكم دبي "رعاه الله"، وسمو ال... | ABU DHABI, 18th December, 2025 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a message of congratulations to H.H. Sheikh Tamim bin Hamad Al Thani, Emir of Qatar, on the occasion of his country's National Day. His Highness Sheikh Mohammed bin Rashid Al Maktoum, Vice President, Prime Ministe... | أبوظبي في 18 ديسمبر/ وام/ بعث صاحب السمو الشيخ محمد بن زايد آل نهيان رئيس الدولة "حفظه الله"، برقية تهنئة إلى أخيه صاحب السمو الشيخ تميم بن حمد آل ثاني أمير دولة قطر الشقيقة، بمناسبة ذكرى اليوم الوطني لبلاده. كما بعث صاحب السمو الشيخ محمد بن راشد آل مكتوم نائب رئيس الدولة رئيس مجلس الوزراء حاكم دبي "رعاه الله"، وسمو ال... | Role: WAM (Emirates News Agency) Arabic↔English Translator. Output: Accurate, fluent, formal diplomatic news copy.
**CORE RULES**
- **Fact Integrity:** Preserve entities, titles, ranks, dates, numbers, affiliations verbatim. No external updates/inferences. Source > Reality.
- **No Add/Omit:** Except explicit WAM conve... | en2ar | Body | ART-25-0833633 | Politics, QATAR (QAT), United Arab Emirates (UAE) | [
{
"role": "system",
"content": "You are a professional Arabic↔English translator."
},
{
"role": "user",
"content": "Translate to Arabic:\nABU DHABI, 18th December, 2025 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a message of congratulations to H.H. Sheikh Tamim b... |
ABU DHABI, 22nd May, 2024 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan today bestowed the First Class Order of Zayed II on several global dignitaries in recognition of their contributions to the success of the 28th Conference of the Parties to the UN Framework Convention on Climate Change (COP28) ... | - سموه يمنح المكرمين "وسام زايد الثاني" من الطبقة الأولى تقديراً لجهودهم في إنجاح "COP28". - رئيس الدولة: إرث المؤسس الشيخ زايد ركيزة أساسية لجهود الإمارات في مجال الاستدامة وتعزيز العمل المناخي العالمي. - رئيس الدولة: الإمارات حريصة على دعم التعاون الدولي لدفع العمل المناخي وإيجاد حلول عملية لتحديات تغير المناخ من خلا... | - سموه يمنح المكرمين "وسام زايد الثاني" من الطبقة الأولى تقديراً لجهودهم في إنجاح "COP28". - رئيس الدولة: إرث المؤسس الشيخ زايد ركيزة أساسية لجهود الإمارات في مجال الاستدامة وتعزيز العمل المناخي العالمي. - رئيس الدولة: الإمارات حريصة على دعم التعاون الدولي لدفع العمل المناخي وإيجاد حلول عملية لتحديات تغير المناخ من خلا... | ABU DHABI, 22nd May, 2024 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan today bestowed the First Class Order of Zayed II on several global dignitaries in recognition of their contributions to the success of the 28th Conference of the Parties to the UN Framework Convention on Climate Change (COP28) ... | You are an expert bidirectional Arabic↔English translator for Emirates News Agency (WAM) official news content. Follow WAM house style strictly.
- **Factual Integrity**: Preserve all entities, titles, dates, numbers, and institutional references exactly as in the source. Never update, infer, or correct based on extern... | ar2en | Body | ART-24-3653984 | General, United Arab Emirates (UAE) | [
{
"role": "system",
"content": "You are an expert bidirectional Arabic↔English translator for Emirates News Agency (WAM) official news content. Follow WAM house style strictly.\n\n- **Factual Integrity**: Preserve all entities, titles, dates, numbers, and institutional references exactly as in the source. N... |
ABU DHABI, 3rd February, 2026 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a message of condolences to King Abdullah II bin Al Hussein of the Hashemite Kingdom of Jordan over the passing of former prime minister Ahmad Obeidat. His Highness Sheikh Mohammed bin Rashid Al Maktoum, Vice Presi... | أبوظبي في 3 فبراير/ وام/ بعث صاحب السمو الشيخ محمد بن زايد آل نهيان، رئيس الدولة "حفظه الله" برقية تعزية إلى أخيه صاحب الجلالة الملك عبدالله الثاني بن الحسين، ملك المملكة الأردنية الهاشمية الشقيقة، في وفاة رئيس الوزراء الأسبق دولة أحمد عبيدات. كما بعث صاحب السمو الشيخ محمد بن راشد آل مكتوم نائب رئيس الدولة رئيس مجلس ال... | ABU DHABI, 3rd February, 2026 (WAM) -- President His Highness Sheikh Mohamed bin Zayed Al Nahyan has sent a message of condolences to King Abdullah II bin Al Hussein of the Hashemite Kingdom of Jordan over the passing of former prime minister Ahmad Obeidat. His Highness Sheikh Mohammed bin Rashid Al Maktoum, Vice Presi... | أبوظبي في 3 فبراير/ وام/ بعث صاحب السمو الشيخ محمد بن زايد آل نهيان، رئيس الدولة "حفظه الله" برقية تعزية إلى أخيه صاحب الجلالة الملك عبدالله الثاني بن الحسين، ملك المملكة الأردنية الهاشمية الشقيقة، في وفاة رئيس الوزراء الأسبق دولة أحمد عبيدات. كما بعث صاحب السمو الشيخ محمد بن راشد آل مكتوم نائب رئيس الدولة رئيس مجلس ال... | You are a bidirectional Arabic↔English translator for the Emirates News Agency (WAM). Follow these core principles:
1. **Factual Integrity & Verbatim Roles**: Preserve all facts, titles, ranks, and roles exactly as in the source. Never substitute or update based on external knowledge. Zero additions or omissions of su... | en2ar | Body | ART-26-6454682 | Politics, United Arab Emirates (UAE) | [
{
"role": "system",
"content": "You are a bidirectional Arabic↔English translator for the Emirates News Agency (WAM). Follow these core principles:\n\n1. **Factual Integrity & Verbatim Roles**: Preserve all facts, titles, ranks, and roles exactly as in the source. Never substitute or update based on externa... |
UAE President visits IDEX 2025 | رئيس الدولة يزور معرض "آيدكس 2025" | رئيس الدولة يزور معرض "آيدكس 2025" | UAE President visits IDEX 2025 | You are an expert bilingual translator for official Emirates News Agency (WAM) content, translating between Arabic and English.
- **Factual Integrity & Fidelity**: Preserve all facts, titles, ranks, dates, numbers, and institutional affiliations exactly as in the source. Never add, omit, infer, or update information. ... | ar2en | Title | ART-25-3053145 | General, United Arab Emirates (UAE) | [
{
"role": "system",
"content": "You are a professional Arabic↔English translator."
},
{
"role": "user",
"content": "Please translate the following text from Arabic to English:\nرئيس الدولة يزور معرض \"آيدكس 2025\""
},
{
"role": "assistant",
"content": "UAE President visits IDEX 2025"... |
"ABU DHABI, 7th May, 2026 (WAM) -- Building on the longstanding strategic partnership between the Un(...TRUNCATED) | "أبوظبي في 7 مايو/ وام/ في إطار الشراكة الاستراتيجية الو(...TRUNCATED) | "أبوظبي في 7 مايو/ وام/ في إطار الشراكة الاستراتيجية الو(...TRUNCATED) | "ABU DHABI, 7th May, 2026 (WAM) -- Building on the longstanding strategic partnership between the Un(...TRUNCATED) | "You are a professional Arabic↔English translator for Emirates News Agency (WAM) official content.(...TRUNCATED) | ar2en | Body | ART-26-5289952 | FRANCE (FRA), General, United Arab Emirates (UAE) | [{"role":"system","content":"You are a professional Arabic↔English translator."},{"role":"user","c(...TRUNCATED) |
"ABU DHABI, 5th February, 2024 (WAM) -- Sheikh Nahyan bin Mubarak Al Nahyan, Minister of Tolerance a(...TRUNCATED) | "أبوظبي في 5 فبراير/ وام/ افتتح معالي الشيخ نهيان بن مبار(...TRUNCATED) | "ABU DHABI, 5th February, 2024 (WAM) -- Sheikh Nahyan bin Mubarak Al Nahyan, Minister of Tolerance a(...TRUNCATED) | "أبوظبي في 5 فبراير/ وام/ افتتح معالي الشيخ نهيان بن مبار(...TRUNCATED) | "You are a bidirectional Arabic↔English translator for Emirates News Agency (WAM) official content(...TRUNCATED) | en2ar | Body | ART-24-0729775 | General, United Arab Emirates (UAE), World, Year of Tolerance | [{"role":"system","content":"You are a bidirectional Arabic↔English translator for Emirates News A(...TRUNCATED) |
Translator Rules Dataset
A high-quality Arabic↔English machine-translation dataset built from the WAM (Web Archive Management) translation corpus — 10 years of professional Arabic↔English news/government translations — augmented with 200 LLM-extracted translation rules embedded in system prompts, and mixed with ~7% general-instruction data to prevent catastrophic forgetting during fine-tuning.
Dataset Statistics
| Split | Rows | MT rows | General rows | General % |
|---|---|---|---|---|
| Train | 15,028 | 13,948 | 1,080 | 7.2% |
| Validation | 1,668 | 1,548 | 120 | 7.2% |
| Total | 16,696 | 15,496 | 1,200 | 7.2% |
Token Length Analysis
Measured on the full concatenated message text (system + user + assistant) using both target model tokenizers:
| Metric | Karnak-6B-v1.0 | Qwen3.5-4B |
|---|---|---|
| Vocab size | 192,726 | 248,044 |
| Model max length | 131,072 | 262,144 |
| Absolute max | 17,209 | 17,955 |
| p99 | 12,950 | 13,559 |
| p95 | 11,554 | 12,225 |
| Mean | 4,973 | 5,241 |
| Median | 5,374 | 5,711 |
Karnak's Arabic-optimized tokenizer consistently produces ~600–700 fewer tokens per example.
Token length distribution (Karnak)
| Bucket (tokens) | Count | % |
|---|---|---|
| 0–512 | 4,878 | 29.2% |
| 512–1024 | 1,038 | 6.2% |
| 1024–2048 | 695 | 4.2% |
| 2048–4096 | 1,177 | 7.0% |
| 4096–8192 | 3,906 | 23.4% |
| 8192–16384 | 4,999 | 29.9% |
| 16384–32768 | 3 | 0.0% |
Recommendation:
max_seq_len=16384covers 99.98% of the dataset (only 3 rows exceed it).
Row Schema
Each row is a single translation turn with full metadata:
| Field | Type | Description |
|---|---|---|
english |
str |
Original English text |
arabic |
str |
Original Arabic text |
source |
str |
Source text (depends on direction) |
translation |
str |
Target text (depends on direction) |
system_prompt |
str |
System prompt (may contain translation rules) |
direction |
str |
en2ar, ar2en, or general |
field |
str |
Title, Body (MT), or category (math/code/qa/creative for general) |
code |
str |
WAM article code (empty for general) |
classifications |
str |
WAM classifications (category name for general) |
messages |
list[dict] |
Chat messages: [{role, content}, ...] |
Messages format
[
{"role": "system", "content": "<rules prompt or minimal/empty>"},
{"role": "user", "content": "<instruction + source text>"},
{"role": "assistant", "content": "<target translation>"}
]
The system message may be omitted entirely (empty-system mode) — see Message Structure Randomization below.
How the Dataset Was Built
The dataset is produced by a multi-stage pipeline that extracts translation rules from the corpus itself, cleans and filters the data, then mixes in general-instruction examples.
1. Corpus Loading & Chunking
- Parses the WAM corpus JSON (~3,900 Arabic↔English translation entries)
- Validates that both AR and EN sides have non-empty
TitleandBodyfields - Chunks entries into contiguous blocks of 3–5 pairs for LLM rule extraction
2. Translation Rule Extraction
- For each block of 3–5 translation pairs, an LLM extracts translation rules
- Rules capture patterns like: number formatting, date conventions, named-entity handling, register/tone, punctuation, etc.
- Temperature: 0.2 (consistent extraction)
3. Map-Reduce Consolidation
Two-stage consolidation of per-block rules into a final set of 200 rules:
- Map stage: Block rule sets are batched (15 blocks per batch) and sent to the LLM for deduplication/merging into cluster-level rules
- Reduce stage: All clusters are consolidated in a single LLM call producing exactly
num_rules(200) final rules
- Temperature: 0.3
4. System Prompt Generation
- Generates 100 unique system prompts from the consolidated rules
- Each prompt samples
rules_per_category(10) rules from each category - LLM rewrites them into a self-contained translation-agent system prompt
- Temperature: 0.7 (high diversity)
- Each entry in the dataset gets assigned one of the 100 prompts (deterministic round-robin)
5. Data Cleaning & Pair Filtering
This is the critical quality-control step. It performs two operations:
A. Data Cleaning
Applied to all text fields before LLM filtering and before dataset building:
URL normalization:
- Strips
http:///https://scheme fromwww.*URLs (barewww.example.comform) - Lowercases scheme and host
- Removes URL fragments (
#section) - Removes trailing slashes
- Strips attached punctuation (including Arabic comma
،and Arabic full stop.) - Ensures the same site isn't counted as different across AR/EN sides
- Strips
Repeated punctuation collapse:
- Regex:
([!?.;,:\-_=*])\1{3,}— runs of 4+ identical punctuation marks → collapsed to 1 - Handles real-world WAM corpus artifacts:
............(section separators),------------(horizontal rules),*****(email-scanner footer markers) - Markdown table separators (
|------|) in system prompts are preserved (they're legitimate formatting, not decorative runs)
- Regex:
B. LLM Pair Filtering
Some AR↔EN pairs in the WAM corpus describe the same event but contain different numbers, dates, names, or factual details. These are removed:
- Each entry's
TitleandBodyfields are checked independently (2 checks per entry) - Two LLM endpoints run in parallel for throughput
- Temperature: 0.1 (consistent factual judgments)
- LLM classifies each pair as
match/mismatch/skip(empty text) /unknown - URL-mismatched entries (where AR/EN URL sets differ after normalization) are flagged
- Mismatched pairs are excluded from the dataset
6. Dataset Build
Builds a HuggingFace DatasetDict with train/validation splits:
- Entry-level split: 10% of entries reserved for validation (no translation pair leaks across splits)
- 100 entries reserved for manual validation (excluded from train/eval)
- Each MT entry produces 2 fields × 2 directions = 4 rows (Title-en2ar, Title-ar2en, Body-en2ar, Body-ar2en)
- Uses cleaned entries (URL-normalized + punctuation-fixed) from the filter stage
- Mismatched pairs (from LLM filtering) are excluded
7. General Data Mixing
Augments the MT dataset with ~1,200 general-instruction examples to prevent catastrophic forgetting of general capabilities (math, code, QA, creative) during fine-tuning.
Sources
| Category | Count | Source HF Dataset | Format |
|---|---|---|---|
| Math | 300 | meta-math/MetaMathQA |
query → response |
| Code (Python) | 240 | HuggingFaceH4/CodeAlpaca_20K |
prompt → completion (Python-only filter) |
| QA | 360 | yahma/alpaca-cleaned |
instruction+input → output |
| Creative | 300 | Magpie-Align/Magpie-Air-300K-Filtered |
ShareGPT → first turn |
| Total | 1,200 |
Filters applied to general data
- Length filter: examples where
len(user) + len(assistant) > 3000chars are skipped (keeps token budget manageable) - Python-only filter (code): looks for Python markers (
python,def,import,print(,pip,django,flask,pandas,numpy) - First-turn extraction (creative): extracts only the first human→gpt turn from ShareGPT conversations
System prompt randomization for general data
- 30% of general rows get an empty system prompt (no system message)
- 70% get a role-based system prompt (3 variants per category, randomly selected)
Mixing process
- Load MT dataset
- Load 1,200 general samples from 4 HF datasets
- Split general into train/validation at 10% (120 val / 1,080 train)
- Concatenate per-split: MT + general
- Shuffle with seed=42
Final mix ratio: ~92.8% MT + ~7.2% general per split
Message Structure Randomization
To maximize prompt diversity and robustness, the MT dataset uses 5 weighted prompt modes for each row. The mode is selected via weighted random roll (deterministic, seed=123):
| Mode | Weight | System | User |
|---|---|---|---|
rules_system_instr_user |
35% | Full rules prompt | Translation instruction + source text |
rules_user_minimal_sys |
20% | Minimal: "You are a professional Arabic↔English translator." | Rules + instruction + source text |
no_rules_empty_sys |
20% | Empty (omitted) | Instruction + source text |
no_rules_minimal_sys |
15% | Minimal | Instruction + source text |
rules_system_bare_user |
10% | Full rules prompt | Bare source text (no instruction) |
Instruction templates
29 templates per direction (en2ar and ar2en), covering:
- Short imperative:
"Translate to Arabic:\n{src}" - Descriptive English:
"Please translate the following text from English to Arabic:\n{src}" - Arabic instructions (short):
"ترجم إلى العربية:\n{src}" - Arabic instructions (descriptive):
"أرجو ترجمة النص التالي من الإنجليزية إلى العربية:\n{src}" - Mixed/unconventional:
"EN → AR:\n{src}","[English] → [Arabic]\n{src}"
Actual distribution (train split, 15,028 rows)
| Mode | Count | % |
|---|---|---|
| rules_system_bare_user | 3,380 | 22.5% |
| rules_system_instr_user | 2,922 | 19.4% |
| no_rules_empty_sys | 2,763 | 18.4% |
| rules_user_minimal_sys | 2,752 | 18.3% |
| no_rules_minimal_sys | 2,131 | 14.2% |
| General (mixed) | 1,080 | 7.2% |
Data Quality Verification
URL normalization ✅
- 0 issues found across all 16,696 rows
- All URLs properly normalized: bare
www.example.comform (nohttp://scheme, no fragments, no trailing slashes) - Example:
www.abudhabiawards.ae,www.wcems.ae
Repeated punctuation ✅
- 0 real violations in corpus text fields (
english,arabic,source,translation) - 5,343 regex matches total, but all are legitimate:
- 5,338 are markdown table separators (
|------|) in system prompts containing translation rules — these are intentional formatting, not decorative runs - 5 are markdown table separators in one translation that contains a table
- 1 is a fill-in-the-blank exercise (
_____) in a source text — legitimate content
- 5,338 are markdown table separators (
Shuffle quality ✅
- General data uniformly distributed at ~7% per 1,000-row bucket across the train split
- Max consecutive general run: 4 rows
- Max consecutive MT run: 96 rows (no clustering)
Target Models
| Model | Parameters | Vocab | Max context |
|---|---|---|---|
| Applied-Innovation-Center/Karnak-6B-v1.0 | 6B | 192,726 | 131,072 |
| Qwen/Qwen3.5-4B | 4B | 248,044 | 262,144 |
Karnak's tokenizer is optimized for Arabic, producing ~600–700 fewer tokens per example than Qwen on the same text.
Reproducibility
- All random operations use fixed seeds (chunking, rule sampling, prompt mode assignment, general data shuffle — all seed=42 or 123)
- LLM calls use low temperatures (0.1–0.7) for consistency
- Filter and extraction steps are fully resumable (incremental saves)
Source Data
- WAM Corpus: 10 years of professional Arabic↔English government/news translations
- General data sources: MetaMathQA, CodeAlpaca_20K, alpaca-cleaned, Magpie-Air-300K-Filtered — all public HuggingFace datasets
- Translation rules: 200 rules extracted and consolidated by LLM from the WAM corpus itself
- Downloads last month
- 68