translation · text → text · 107.47 MB WASM q8 · French → English · MarianMT · Apache-2.0

OPUS-MT FR→EN — On-Device French → English Translator & SentencePiece Lab

Helsinki-NLP/opus-mt-fr-en (ONNX export Xenova/opus-mt-fr-en, Apache-2.0) is a dedicated 6+6-layer MarianMT encoder-decoder trained on the OPUS French–English parallel corpora. Its 50.09 MB encoder + 57.38 MB merged KV-cached decoder (107.47 MB q8) translate elisions (l', qu'), accents (é, ç, œ) and tu/vous registers entirely inside a local Web Worker — no French text ever leaves your device.

Loaded ONNX ID Xenova/opus-mt-fr-en
Upstream Card Helsinki-NLP/opus-mt-fr-en
Pipeline Task translation
Weights & Quant 107.47 MB · WASM q8
Architecture 6+6 MarianMT · 59,514 SP
Params · Runtime ~75M · Transformers.js 3.7.5
License Apache-2.0
Web APIs Workers · WASM · Cache Storage

1. Live French → English Translator

Private bilingual engine: loads encoder_model_quantized.onnx (50.09 MB) + decoder_model_merged_quantized.onnx (57.38 MB) via the shared Transformers.js 3.7.5 runtime inside a dedicated Web Worker. Text and uploaded files stay in your browser.

Pick a curated French register, type your own French text, or upload a local .txt / .srt / .md document:

Beam width 1 = fast greedy, 2–4 = beam search (the model card default is 4). Sentence alignment uses the French-aware splitter below.
Latency–
Decode speed–
In / Out tokens–
Beam width1 (greedy)
NaN check–
Backend / dtypeWASM · q8

French Input

Select a preset or enter French text above.

English Translation (Live MarianMT)

Download or initialise OPUS-MT FR→EN above to translate locally.

2. Sentence Alignment (French-Aware Splitter)

With Sentence alignment on, splitFrenchSentences() keeps M., Mme., Dr., etc., p. ex. and c.-à-d. intact, honours French spaced punctuation (Bonjour !) and closing « … » guillemets, then translates each sentence with its own token counts and latency.

Sentence-by-sentence French to English alignment with token counts and latency
# French Source Sentence English Translation Tokens (In → Out) Latency
Run a translation above to inspect sentence alignment.

3. See Inside: Word-Level SentencePiece Fertility

What am I looking at? The live tokenizer output for your French source, regrouped into surface words. Each pill shows the word, the pieces it became and its fertility (×n pieces). Elided clitics such as l' / qu' and rare accented or slang words fragment more (amber ≥ 2, red ≥ 4). The pipeline does not expose cross-attention weights, so this is a tokenizer view, not an attention alignment.

Fertility ratio (pieces per French word) will appear after translation.

Translate above to inspect per-word fertility.
Word start (▁) Continuation piece (+) Special token (</s>)
Translate above to inspect the raw SentencePiece sequence.

4. Why It Matters

A 107 MB, Apache-2.0 French → English model that runs offline after one download turns bilingual workflows into zero-server features. You could build:

Support inbox triage

Translate incoming French/Québécois tickets before an English-only classifier routes them (see Multi-model).

Subtitle localisation

Re-time-safe .srt translation for French films and webinars without uploading scripts (see Practical).

Reading assistant

Sentence-aligned glosses for learners, with faux-amis warnings (see Wild).

Private document review

Contracts, HR letters and medical notes translated on-device for GDPR-sensitive teams.

5. How the API Works & Source Code

Trained by the Language Technology Research Group at the University of Helsinki (Helsinki-NLP/opus-mt-fr-en, Apache-2.0) on OPUS French–English data and converted to quantized ONNX by Xenova (Xenova/opus-mt-fr-en). The whole call is pipeline("translation", "Xenova/opus-mt-fr-en", { device: "wasm", dtype: "q8" }) followed by pipe(text, { num_beams, max_new_tokens }).

Show the code — worker.js runSingleTranslation(): one MarianMT WASM q8 translation with live SentencePiece counts
Show the code — opus-fr-core.mjs splitFrenchSentences(): M. / Mme. / etc. / « guillemets »-aware splitter
Show the code — opus-fr-core.mjs groupPiecesIntoWords(): regroup ▁ pieces into per-word fertility

6. Use Cases & References