← All models

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

FLAN-T5-small β€” one model, many tasks, just ask

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.

At a glance

ModelXenova/flan-t5-small (ONNX of google/flan-t5-small)
Task / pipelinetext2text-generation (sequence-to-sequence)
ArchitectureT5 encoder-decoder (~80M params) β€” encoder reads the instruction, decoder generates the answer
TrainingInstruction fine-tuning (FLAN) over ~1,800 tasks β€” why one model handles translate/summarize/QA/classify
Quantizationq8 (8-bit) ONNX β€” encoder + merged decoder
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~100 MB, cached after first load
LicenseApache-2.0
Web APIsWebAssembly, Web Workers β€” all Baseline widely available

Run it

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.

Answer

See inside β€” the exact input, its tokens, and decode 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.

Generate something to inspect the input the model was fed.

Why it matters

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.

Use cases

Basics

The same input, five different instructions β€” feel how the verb changes the task.

Practical

A "universal text tool": one box, a menu of jobs β€” translate, TL;DR, rephrase, classify.

Wild

"Reason step by step" β€” coax chain-of-thought out of a tiny model and see it help (or not).

Multi-model

On-device RAG: MiniLM retrieves the right snippet, FLAN-T5 answers from it.

How the API works

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.

References