{
  "id": 684246,
  "title": "2-Stage CV, CPT & MBR Decoding",
  "url": "/competitions/deep-past-initiative-machine-translation/discussion/684246",
  "author_name": "Musa Peker",
  "post_date": "2026-03-24T07:17:29.778000",
  "votes": 5,
  "comment_count": 0,
  "views": 0,
  "content": "<h1>Akkadian Translation: 2-Stage CV, CPT &amp; MBR Decoding</h1>\n<p>First of all, congratulations to the winners and many thanks to the organizers for hosting this competition. My strategy was designed around building a stable pipeline that leverages continual pre-training and advanced decoding techniques.</p>\n<p>Here is a high-level overview of my approach.</p>\n<hr>\n<h2>1. Foundation: Continual Pre-Training (CPT)</h2>\n<p>Instead of starting fine-tuning directly from <code>google/byt5-base</code>, I established a baseline foundation through <strong>Continual Pre-Training (CPT)</strong>. \nI took the vanilla <code>byt5-base</code> model and subjected it to an unsupervised/self-supervised pre-training phase over a corpus of <strong>domain-specific Akkadian text</strong>. </p>\n<p><strong>Why Continual Pre-Training?</strong>\nAncient languages exhibit massive domain shifts compared to modern languages (which standard T5 models are trained on). By allowing the model to freely learn the morphological structures, cuneiform transliteration patterns, and phonotactics of Akkadian <em>before</em> introducing the translation alignment objective, the network builds a structural understanding of the source language. This CPT phase transformed a generalized multilingual model into an Akkadian-aware backbone, providing a stable prior for downstream fine-tuning.</p>\n<h2>2. Data Strategy &amp; Normalization</h2>\n<p>Machine translation for ancient languages is often noisy. I built preprocessors and postprocessors optimized with regex and vectorized operations:</p>\n<ul>\n<li><strong>Gaps &amp; Breaks:</strong> Unified all gap representations (<code>&lt; gap &gt;</code>, <code>big gap</code>, <code>broken lines</code>, <code>x x</code>) into a canonical <code>&lt;gap&gt;</code> token.</li>\n<li><strong>Fractions:</strong> Mapped numeric decimals accurately to exact Unicode fractions (e.g., <code>0.8333 $\\to$ 5/6</code>).</li>\n<li><strong>Diacritics &amp; Determinatives:</strong> Handled uppercase/lowercase transliteration conventions, converting numeric notations (like $a_2, a_3$) to properly accented characters (á, à) to harmonize the input space.</li>\n<li><strong>Leakage Prevention:</strong> When mixing <strong>Cleaned external data</strong>, overlap checks were implemented so validation targets were unseen during training.</li>\n</ul>\n<h2>3. Training Strategy: Supervised Fine-Tuning (SFT) via 2-Stage 3-Fold CV</h2>\n<p>Starting from the CPT-enhanced Base Model, I utilized a <strong>Group K-Fold (k=3)</strong> grouped by unique identifiers. Inside each fold, the Supervised Fine-Tuning (SFT) process follows a 2-stage approach:</p>\n<ul>\n<li><strong>Stage 1 (Mixed SFT):</strong> The model is trained on a combination of the <strong>Official training data</strong> and <strong>Cleaned external data</strong> for <strong>10 epochs</strong>. This expands the vocabulary and syntax understanding.</li>\n<li><strong>Stage 2 (Refinement SFT):</strong> A secondary fine-tuning pass <strong>only</strong> on the <strong>clean Official training data</strong> for <strong>5 epochs</strong>, with the learning rate scaled down by <code>0.1x</code>. This helps the model adapt precisely to the target distribution of the competition. </li>\n</ul>\n<p>Early stopping and grouped evaluation were used to monitor overfitting.</p>\n<h2>4. The Final Soup (Averaging the Folds)</h2>\n<p>At the end of the cross-validation phase, three checkpoints emerge. </p>\n<p>Standard prediction ensembling—where multiple models generate translations simultaneously and vote—is memory-intensive and often unfeasible under strict inference time limits. To solve this, I applied <strong>Weight Averaging (Model Souping)</strong> across the 3 fold models. </p>\n<p><strong>Why a Final Soup?</strong>\nBy mathematically averaging the weights of the 3 fold checkpoints (giving 1/3 weight to each) into a single unified model, the architecture achieves some of the variance-reduction benefits of an ensemble, but at the computational inference cost of a single model. It essentially smooths the loss landscape without any latency penalty during the decoding phase.</p>\n<h2>5. Inference Optimization &amp; MBR Decoding</h2>\n<p>The inference engine was optimized to maintain translation quality under compute limits:</p>\n<ul>\n<li><strong>Hardware Accel:</strong> BF16 precision + optimized transformer backends.</li>\n<li><strong>Bucket Batching:</strong> Sorted samples by length to minimize padding overhead. Adaptive beam sizes (short texts got fewer beams) kept generation fast.</li>\n<li><strong>Minimum Bayes Risk (MBR) Decoding:</strong><ul>\n<li>Generated a pool of up to 10 candidates using Beam Search (beams=12).</li>\n<li>Ranked candidates using a modified <strong>CHRF++</strong> algorithm.</li>\n<li>Added penalties for <strong>Gap-Mismatches</strong> (comparing <code>&lt;gap&gt;</code> counts between the Akkadian source and English candidate).</li>\n<li>Factored in a self-confidence bonus based on original beam rank.</li></ul></li>\n</ul>\n<p>It was a great learning experience blending modern NLP techniques with Assyriology. Thanks for reading!</p>",
  "messages": [
    {
      "id": 3427511,
      "postDate": "2026-03-24T07:17:29.780Z",
      "content": "<h1>Akkadian Translation: 2-Stage CV, CPT &amp; MBR Decoding</h1>\n<p>First of all, congratulations to the winners and many thanks to the organizers for hosting this competition. My strategy was designed around building a stable pipeline that leverages continual pre-training and advanced decoding techniques.</p>\n<p>Here is a high-level overview of my approach.</p>\n<hr>\n<h2>1. Foundation: Continual Pre-Training (CPT)</h2>\n<p>Instead of starting fine-tuning directly from <code>google/byt5-base</code>, I established a baseline foundation through <strong>Continual Pre-Training (CPT)</strong>. \nI took the vanilla <code>byt5-base</code> model and subjected it to an unsupervised/self-supervised pre-training phase over a corpus of <strong>domain-specific Akkadian text</strong>. </p>\n<p><strong>Why Continual Pre-Training?</strong>\nAncient languages exhibit massive domain shifts compared to modern languages (which standard T5 models are trained on). By allowing the model to freely learn the morphological structures, cuneiform transliteration patterns, and phonotactics of Akkadian <em>before</em> introducing the translation alignment objective, the network builds a structural understanding of the source language. This CPT phase transformed a generalized multilingual model into an Akkadian-aware backbone, providing a stable prior for downstream fine-tuning.</p>\n<h2>2. Data Strategy &amp; Normalization</h2>\n<p>Machine translation for ancient languages is often noisy. I built preprocessors and postprocessors optimized with regex and vectorized operations:</p>\n<ul>\n<li><strong>Gaps &amp; Breaks:</strong> Unified all gap representations (<code>&lt; gap &gt;</code>, <code>big gap</code>, <code>broken lines</code>, <code>x x</code>) into a canonical <code>&lt;gap&gt;</code> token.</li>\n<li><strong>Fractions:</strong> Mapped numeric decimals accurately to exact Unicode fractions (e.g., <code>0.8333 $\\to$ 5/6</code>).</li>\n<li><strong>Diacritics &amp; Determinatives:</strong> Handled uppercase/lowercase transliteration conventions, converting numeric notations (like $a_2, a_3$) to properly accented characters (á, à) to harmonize the input space.</li>\n<li><strong>Leakage Prevention:</strong> When mixing <strong>Cleaned external data</strong>, overlap checks were implemented so validation targets were unseen during training.</li>\n</ul>\n<h2>3. Training Strategy: Supervised Fine-Tuning (SFT) via 2-Stage 3-Fold CV</h2>\n<p>Starting from the CPT-enhanced Base Model, I utilized a <strong>Group K-Fold (k=3)</strong> grouped by unique identifiers. Inside each fold, the Supervised Fine-Tuning (SFT) process follows a 2-stage approach:</p>\n<ul>\n<li><strong>Stage 1 (Mixed SFT):</strong> The model is trained on a combination of the <strong>Official training data</strong> and <strong>Cleaned external data</strong> for <strong>10 epochs</strong>. This expands the vocabulary and syntax understanding.</li>\n<li><strong>Stage 2 (Refinement SFT):</strong> A secondary fine-tuning pass <strong>only</strong> on the <strong>clean Official training data</strong> for <strong>5 epochs</strong>, with the learning rate scaled down by <code>0.1x</code>. This helps the model adapt precisely to the target distribution of the competition. </li>\n</ul>\n<p>Early stopping and grouped evaluation were used to monitor overfitting.</p>\n<h2>4. The Final Soup (Averaging the Folds)</h2>\n<p>At the end of the cross-validation phase, three checkpoints emerge. </p>\n<p>Standard prediction ensembling—where multiple models generate translations simultaneously and vote—is memory-intensive and often unfeasible under strict inference time limits. To solve this, I applied <strong>Weight Averaging (Model Souping)</strong> across the 3 fold models. </p>\n<p><strong>Why a Final Soup?</strong>\nBy mathematically averaging the weights of the 3 fold checkpoints (giving 1/3 weight to each) into a single unified model, the architecture achieves some of the variance-reduction benefits of an ensemble, but at the computational inference cost of a single model. It essentially smooths the loss landscape without any latency penalty during the decoding phase.</p>\n<h2>5. Inference Optimization &amp; MBR Decoding</h2>\n<p>The inference engine was optimized to maintain translation quality under compute limits:</p>\n<ul>\n<li><strong>Hardware Accel:</strong> BF16 precision + optimized transformer backends.</li>\n<li><strong>Bucket Batching:</strong> Sorted samples by length to minimize padding overhead. Adaptive beam sizes (short texts got fewer beams) kept generation fast.</li>\n<li><strong>Minimum Bayes Risk (MBR) Decoding:</strong><ul>\n<li>Generated a pool of up to 10 candidates using Beam Search (beams=12).</li>\n<li>Ranked candidates using a modified <strong>CHRF++</strong> algorithm.</li>\n<li>Added penalties for <strong>Gap-Mismatches</strong> (comparing <code>&lt;gap&gt;</code> counts between the Akkadian source and English candidate).</li>\n<li>Factored in a self-confidence bonus based on original beam rank.</li></ul></li>\n</ul>\n<p>It was a great learning experience blending modern NLP techniques with Assyriology. Thanks for reading!</p>",
      "rawMarkdown": "# Akkadian Translation: 2-Stage CV, CPT & MBR Decoding\n\nFirst of all, congratulations to the winners and many thanks to the organizers for hosting this competition. My strategy was designed around building a stable pipeline that leverages continual pre-training and advanced decoding techniques.\n\nHere is a high-level overview of my approach.\n\n---\n\n## 1. Foundation: Continual Pre-Training (CPT)\nInstead of starting fine-tuning directly from `google/byt5-base`, I established a baseline foundation through **Continual Pre-Training (CPT)**. \nI took the vanilla `byt5-base` model and subjected it to an unsupervised/self-supervised pre-training phase over a corpus of **domain-specific Akkadian text**. \n\n**Why Continual Pre-Training?**\nAncient languages exhibit massive domain shifts compared to modern languages (which standard T5 models are trained on). By allowing the model to freely learn the morphological structures, cuneiform transliteration patterns, and phonotactics of Akkadian *before* introducing the translation alignment objective, the network builds a structural understanding of the source language. This CPT phase transformed a generalized multilingual model into an Akkadian-aware backbone, providing a stable prior for downstream fine-tuning.\n\n## 2. Data Strategy & Normalization\nMachine translation for ancient languages is often noisy. I built preprocessors and postprocessors optimized with regex and vectorized operations:\n* **Gaps & Breaks:** Unified all gap representations (`< gap >`, `big gap`, `broken lines`, `x x`) into a canonical `<gap>` token.\n* **Fractions:** Mapped numeric decimals accurately to exact Unicode fractions (e.g., `0.8333 $\\to$ 5/6`).\n* **Diacritics & Determinatives:** Handled uppercase/lowercase transliteration conventions, converting numeric notations (like $a_2, a_3$) to properly accented characters (á, à) to harmonize the input space.\n* **Leakage Prevention:** When mixing **Cleaned external data**, overlap checks were implemented so validation targets were unseen during training.\n\n## 3. Training Strategy: Supervised Fine-Tuning (SFT) via 2-Stage 3-Fold CV\nStarting from the CPT-enhanced Base Model, I utilized a **Group K-Fold (k=3)** grouped by unique identifiers. Inside each fold, the Supervised Fine-Tuning (SFT) process follows a 2-stage approach:\n\n* **Stage 1 (Mixed SFT):** The model is trained on a combination of the **Official training data** and **Cleaned external data** for **10 epochs**. This expands the vocabulary and syntax understanding.\n* **Stage 2 (Refinement SFT):** A secondary fine-tuning pass **only** on the **clean Official training data** for **5 epochs**, with the learning rate scaled down by `0.1x`. This helps the model adapt precisely to the target distribution of the competition. \n\nEarly stopping and grouped evaluation were used to monitor overfitting.\n\n## 4. The Final Soup (Averaging the Folds)\nAt the end of the cross-validation phase, three checkpoints emerge. \n\nStandard prediction ensembling—where multiple models generate translations simultaneously and vote—is memory-intensive and often unfeasible under strict inference time limits. To solve this, I applied **Weight Averaging (Model Souping)** across the 3 fold models. \n\n**Why a Final Soup?**\nBy mathematically averaging the weights of the 3 fold checkpoints (giving 1/3 weight to each) into a single unified model, the architecture achieves some of the variance-reduction benefits of an ensemble, but at the computational inference cost of a single model. It essentially smooths the loss landscape without any latency penalty during the decoding phase.\n\n## 5. Inference Optimization & MBR Decoding\nThe inference engine was optimized to maintain translation quality under compute limits:\n* **Hardware Accel:** BF16 precision + optimized transformer backends.\n* **Bucket Batching:** Sorted samples by length to minimize padding overhead. Adaptive beam sizes (short texts got fewer beams) kept generation fast.\n* **Minimum Bayes Risk (MBR) Decoding:**\n  * Generated a pool of up to 10 candidates using Beam Search (beams=12).\n  * Ranked candidates using a modified **CHRF++** algorithm.\n  * Added penalties for **Gap-Mismatches** (comparing `<gap>` counts between the Akkadian source and English candidate).\n  * Factored in a self-confidence bonus based on original beam rank.\n\nIt was a great learning experience blending modern NLP techniques with Assyriology. Thanks for reading!",
      "votes": 5
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "3427511": "# Akkadian Translation: 2-Stage CV, CPT & MBR Decoding\n\nFirst of all, congratulations to the winners and many thanks to the organizers for hosting this competition. My strategy was designed around building a stable pipeline that leverages continual pre-training and advanced decoding techniques.\n\nHere is a high-level overview of my approach.\n\n---\n\n## 1. Foundation: Continual Pre-Training (CPT)\nInstead of starting fine-tuning directly from `google/byt5-base`, I established a baseline foundation through **Continual Pre-Training (CPT)**. \nI took the vanilla `byt5-base` model and subjected it to an unsupervised/self-supervised pre-training phase over a corpus of **domain-specific Akkadian text**. \n\n**Why Continual Pre-Training?**\nAncient languages exhibit massive domain shifts compared to modern languages (which standard T5 models are trained on). By allowing the model to freely learn the morphological structures, cuneiform transliteration patterns, and phonotactics of Akkadian *before* introducing the translation alignment objective, the network builds a structural understanding of the source language. This CPT phase transformed a generalized multilingual model into an Akkadian-aware backbone, providing a stable prior for downstream fine-tuning.\n\n## 2. Data Strategy & Normalization\nMachine translation for ancient languages is often noisy. I built preprocessors and postprocessors optimized with regex and vectorized operations:\n* **Gaps & Breaks:** Unified all gap representations (`< gap >`, `big gap`, `broken lines`, `x x`) into a canonical `<gap>` token.\n* **Fractions:** Mapped numeric decimals accurately to exact Unicode fractions (e.g., `0.8333 $\\to$ 5/6`).\n* **Diacritics & Determinatives:** Handled uppercase/lowercase transliteration conventions, converting numeric notations (like $a_2, a_3$) to properly accented characters (á, à) to harmonize the input space.\n* **Leakage Prevention:** When mixing **Cleaned external data**, overlap checks were implemented so validation targets were unseen during training.\n\n## 3. Training Strategy: Supervised Fine-Tuning (SFT) via 2-Stage 3-Fold CV\nStarting from the CPT-enhanced Base Model, I utilized a **Group K-Fold (k=3)** grouped by unique identifiers. Inside each fold, the Supervised Fine-Tuning (SFT) process follows a 2-stage approach:\n\n* **Stage 1 (Mixed SFT):** The model is trained on a combination of the **Official training data** and **Cleaned external data** for **10 epochs**. This expands the vocabulary and syntax understanding.\n* **Stage 2 (Refinement SFT):** A secondary fine-tuning pass **only** on the **clean Official training data** for **5 epochs**, with the learning rate scaled down by `0.1x`. This helps the model adapt precisely to the target distribution of the competition. \n\nEarly stopping and grouped evaluation were used to monitor overfitting.\n\n## 4. The Final Soup (Averaging the Folds)\nAt the end of the cross-validation phase, three checkpoints emerge. \n\nStandard prediction ensembling—where multiple models generate translations simultaneously and vote—is memory-intensive and often unfeasible under strict inference time limits. To solve this, I applied **Weight Averaging (Model Souping)** across the 3 fold models. \n\n**Why a Final Soup?**\nBy mathematically averaging the weights of the 3 fold checkpoints (giving 1/3 weight to each) into a single unified model, the architecture achieves some of the variance-reduction benefits of an ensemble, but at the computational inference cost of a single model. It essentially smooths the loss landscape without any latency penalty during the decoding phase.\n\n## 5. Inference Optimization & MBR Decoding\nThe inference engine was optimized to maintain translation quality under compute limits:\n* **Hardware Accel:** BF16 precision + optimized transformer backends.\n* **Bucket Batching:** Sorted samples by length to minimize padding overhead. Adaptive beam sizes (short texts got fewer beams) kept generation fast.\n* **Minimum Bayes Risk (MBR) Decoding:**\n  * Generated a pool of up to 10 candidates using Beam Search (beams=12).\n  * Ranked candidates using a modified **CHRF++** algorithm.\n  * Added penalties for **Gap-Mismatches** (comparing `<gap>` counts between the Akkadian source and English candidate).\n  * Factored in a self-confidence bonus based on original beam rank.\n\nIt was a great learning experience blending modern NLP techniques with Assyriology. Thanks for reading!"
  }
}