nllb200-en-formosan-spm8k

Direction: English to Formosan
Base model: facebook/nllb-200-distilled-600M
Recipe: nllb200-spm8k-directional-v5
Release: 20260816-193900, validation-selected step 250,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, direction/language controls, fixed coarse domain tags, and dialect tags. Domain and dialect metadata use independent training dropout so unknown and default are learned inference conditions. 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

Item Value
Base revision f8d333a098d19b4fd9a8b18f94170487ad3f821d
Training rows 344,701
Effective batch size 64
Maximum sequence length 384
Learning rate 2e-05
Precision bf16
Checkpoint selection Validation chrF2
Formosan text kindOf=standard, formosan-mt-standard-v3
Corpus SHA-256 c84174ee46027e50d24aedc3cf4016412f7a4cbdeb14ceed2133ee76a4724be1
Training profile SHA-256 4253b1b136fedebc589da942b80df71945212d1f4b92a8e98ec6fb160712f14b

Usage

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'
    source_bucket = source_bucket if source_bucket in ('dictionary', 'classroom', 'narrative', 'linguistic', 'education', 'media', 'culture', 'religious', 'unknown') else "unknown"
    domain_tag = f"<dom_{source_bucket}>"
    if tokenizer.convert_tokens_to_ids(domain_tag) == tokenizer.unk_token_id:
        domain_tag = "<dom_unknown>"
    dialect_tag = f"<dialect_{dialect}>"
    if tokenizer.convert_tokens_to_ids(dialect_tag) == tokenizer.unk_token_id:
        dialect_tag = "<dialect_default>"
    prompt = (
        f"<to_{lang_code}> <src_eng> {domain_tag} {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(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 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, so it does not assume access to test-set domain or dialect labels.

Split Rows
Train 344,701
Test 40,561
Validate 20,286
Scope BLEU chrF2 TER
Hard test 7.84 32.66 82.37
Selection validation 7.59 33.90 80.05

Test empty-output rate: 0.0000%.

Language Samples BLEU chrF2 TER
ami 6,761 6.73 29.76 82.47
bnn 4,815 4.04 31.91 85.88
ckv 1,915 11.42 38.26 77.55
dru 3,782 3.31 25.52 99.47
pwn 5,237 9.81 37.14 74.82
pyu 3,158 8.51 35.37 80.83
ssf 1,077 17.52 45.12 62.67
sxr 937 7.34 37.34 83.29
szy 857 13.94 39.94 65.34
tao 868 10.89 40.36 76.80
tay 4,763 3.93 23.79 93.18
trv 2,888 8.07 29.90 79.66
tsu 1,111 11.17 37.77 72.10
xnb 1,503 9.02 40.83 77.28
xsy 889 18.90 44.55 66.22

The corpus gate enforces standard-tier Formosan text, 5/10 validation/test proportions from all deduplicated pairs, capacity-aware source balance, sentence-only evaluation, and 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 0. Document overlap: 924.

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.

Downloads last month
36
Safetensors
Model size
0.6B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for FormosanBank/nllb200-en-formosan-spm8k

Finetuned
(355)
this model

Space using FormosanBank/nllb200-en-formosan-spm8k 1

Collection including FormosanBank/nllb200-en-formosan-spm8k

Evaluation results