use case · basics · inside 6+6 MarianMT Romance→EN · q8 WASM · 113.11 MB ONNX · Apache-2.0

Inside Many→One MarianMT: Beam 1/2/4, Length Penalty & Zero-Tag Check

Measure Beam 1 (Greedy) vs Beam 2 vs Beam 4 speed-vs-fluency and length_penalty on any Romance input, then test why Xenova/opus-mt-ROMANCE-en translates FR/ES/IT/PT/RO without >>lang<< control tokens (and what leaks when you prepend a stray >>fr<< tag).

1 · OPUS-MT Romance→EN worker (113.11 MB q8 ONNX · auto-inits from cache)

2 · Live Beam 1 vs Beam 2 vs Beam 4 & Length Penalty Benchmark

Runs Beam 1, Beam 2, and Beam 4 sequentially in the same WASM worker using your chosen length_penalty (0.5 favors concise phrasing; 2.0 favors longer clauses). Highlighted English tokens mark wording changes relative to Beam 1.

Select a Romance benchmark sentence

Prepare OPUS-MT Romance→EN above to run live Beam 1 vs Beam 2 vs Beam 4 decoding.

Beam 1 (Greedy baseline)

—

Latency: — · Tokens: —

Beam 2 (diff vs Beam 1)

—

Latency: — · Overlap: —

Beam 4 (diff vs Beam 1)

—

Latency: — · Overlap: —

Measured Beam Search Latency & Throughput (CPU WASM)

Real SentencePiece Source Subwords (MarianTokenizer)

Run Beam comparison to inspect SentencePiece source subwords.

3 · Zero-Tag Romance Auto-Detection vs Stray >>lang<< Prefix Probe

In opus-mt-en-ROMANCE (1→Many), prepending >>fr<< is mandatory. Here in opus-mt-ROMANCE-en (Many→One), vocab.json contains 0 >>lang<< control tokens — so Transformers.js emits an unsupported-tag warning and tokenizes >>fr<< as raw punctuation subwords. Compare raw vs prefixed live below.

Select a raw vs >>lang<< prefix probe

Tokenizer note: —

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

Variant A · Raw Romance (canonical Many→One)

—

Detected: — · Tokens: —

Variant B · Stray >>lang<< Prefix

—

Detected: — · Tokens: —

Show the code — Off-thread Beam 1 vs Beam 2 vs Beam 4 & length_penalty comparison
Show the code — Raw Many→One vs stray >>lang<< prefix ablation

Model: Helsinki-NLP/opus-mt-ROMANCE-en → Xenova/opus-mt-ROMANCE-en (113.11 MB q8 ONNX, Apache-2.0).