use case · basics · inside 6+6 MarianMT Multilingual→EN · q8 WASM · 118.35 MB · Apache-2.0

Inside Many→One MarianMT: Decoding Widths, n-Gram Guard & Zero-Tag Check

Run live decoding comparisons (Beam 1 Greedy vs Beam 4 vs Beam 6 + no_repeat_ngram_size) with configurable length_penalty, then inspect why Xenova/opus-mt-mul-en needs 0 >>lang<< tags (and how prepending >>fra<< triggers unk_id=2 ".").

1 · OPUS-MT Multilingual→EN worker (118.35 MB q8 · auto-inits from cache)

2 · Live Decoding Width, length_penalty & no_repeat_ngram_size Benchmark

Runs three sequential passes in the same WASM worker: Beam 1 (Greedy), Beam 4, and Beam 6 with your chosen no_repeat_ngram_size (prevents repetition loops on low-resource inputs like Finnish).

Select a multilingual benchmark sentence

Prepare OPUS-MT Multilingual→EN above to compare decoding configs live.

Beam 1 (Greedy baseline)

—

Latency: — · Tokens: —

Beam 4 (diff vs Beam 1)

—

Latency: — · Overlap: —

Beam 6 + n-gram guard (diff vs Beam 1)

—

Latency: — · Overlap: —

Measured Decoding Latency & Throughput (CPU WASM)

Real SentencePiece Source Subwords (MarianTokenizer)

Run decoding comparison to inspect SentencePiece source subwords.

3 · Zero-Tag Auto-Detection vs Stray >>lang<< Prefix (unk_id=2)

Unlike 1→Many models (opus-mt-en-romance), Xenova/opus-mt-mul-en has 0 >>lang<< tokens in vocab.json and sets unk_id = 2 (".") in tokenizer.json. Prepending >>fra<< injects a leading #2 (".") token and shifts the output.

Select a raw vs >>lang<< prefix probe

Tokenizer note: —

Prepare OPUS-MT Multilingual→EN above to compare raw Many→One input against a stray >>lang<< prefix.

Variant A · Raw Input (canonical Many→One)

—

Detected: — · Tokens: —

Variant B · Stray >>lang<< Prefix

—

Detected: — · Tokens: —

Show the code — Off-thread decoding width & no_repeat_ngram_size comparison
Show the code — Raw Many→One vs stray >>lang<< prefix ablation

Model: Helsinki-NLP/opus-mt-mul-en → Xenova/opus-mt-mul-en (118.35 MB q8 first visit / 112.26 MB ONNX, Apache-2.0).