--- license: cc-by-nc-4.0 library_name: transformers pipeline_tag: translation base_model: facebook/nllb-200-distilled-600M language: - ami - bnn - ckv - dru - pwn - pyu - ssf - sxr - szy - tao - tay - trv - tsu - xnb - xsy - zh tags: - translation - nllb-200 - formosan-languages - low-resource metrics: - bleu - chrf - ter model-index: - name: nllb200-zh-formosan-spm8k results: - task: type: translation name: Translation dataset: name: FormosanBank private no-Bible hard test type: private-no-bible-hard-test split: test metrics: - type: bleu name: sacreBLEU value: 8.215640 - type: chrf name: chrF2 value: 32.608422 - type: ter name: TER value: 84.327590 --- # nllb200-zh-formosan-spm8k **Direction:** Traditional Chinese to Formosan
**Base model:** [`facebook/nllb-200-distilled-600M`](https://huggingface.co/facebook/nllb-200-distilled-600M)
**Recipe:** `nllb200-spm8k-directional-v3`
**Release:** `20260809-210523`, validation-selected step 270,000 This is a directional model for 15 Formosan languages. It uses the `private_no_bible` leakage-controlled corpus, Formosan-aware 8k SentencePiece extension, balanced language/source sampling, and direction/domain/dialect control tags. The model weights are public, but the private training corpus is not included. ## Model details | Item | Value | |---|---| | Base revision | `f8d333a098d19b4fd9a8b18f94170487ad3f821d` | | Training rows | 702,520 | | Effective batch size | 64 | | Maximum sequence length | 384 | | Learning rate | 2e-05 | | Precision | `bf16` | | Checkpoint selection | Human validation `chrF2` | | Formosan text | `kindOf=standard`, `formosan-mt-standard-v3` | | Corpus SHA-256 | `238b96ea87716a749391d7157ce99f1611c1d4a489c4c108c315553505ca1f29` | | Training profile SHA-256 | `34f45832bdedc1b8322b26936dd88667dfecb360d941a7f54f60ae31a1fb4e10` | ## Usage ```python import torch from transformers import AutoModelForSeq2SeqLM, NllbTokenizer model_id = "FormosanBank/nllb200-zh-formosan-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, source_bucket="unknown", dialect="default"): tokenizer.src_lang = 'zho_Hant' prompt = ( f" " f" {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(NLLB_LIDS[lang_code]), max_new_tokens=256, num_beams=4, ) return tokenizer.batch_decode(output, skip_special_tokens=True)[0] print(translate('他回家了。', "ami")) ``` The control tags are part of the training contract. Use `unknown` and `default` when source bucket or dialect metadata is unavailable. ## Evaluation The best checkpoint was selected on human validation chrF2. Test references are human sentence pairs; synthetic pivots and lexical entries are train-only. The headline result uses `default` metadata controls, so it does not assume access to test-set domain or dialect labels. | Split | Rows | |---|---:| | Train | 702,520 | | Test | 64,356 | | Validate | 21,450 | | Scope | BLEU | chrF2 | TER | |---|---:|---:|---:| | Hard test | 8.22 | 32.61 | 84.33 | | Selection validation | 7.91 | 32.95 | 83.55 | Test empty-output rate: 0.0062%. ### Confidence intervals Stratified bootstrap, 200 samples, 95% confidence. | Metric | Lower | Upper | |---|---:|---:| | BLEU | 8.09 | 8.31 | | chrF2 | 32.49 | 32.73 | | TER | 83.79 | 84.89 | | Language | Samples | BLEU | chrF2 | TER | |---|---:|---:|---:|---:| | `ami` | 11,271 | 7.13 | 31.39 | 82.76 | | `bnn` | 6,112 | 3.23 | 30.38 | 87.07 | | `ckv` | 3,038 | 16.38 | 42.28 | 67.39 | | `dru` | 6,109 | 1.75 | 23.37 | 105.90 | | `pwn` | 5,718 | 5.60 | 32.84 | 88.50 | | `pyu` | 4,280 | 9.65 | 34.37 | 76.53 | | `ssf` | 1,673 | 14.63 | 45.44 | 61.42 | | `sxr` | 1,781 | 4.92 | 43.63 | 78.33 | | `szy` | 2,055 | 13.24 | 38.38 | 70.71 | | `tao` | 1,838 | 9.86 | 33.73 | 73.43 | | `tay` | 6,723 | 0.49 | 12.72 | 133.93 | | `trv` | 6,983 | 8.86 | 30.64 | 77.67 | | `tsu` | 2,164 | 8.08 | 35.52 | 79.20 | | `xnb` | 2,728 | 16.40 | 48.69 | 62.64 | | `xsy` | 1,883 | 15.59 | 42.03 | 67.94 | The corpus gate enforces standard-tier Formosan text, at least 7.5% test and 2.5% validation per language, human sentence-only evaluation, and zero exact, skeleton, one-edit, configured high character n-gram, or document train/evaluation conflicts. This release passed all gates: exact 0, skeleton 0, one-edit 0, character n-gram 0, and document 0. See `eval/metrics.json` for sacreBLEU signatures, per-language, source, 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 domains. This model is not suitable for authoritative, medical, legal, or safety-critical translation.