CoolFace
Modelpublic

FormosanBank/nllb200-formosan-zh-spm8k

sourceHugging Facecc-by-nc-4.0updated 28d agoView on Hugging Face
0likes110downloads
Model Card

nllb200-formosan-zh-spm8k

Direction: Formosan to Traditional Chinese<br> Base model: `facebook/nllb-200-distilled-600M`<br> Recipe: nllb200-spm8k-directional-v9<br> Release: 20260828-121226, validation-selected step 230,000

This is a directional model for 15 Formosan languages. It uses the private_no_bible leakage-controlled corpus, Formosan-aware 8k SentencePiece extension, and explicit direction, source-language, and dialect controls. It does not infer or encode domains from repository or path names. Training uses language-temperature sampling with alpha 0.5; sentence rows have weight 1.0 and explicit lexical rows, when present, have weight 0.25. Dialect tags use 25% dropout so default is a normal inference condition. Synthetic pivot rows are train-only. The model weights are public. The training corpus is distributed separately to authorized FormosanBank members through the access-controlled `FormosanBank/formosan-mt-private` dataset and is not included with the weights.

Model details

ItemValue
Base revisionf8d333a098d19b4fd9a8b18f94170487ad3f821d
Corpus release20260824T042425Z_v3
Training code commita2cfed01277bc30bd9dea6a96af26564bb4f0718
Total corpus rows796,522
Training rows681,990
Human split policy85% train / 5% validate / 10% test
Synthetic evaluation policytrain_only_after_human_split
Language sampling alpha0.5
Sentence / lexical sampling weight1.0 / 0.25
Dialect-tag dropout25%
Training budget300,000 updates
Effective batch size64
Maximum sequence length384
Learning rate2e-05
Precisionbf16
Checkpoint selectionValidation chrF2
Formosan textkindOf=standard, formosan-mt-standard-v3
Corpus SHA-256b2592c7c450334f283f35078ce9cc1976121af8de63b52d16f699d9e902f298e
Training profile SHA-25601637c79ae86f8cc9c149a61b4a24e808d18261af140afe4fb0508a5190ce62a

Usage

python
import torch
from transformers import AutoModelForSeq2SeqLM, NllbTokenizer
from formosan_mt_inference import normalize_formosan


model_id = "FormosanBank/nllb200-formosan-zh-spm8k"
tokenizer = NllbTokenizer.from_pretrained(model_id, use_fast=False)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
model.to("cuda" if torch.cuda.is_available() else "cpu")
NLLB_LIDS = {'ami': 'ami_Latn', 'bnn': 'bnn_Latn', 'ckv': 'ckv_Latn', 'dru': 'dru_Latn', 'pwn': 'pwn_Latn', 'pyu': 'pyu_Latn', 'ssf': 'ssf_Latn', 'sxr': 'sxr_Latn', 'szy': 'szy_Latn', 'tao': 'tao_Latn', 'tay': 'tay_Latn', 'trv': 'trv_Latn', 'tsu': 'tsu_Latn', 'xnb': 'xnb_Latn', 'xsy': 'xsy_Latn'}

def translate(text, lang_code, dialect="default"):
    text = normalize_formosan(text, lang_code)
    tokenizer.src_lang = NLLB_LIDS[lang_code]
    dialect_tag = f"<dialect_{dialect}>"
    if tokenizer.convert_tokens_to_ids(dialect_tag) == tokenizer.unk_token_id:
        dialect_tag = "<dialect_default>"
    prompt = f"<to_zh> <src_{lang_code}> {dialect_tag} {text}"
    inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
    output = model.generate(
        **inputs,
        decoder_start_token_id=tokenizer.eos_token_id,
        forced_bos_token_id=tokenizer.convert_tokens_to_ids('zho_Hant'),
        max_new_tokens=256,
        num_beams=4,
    )
    return tokenizer.batch_decode(output, skip_special_tokens=True)[0]

print(translate("Pa'araw cingra.", "ami"))

The direction, source-language, and dialect tags are part of the training contract. Use default when dialect metadata is unavailable. This model does not use domain or repository tags.

Evaluation

The best checkpoint was selected on validation chrF2. Test and validation contain only eligible, human-translated sentence pairs. Synthetic pivots and lexical entries are train-only. The headline result uses default metadata controls (the default dialect only), so it does not assume access to test-set dialect labels or any inferred domain metadata.

SplitRows
Train681,990
Test76,353
Validate38,179
ScopeBLEUchrF2TER
Hard test18.8418.4373.04
Selection validation12.2412.8080.35

Test empty-output rate: 0.0039%.

Bootstrap confidence intervals were not requested for this release.

Metric signatures:

  • —BLEU: nrefs:1|case:mixed|eff:yes|tok:zh|smooth:exp|version:2.5.1
  • —chrF2: nrefs:1|case:mixed|eff:yes|nc:6|nw:0|space:no|version:2.5.1
  • —TER: nrefs:1|case:mixed|tok:tercom|norm:yes|punct:yes|asian:yes|version:2.5.1
LanguageSamplesBLEUchrF2TER
ami14,24815.4716.0174.91
bnn6,27620.3819.4071.14
ckv2,88725.2222.8759.35
dru6,76415.0315.2888.15
pwn5,80014.6214.6083.34
pyu4,42221.9121.7869.31
ssf2,29926.8824.6056.87
sxr2,05617.7317.4576.20
szy2,52021.6420.9568.61
tao2,50414.8915.3675.93
tay7,16315.0315.3481.01
trv12,04821.7321.1965.75
tsu2,30420.2319.5372.30
xnb2,56327.3924.8558.64
xsy2,49922.5221.4163.39

The corpus gate applies 85% train / 5% validate / 10% test to deduplicated human pairs within each language and source where capacity permits. Synthetic pivots are appended to training after that split. Evaluation is sentence-only and contains no lexical or synthetic rows. Standard-tier Formosan text is normalized with formosan-mt-standard-v3. The release requires zero exact, skeleton, one-edit, or configured high character n-gram train/evaluation conflicts. Document overlap is diagnostic. This release passed all leakage gates: exact 0, skeleton 0, one-edit 0, character n-gram

  1. 1.Document overlap: 1433.

See eval/metrics.json for sacreBLEU signatures, per-language, source-corpus, dialect, and length diagnostics. publication.json records the corpus, profile, run, and checkpoint hashes used for this release.

Intended use

This model supports research, corpus development, and assisted translation for the 15 included Formosan languages. It is designed for the exact prompt and generation contract shown above.

Limitations

Outputs require knowledgeable speaker review. Aggregate metrics hide large differences among languages and source collections. This model is not suitable for authoritative, medical, legal, or safety-critical translation.