Mag-skip sa main content

Quality Gate

Dumadaan ang bawat translation sa isang deterministic validation gate bago ito i-write sa disk. Sinasalo ng quality gate ang mga common machine translation failure modes — walang silent fallbacks, at walang garbage na isusulat sa inyong mga locale files.

Validation Checks

CheckAno ang Sinasalo NitoGate Label
Empty/blankNag-return ang model ng empty string o whitespace[GATE] empty
Source echoNag-return ang model ng original na English input[GATE] source-echo
Hallucination loopPaulit-ulit na trigram patterns (hal., "Qo' Qo' Qo'")[GATE] hallucination
Length inflationMas mahaba nang husto ang output kaysa sa source[GATE] length
Script complianceMaling script para sa target locale[GATE] script
ICU plural categoriesKulang ng required plural forms para sa locale[GATE] icu-plural

Empty/Blank

Nire-reject nito ang mga translation na empty strings, whitespace-only, o null. Sinasalo nito ang mga models na walang nire-return para sa mga mahihirap na keys.

Source Echo

Nadi-detect nito kapag nag-return ang model ng English source text imbes na i-translate ito. Common ito sa mga short strings at under-specified prompts.

Hallucination Loop

Ina-analyze nito ang mga trigram (3-character) patterns sa output. Kung may anumang trigram na umulit nang higit sa threshold number of times relative sa output length, ire-reject ang translation. Sinasalo nito ang mga degenerate outputs tulad ng "Qo' Qo' Qo' Qo' Qo'".

Length Inflation

Nire-reject nito ang mga translation kung saan ang output length ay lumampas sa maxLengthRatio × source length (default: 4×). Sinasalo nito ang mga model hallucinations na nagpo-produce ng walls of text para sa isang short input.

Configurable ito via maxLengthRatio sa inyong config.

Script Compliance

Para sa mga locales na may configured na script field (hal., "script": "cans" para sa Plains Cree Syllabics), bini-validate nito na ang output ay naglalaman ng mga non-ASCII characters na angkop para sa target script. Ang Latin-only output para sa isang Arabic, CJK, o Syllabics locale ay ire-reject.

Ano ang Mangyayari Kapag Nag-fail

  1. Ilo-log ang nag-fail na translation sa stderr na may [GATE] prefix, ang key name, ang dahilan, at isang preview ng value
  2. Hindi isusulat ang key sa locale file
  3. Magki-kick in ang retry cascade (tingnan sa ibaba)
[GATE] hero.title: source-echo — "Welcome to our platform"
[GATE] nav.about: hallucination — "À À À À À À À À"

Retry Cascade

Kapag nag-fail ang isang batch (JSON parse error o quality gate rejections), magre-retry ang rosetta gamit ang progressively smaller batches:

Full batch (80 keys) → parse error
└→ Half batch (40 keys) → 2 failures
└→ Individual keys (1 each) → isolates the 2 problem keys

Naka-cap ang retry budget ng maxRetries (default: 3, configurable per-language). Pinipigilan nito ang runaway token spend sa mga keys na palaging nagfe-fail.

Pagkatapos maubos ang retries, ilo-log at i-i-skip ang mga problem keys. Ire-retry po ulit ang mga ito sa susunod na sync run.

Prompt Caching

Naka-split ang system message (register, grammar rules, style notes) mula sa user message (ang mga keys na ita-translate). Intentional ang pag-split na ito:

  • Ang system message ay identical across batches para sa isang given locale
  • Kina-cache ng mga providers tulad ng Anthropic at Google ang mga repeated system messages
  • Resulta: magbabayad ng full token cost ang first batch, habang ang mga subsequent batches ay magbabayad lang para sa user message

Malaki ang maitutulong nito para ma-reduce ang token costs para sa mga projects na may maraming batches.

ICU MessageFormat Validation

Bini-validate ng integrity command ang ICU MessageFormat plural patterns laban sa CLDR plural rules. Kung gumagamit ang inyong source file ng ICU syntax na tulad nito:

"items": "{count, plural, one {# item} other {# items}}"

Vini-verify ng Rosetta na kasama sa mga translated versions ang lahat ng required plural categories para sa target locale. Halimbawa, nagre-require ang Arabic ng anim na categories (zero, one, two, few, many, other) — hindi lang one at other.

I-run ang i18n-rosetta integrity para ma-check ang plural completeness sa lahat ng locales.

Terminology Enforcement

Para sa mga coached pairs na may dictionary, nagra-run ang rosetta ng isang post-translation terminology check. Pagkatapos pumasa sa quality gate, vini-verify nito kung ginamit ba talaga ng LLM ang mga required dictionary terms.

[TERM] en→fr: 2 term violation(s)
• hero.title: "dashboard" → expected "tableau de bord" but got "panneau de contrôle"

Ang mga terminology violations ay mga warnings, hindi blocking errors. Isusulat pa rin ang translation sa disk. Intentional ito — maaaring may valid reasons ang LLM sa pagpili ng alternative (context, grammar), at ang pag-block dahil sa term mismatches ay magdudulot ng mas maraming problema kaysa tulong.

Para ma-fix ang mga violations, i-update ang coaching dictionary o i-manually edit ang locale file.


Tingnan Din