translation · 1st compact CJK→EN neural translator · q8 · WASM · 113.11 MB · CC-BY-4.0

Opus-MT Chinese → English

University of Helsinki's OPUS-MT ZH→EN (Helsinki-NLP/opus-mt-zh-en, quantized to 113.11 MB INT8 ONNX in Xenova/opus-mt-zh-en) is a dedicated 6+6 MarianMT encoder-decoder that translates Simplified and Traditional Chinese directly into fluent English in ~150 ms/sentence on universal CPU WebAssembly — 100% private, zero cloud APIs, works offline after first cache.

Runs in browser · WASM translation 113.11 MB q8 ONNX CC-BY-4.0 MarianMT · 65k SentencePiece

1 · On-device model (113.11 MB q8 WASM · encoder 52.90 MB + decoder 60.21 MB)

2 · Live Chinese → English Neural Translator

Choose a Simplified or Traditional Chinese sample, type your own text, or upload a .txt / .srt / .md file. Translation runs off the main thread in a dedicated Web Worker.

Curated Chinese presets (Simplified, Traditional & Mixed CJK+English)
0 chars

English translation

Waiting for run
Prepare Opus-MT ZH→EN above and click Translate to run real on-device MarianMT inference.

Prepare Opus-MT ZH→EN above to translate Simplified & Traditional Chinese locally in CPU WebAssembly.

Latency—
Throughput—
Src → Tgt tokens—
Script hint—
Backend · dtypeWASM · q8
NaN count—

3 · Sentence-by-Sentence Alignment & See Inside MarianTokenizer

MarianMT caps each sequence at 512 tokens. Segmenting multi-sentence Chinese paragraphs keeps every clause inside the attention window and exposes per-sentence latency and SentencePiece subwords.

# Chinese segment English translation Tokens (in→out) Latency
Run a translation above to inspect sentence-by-sentence alignment.

Real SentencePiece Subword Pieces (MarianTokenizer · 65,001 vocab)

Run a translation to inspect real MarianTokenizer SentencePiece subwords.

4 · At a Glance, Show the Code & Use-Case Ladder

Upstream model Helsinki-NLP/opus-mt-zh-en (Tatoeba-test.zho.eng: BLEU 36.1 · chr-F 0.548)
Browser ONNX repo Xenova/opus-mt-zh-en (encoder_model_quantized.onnx 52.90 MB + decoder_model_merged_quantized.onnx 60.21 MB = 113.11 MB q8)
Pipeline task & runtime translation · @huggingface/transformers@3.7.5 (shared pin in lib/webai.js) · CPU WASM
Architecture MarianMTModel (6 encoder + 6 decoder layers, d_model=512, 8 heads, ffn=2048, swish, max_length=512, vocab_size=65001)
Special tokens pad=<pad> (65000, also decoder_start_token_id), eos=</s> (0), unk=<unk> · pair baked into weights (no language-code prefix)
License CC-BY-4.0 (University of Helsinki Language Technology Research Group)
Show the code — Real Transformers.js MarianMT inference & streaming
Show the code — Chinese sentence segmentation for 512-token safety