--- 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 - en tags: - translation - nllb-200 - formosan-languages - low-resource metrics: - bleu - chrf - ter model-index: - name: nllb200-en-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: 7.143855 - type: chrf name: chrF2 value: 30.469195 - type: ter name: TER value: 83.876854 --- # nllb200-en-formosan-spm8k **Direction:** English 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 280,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 | 573,657 | | 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 | `e3feeaf7c3c51b9cd5c4b0537ffe44a370e7d02723f34b467479b6c4f5f0ea77` | | Training profile SHA-256 | `34f45832bdedc1b8322b26936dd88667dfecb360d941a7f54f60ae31a1fb4e10` | ## Usage ```python import torch from transformers import AutoModelForSeq2SeqLM, NllbTokenizer model_id = "FormosanBank/nllb200-en-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 = 'eng_Latn' 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('He went home.', "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 | 573,657 | | Test | 63,140 | | Validate | 20,733 | | Scope | BLEU | chrF2 | TER | |---|---:|---:|---:| | Hard test | 7.14 | 30.47 | 83.88 | | Selection validation | 7.98 | 33.96 | 79.31 | Test empty-output rate: 0.1615%. ### Confidence intervals Stratified bootstrap, 200 samples, 95% confidence. | Metric | Lower | Upper | |---|---:|---:| | BLEU | 6.98 | 7.28 | | chrF2 | 30.35 | 30.64 | | TER | 83.17 | 84.69 | | Language | Samples | BLEU | chrF2 | TER | |---|---:|---:|---:|---:| | `ami` | 11,017 | 5.43 | 27.77 | 84.23 | | `bnn` | 6,049 | 3.07 | 29.87 | 84.86 | | `ckv` | 2,910 | 15.06 | 39.37 | 72.42 | | `dru` | 5,846 | 0.53 | 16.19 | 110.56 | | `pwn` | 5,811 | 8.62 | 33.68 | 81.01 | | `pyu` | 4,315 | 11.62 | 33.68 | 86.56 | | `ssf` | 1,630 | 17.39 | 45.69 | 70.56 | | `sxr` | 2,081 | 7.38 | 43.74 | 78.08 | | `szy` | 1,852 | 11.13 | 38.22 | 74.16 | | `tao` | 2,257 | 9.31 | 35.38 | 82.27 | | `tay` | 6,411 | 2.55 | 21.22 | 94.70 | | `trv` | 6,502 | 12.27 | 32.59 | 70.59 | | `tsu` | 2,003 | 1.28 | 22.25 | 85.93 | | `xnb` | 2,682 | 2.81 | 33.33 | 89.59 | | `xsy` | 1,774 | 21.09 | 44.75 | 67.02 | 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.