text2text-generation Β· text Β· WASM Β· ~100 MB
FLAN-T5 is an encoder-decoder model instruction-tuned on roughly 1,800 tasks. There is no chat template and no system prompt β the whole input is a single natural-language instruction: "summarize: β¦", "Is this review positive or negative? β¦", "answer the question based on the context: β¦". The encoder reads it, the decoder writes the answer one token at a time. Try any instruction and watch it stream. Nothing leaves your device.
This is the small (80M) checkpoint, so calibrate expectations: it is genuinely strong at classification, sentiment, yes/no and reading-comprehension (answering from text you give it) and decent at summarizing β but only roughly translates and is unreliable on closed-book facts. That trade-off is the honest reality of a model this size, and the page shows you the real output, right or wrong β never a canned answer.
| Model | Xenova/flan-t5-small (ONNX of google/flan-t5-small) |
|---|---|
| Task / pipeline | text2text-generation (sequence-to-sequence) |
| Architecture | T5 encoder-decoder (~80M params) β encoder reads the instruction, decoder generates the answer |
| Training | Instruction fine-tuning (FLAN) over ~1,800 tasks β why one model handles translate/summarize/QA/classify |
| Quantization | q8 (8-bit) ONNX β encoder + merged decoder |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~100 MB, cached after first load |
| License | Apache-2.0 |
| Web APIs | WebAssembly, Web Workers β all Baseline widely available |
Pick a task preset to fill the instruction, or write your own. Whatever is in the box is fed verbatim to the model β that exact string is the "prompt". Greedy decoding streams the answer and records real per-token timing.
There is no hidden prompt engineering here. This is the literal string the encoder received,
split into the sub-word tokens it actually saw (T5 uses SentencePiece β a leading Β· marks
a word boundary). Then the decoder's real per-token timeline: one bar per generated token.
Exact input string fed to the encoder:
Input tokens (SentencePiece):
Per-token decode timeline (ms per token):
One 100 MB model that translates, summarizes, answers, and classifies β driven entirely by plain instructions β is a whole toolbox in a tab. No task-specific model to ship for each feature, no chat template to wrangle, no server bill, and the text never leaves the device.
The same input, five different instructions β feel how the verb changes the task.
A "universal text tool": one box, a menu of jobs β translate, TL;DR, rephrase, classify.
"Reason step by step" β coax chain-of-thought out of a tiny model and see it help (or not).
On-device RAG: MiniLM retrieves the right snippet, FLAN-T5 answers from it.
The whole task lives in the input string β no template, no roles:
import { pipeline } from "@huggingface/transformers";
const flan = await pipeline(
"text2text-generation",
"Xenova/flan-t5-small",
); // downloads + caches ~100 MB once
// the instruction IS the prompt β change the verb to change the task:
await flan("Is the following review positive or negative? Review: The battery dies in an hour.");
// β [{ generated_text: "negative" }] β classification is where the small model shines
await flan("Answer the question based on the context.\n" +
"Context: The museum is closed on Mondays.\nQuestion: When is the museum closed?");
// β [{ generated_text: "Mondays" }] β reading-comprehension, not closed-book recall
For the live token stream and the decode timeline, this page passes a TextStreamer so it
can timestamp each generated token β all inside a Web Worker so the UI never janks.