Views
No views yet
facebook/nllb-200-distilled-600M
for Russian → Abkhaz (apsua) translation. Abkhaz is a low-resource language not supported
out of the box by NLLB-200, so the tokenizer was surgically extended and the model fully
fine-tuned on real + back-translated data.| Metric | Value |
|---|---|
| Internal clean held-out (sentence-BLEU, beam=4) | 15.15 |
Contest leaderboard (hidden test, mean sacrebleu.sentence_bleu) | 9.98 |
| Copy-paste floor | 4.1 |
The hidden test is broader than the (religious-heavy) training corpus, hence the held-out → LB calibration shift of ≈0.66.
abk_Cyrlabk_Cyrl was added to the tokenizer as a regular vocab token
(id 256230), not a special token. Therefore skip_special_tokens=True does not remove it,
and it leaks as a literal prefix into every output. You must strip it manually
(skipping this costs ≈ −3.4 BLEU):pred = pred.replace("abk_Cyrl", "").strip()rus_Cyrl on the source side IS a proper special token and needs no stripping.)1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
3REPO = "audiosurffer0/nllb-600m-ru-ab-dojo26"
4tok = AutoTokenizer.from_pretrained(REPO)
5model = AutoModelForSeq2SeqLM.from_pretrained(REPO).to("cuda").eval()
6
7tok.src_lang = "rus_Cyrl"
8abk = tok.convert_tokens_to_ids("abk_Cyrl") # = 256230
9
10def translate(text):
11 enc = tok(text, return_tensors="pt", truncation=True, max_length=128).to("cuda")
12 out = model.generate(
13 **enc,
14 forced_bos_token_id=abk,
15 max_new_tokens=128,
16 num_beams=4,
17 length_penalty=1.1, # mild gain on longer test sentences
18 do_sample=False,
19 )
20 pred = tok.decode(out[0], skip_special_tokens=True)
21 return pred.replace("abk_Cyrl", "").strip() # ← strip the leaked lang token
22
23print(translate("Глава государства рассказал об экономике Абхазии"))abk_Cyrl + 26 missing Abkhaz
characters and typographic marks directly into tokenizer.json model.vocab
(vocab 256230 → 256231). resize_token_embeddings on the model. This drives Abkhaz unk
from ~10% to 0%. (add_tokens() and editing sentencepiece.bpe.model do not work for
NLLB-5.9.)weight_decay=0.01, optim=adafactor, fp16, 12000 steps.beam=4 + length_penalty=1.1; no_repeat_ngram was found to hurt.audiosurffer0/Ab_ru_dojo26_7000check).