← All models

text2text-generation Β· text Β· WASM Β· ~430 MB

mT5-small β€” the raw multilingual T5, one blank at a time

mT5 is the multilingual T5: the exact encoder-decoder design of T5, but pretrained on the mC4 corpus across 101 languages. There is one deliberate honesty here β€” this checkpoint was pretrained on only the span-corruption (denoising) objective and, unlike FLAN-T5 (instruction-tuned) or the English T5 (task-prefixes), it was never fine-tuned on a downstream task. So the one thing it truly knows is to reconstruct masked spans: put a <extra_id_0> blank in a sentence and it fills it β€” in whatever language you wrote. Try it in several languages and watch the raw multilingual foundation at work. Nothing leaves your device.

This is the small (300M) checkpoint at q8, so calibrate expectations: the fills are often rough or generic β€” a raw, tiny, quantized model is a foundation, the thing you would fine-tune (the popular mT5 fine-tunes like multilingual summarization aren't ONNX-exported for the browser, so we honestly show the base). What is remarkable is that a single 250k-token multilingual vocabulary lets one model take a blank in Spanish, German, Chinese or English and answer in the same language. The page shows you the real output, right or rough β€” never a canned answer.

At a glance

ModelXenova/mt5-small (ONNX of google/mt5-small)
Task / pipelinetext2text-generation (sequence-to-sequence)
ArchitecturemT5 encoder-decoder (~300M params) β€” encoder reads the masked input, decoder writes the sentinel-delimited fills
TrainingSpan-corruption denoising ONLY, over mC4 across 101 languages β€” no instruction/task fine-tuning (raw foundation)
Vocabulary250k-token multilingual SentencePiece β€” one shared vocab for all 101 languages
vs. T5 / FLAN-T5 / ByT5T5 = English task-prefixes; FLAN-T5 = instruction-tuned; ByT5 = byte-level. mT5 = multilingual, raw span-fill.
Quantizationq8 (8-bit) ONNX β€” encoder + merged decoder
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~430 MB, cached after first load
LicenseApache-2.0
Web APIsWebAssembly, Web Workers β€” all Baseline widely available

Run it β€” fill the blank in any language

Pick a multilingual preset or write your own sentence with one or more <extra_id_0>, <extra_id_1>… blanks. The model reads the whole string and streams the fills, each tagged by its sentinel. We then slot the fills back into the blanks so you can read the reconstructed sentence.

Raw output (sentinel-delimited fills)
Reconstructed sentence (fills slotted into the blanks)

See inside β€” sentinels, the exact tokens, and decode timing

Span corruption masks a contiguous span with a single sentinel token (<extra_id_0>, <extra_id_1>…) and the model's target is those same sentinels followed by the missing text. Below is the literal string the encoder received, split into the sub-word tokens it saw (mT5 uses a 250k multilingual SentencePiece vocab β€” a leading Β· marks a word boundary; the highlighted chips are the sentinel masks). Then the decoder's real per-token timeline.

Fill a blank above to inspect the input the model was fed.

Why it matters

Almost every multilingual NLP product you have used starts from a model like this: a single encoder-decoder pretrained across 101 languages on one objective, then fine-tuned for the job. Seeing the raw checkpoint β€” before any fine-tuning β€” makes the recipe legible: one shared vocabulary, one denoising objective, and the ability to operate in a language it was never explicitly told to use. At ~430 MB it runs in a tab, so you can inspect the multilingual foundation on-device with nothing sent anywhere.

Use cases

Basics

One blank, many languages β€” watch mT5 fill <extra_id_0> in the language you wrote.

Practical

Multilingual cloze: mask a word in your own sentence and get an in-language completion.

Wild

The pure objective: mask several spans at once and watch the sentinel-delimited reconstruction.

Multi-model

Detect the language first (XLM-R language-ID), then let mT5 fill the blank in that language.

How the API works

The whole task is expressed by where you place the sentinel blanks β€” no template, no roles:

import { pipeline } from "@huggingface/transformers";

const mt5 = await pipeline(
  "text2text-generation",
  "Xenova/mt5-small",
); // downloads + caches ~430 MB once

// mask a span with a sentinel; the target is the sentinels followed by the missing text:
await mt5("Thank you <extra_id_0> me to your party <extra_id_1> week.");
// β†’ [{ generated_text: "<extra_id_0> for inviting <extra_id_1> last <extra_id_2>" }]

// the SAME model, a Spanish blank β€” it answers in Spanish, from the shared multilingual vocab:
await mt5("La capital de Francia es <extra_id_0>.");
// β†’ [{ generated_text: "<extra_id_0> ..." }]   ← raw + small, so expect rough fills

This page keeps <extra_id_n> sentinels visible (skip_special_tokens: false) so the output format is legible, then reconstructs the sentence by slotting each fill back into its blank. It passes a TextStreamer to timestamp every generated token β€” all inside a Web Worker so the UI never janks.

References