translation · MarianMT 6+6 Japanese→English · q8 · WASM · 108.71 MB · Apache-2.0
Opus-MT Japanese → English
University of Helsinki's OPUS-MT JA→EN
(Helsinki-NLP/opus-mt-ja-en,
quantized to 108.71 MB INT8 ONNX in
Xenova/opus-mt-ja-en)
is a dedicated 6+6 MarianMT SentencePiece neural translator handling unsegmented mixed
Kanji + Hiragana + Katakana + full-width Japanese punctuation (。?!「」)
directly in CPU WebAssembly — 100% private, zero cloud APIs, offline after first cache.
1 · On-device model (108.71 MB q8 WASM · encoder 50.71 MB + decoder 58.00 MB)
2 · Live Japanese → English Neural Translator
Pick a curated Japanese sample, type or paste (Ctrl/Cmd+V) text, or drop/upload a
.txt, .md, .srt, or .csv file. All inference runs off
the main thread in a dedicated Web Worker.
.txt / .md / .srt / .csv file here,
paste with Ctrl/Cmd+V, or choose a local file:
English translation
Waiting for runPrepare Opus-MT JA→EN above to translate Japanese locally in CPU WebAssembly.
3 · Sentence Alignment & SentencePiece Script Breakdown
MarianMT caps each sequence at 512 tokens. Segmenting on Japanese terminators
(。?!) preserves clause boundaries and exposes per-segment timing plus SentencePiece
Kanji / Hiragana / Katakana subword fertility.
| # | Japanese segment | English translation | Tokens (in→out) | Latency |
|---|---|---|---|---|
| Run a translation above to inspect sentence-by-sentence alignment. | ||||
Real SentencePiece Subwords (MarianTokenizer · 60,716 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-ja-en (Tatoeba.ja.en: BLEU 41.7 · chr-F 0.589) |
|---|---|
| Browser ONNX repo | Xenova/opus-mt-ja-en (encoder_model_quantized.onnx 50.71 MB + decoder_model_merged_quantized.onnx 58.00 MB = 108.71 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=60716) |
| Special tokens | pad=<pad> (60715, also decoder_start_token_id), eos=</s> (0), unk=<unk> · pair baked into weights |
| License | Apache-2.0 (University of Helsinki Language Technology Research Group) |
Show the code — Real Transformers.js MarianMT inference & streaming
Show the code — Japanese sentence segmentation (。?!) for 512-token safety
Compare Greedy (Beam 1) vs Beam 2 vs Beam 4 diffs and Kanji vs Hiragana vs Katakana SentencePiece fertility.
Practical · .SRT, CSV & TXT Batch LocalizerBatch-translate Japanese subtitles, product CSVs, or .txt docs off-thread with verbatim timestamps & formula-safe CSV.
Wild · Keigo, Katakana & Zero-Pronoun Stress LabStress-test polite Keigo vs casual speech, Katakana loanwords, omitted subjects, full-width numbers, and idioms.
Multi-Model · JA Ticket → EN → Zero-Shot TriageChain Opus-MT JA→EN (108.71 MB) into DeBERTa-v3 NLI (87.3 MB, 196 MB total) to route Japanese support tickets.