A newer version of this model is available: MihaiPopa-1/NLLB-200-Distilled-600M-Middle-English-v1.5

All of this Readme is generated by Claude 4.6 Sonnet!


NLLB-200-distilled-600M: English ↔ Middle English

A LoRA adapter fine-tuned on top of facebook/nllb-200-distilled-600M for bidirectional translation between Modern English and Middle English (Wycliffe/Chaucer era, ~1380–1400).

Model Description

This adapter teaches NLLB-200 to translate between Modern English and Middle English in the style of the Wycliffe Bible (~1382). It is the faithful back-translation component of a two-model pipeline β€” optimized for meaning preservation rather than stylistic fluency.

The companion fluency model (Qwen3-4B LoRA) is trained using synthetic data generated by this model.

Benchmark Results

Evaluated on 100 held-out verse pairs from the Wycliffe Bible vs. KJV.

Metric Score
chrF++ 51.46
BLEU 30.51

Note: The gap between chrF++ and BLEU is expected β€” BLEU penalizes valid Middle English spelling variants (e.g. ech vs euery, figis vs figus). chrF++ is the more appropriate metric for this task.

Training Details

Parameter Value
Base model facebook/nllb-200-distilled-600M
LoRA rank 16
LoRA alpha 32
Target modules q_proj, k_proj, v_proj, out_proj, fc1, fc2
Trainable params 8,650,752 (1.39%)
Training data Wycliffe Bible vs. KJV (~27k pairs)
MAX_LEN 128 tokens
Batch size 16
Gradient accumulation 2 (effective batch 32)
Epochs 3
Learning rate 5e-4
Label smoothing 0.1
Hardware NVIDIA T4 (16GB)
Training time 8428s (~2h20min)
Samples/sec 19.2
Total FLOPS 4.49 Γ— 10¹⁢
Average train loss 3.215
Final step train loss 2.907 (step 5000)
Final val loss 3.024 (step 5000)

Training Curve

Step Train Loss Val Loss
500 3.5559 3.7685
1000 3.3317 3.4527
1500 3.2002 3.2972
2000 3.0826 3.2185
2500 3.0477 3.1452
3000 3.0020 3.0992
3500 2.9551 3.0730
4000 2.9471 3.0504
4500 2.9321 3.0293
5000 2.9070 3.0241

Data

Training data sourced from two public domain texts, aligned by book/chapter/verse:

  • Wycliffe Bible (~1382) β€” Middle English source
  • King James Version (1611) β€” Modern English target

Note: KJV is Early Modern English (1611), not contemporary Modern English. This means the model performs best on formal/biblical register input. For everyday modern text, use the companion Qwen3-4B LoRA adapter.

Data pipeline available at: [me_data_pipeline.py]

Usage

from transformers import NllbTokenizer, AutoModelForSeq2SeqLM
from peft import PeftModel
import torch

MODEL_ID = 'facebook/nllb-200-distilled-600M'
ADAPTER  = 'MihaiPopa-1/NLLB-200-Distilled-600M-Middle-English'  # update with your HF repo

tokenizer = NllbTokenizer.from_pretrained(MODEL_ID)
ME_TOKEN = 'enm_Latn'
if ME_TOKEN not in tokenizer.additional_special_tokens:
    tokenizer.add_special_tokens({'additional_special_tokens': [ME_TOKEN]})

ME_TOKEN_ID = tokenizer.convert_tokens_to_ids(ME_TOKEN)

model = AutoModelForSeq2SeqLM.from_pretrained(
    MODEL_ID,
    torch_dtype=torch.float16,
    device_map='auto'
)
model.resize_token_embeddings(len(tokenizer))
model = PeftModel.from_pretrained(model, ADAPTER)
model.eval()

def translate(text, src_lang='eng_Latn', tgt_token_id=ME_TOKEN_ID):
    tokenizer.src_lang = src_lang
    inputs = tokenizer(text, return_tensors='pt', truncation=True, max_length=64).to(model.device)
    with torch.no_grad():
        out = model.generate(
            **inputs,
            forced_bos_token_id=tgt_token_id,
            max_new_tokens=64,
            num_beams=4
        )
    return tokenizer.decode(out[0], skip_special_tokens=True)

# Modern English β†’ Middle English
print(translate("I will call you later tonight."))
# β†’ "Y schal clepe to thee later this nyyt."

print(translate("She works at the hospital downtown."))
# β†’ "Sche werkith in the hospital in the myddil of the town."

# Middle English β†’ Modern English
EN_TOKEN_ID = tokenizer.convert_tokens_to_ids('eng_Latn')
print(translate("Y haue not etun ony thing fro breakfast.", src_lang='enm_Latn', tgt_token_id=EN_TOKEN_ID))
# β†’ "I have not eaten anything since breakfast."

Sample Outputs

Modern English Middle English
I will call you later tonight. Y schal clepe to thee later this nyyt.
The weather is really nice today. The weier is trewe to dai.
Did you see the news this morning? Whether thou seest the wordis of the morewtid?
My phone battery is dead. My phone baterie is deed.
Let's meet at the coffee shop at noon. Meete we in the coffee shop at noon.
She works at the hospital downtown. Sche werkith in the hospital in the myddil of the town.
I haven't eaten anything since breakfast. Y haue not etun ony thing fro breakfast.

Limitations

  • KJV register bias β€” training data is formal Biblical prose. Casual modern slang may produce stilted output.
  • Post-1400 vocabulary β€” words like coffee, phone, traffic have no ME equivalent and are either left in modern form or phonologically naturalized.
  • Proper nouns β€” Hebrew/Latin proper nouns from the Bible are sometimes mis-transcribed into ME phonology (e.g. Shupham β†’ Sufam).
  • Sequence length β€” trained with MAX_LEN=64; very long sentences may be truncated.

Pipeline

This model is part of a two-model English ↔ Middle English translation system:

NLLB-600M LoRA  β†’  faithful back-translation  β†’  synthetic training data
                                                          ↓
Qwen3-4B LoRA   β†’  fluent, natural ME output  β†’  daily use (texts, messages)

Citation

If you use this model, please cite:

@misc{nllb-middle-english-lora,
  title  = {NLLB-200 LoRA: English ↔ Middle English Translation},
  year   = {2025},
  note   = {Fine-tuned on Wycliffe Bible / KJV parallel corpus}
}
Downloads last month
6
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for MihaiPopa-1/NLLB-200-Distilled-600M-Middle-English

Adapter
(156)
this model

Evaluation results