text-generation · text · WASM · ~618 MB
Qwen3-0.6B is the smallest Qwen3, and a hybrid reasoning model:
the same weights either think out loud in a <think>…</think> chain
before answering, or reply directly in a fast mode. This showcase already has Qwen3-1.7B — but only
via WebLLM, which needs WebGPU. This demo is different: it runs on the universal
WebAssembly/CPU path with no GPU, so it reaches almost any device. Everything runs on your
device — no key, no server.
| Model | onnx-community/Qwen3-0.6B-ONNX — ONNX export of Qwen/Qwen3-0.6B |
|---|---|
| Task | text-generation — ChatML with a toggleable thinking mode |
| Architecture | Qwen3 decoder — ~0.6B params, 28 layers, hidden 1024, GQA |
| Reasoning | Hybrid: enable_thinking on → a <think> chain then the answer; off → direct answer |
| Quantization | q8 (onnx/model_quantized.onnx). The q4 build aborts on WASM (GatherBlockQuantized has no wasm kernel); fp16/q4f16 are WebGPU-only |
| Runtime / backend | Transformers.js · WebAssembly (runs anywhere; WebGPU used as an optional accelerator) |
| Download | ~618 MB (q8), cached after first load |
| License | Apache-2.0 |
| Web APIs | WebAssembly, Web Workers, (optional WebGPU) — all Baseline widely available |
Ask something. With thinking on, the model reasons in a collapsible panel, then answers below.
A language model computes a probability for every token in its ~151k vocabulary. This is the real top-12 distribution for the token right after your prompt (one forward pass, on your device). Greedy decoding just takes the top row each step.
A capable reasoning model that fits in ~618 MB and needs no GPU turns "private, offline assistant" into something that runs on a mid-range laptop or phone. The visible thinking chain also makes the model's process inspectable — useful for teaching and debugging prompts.
A plain chat — ask questions and watch tokens stream, with the thinking chain collapsible.
A rewrite/summarise toolbox with a system prompt — the pattern you'd ship.
Thinking vs. non-thinking: run the same hard question both ways and compare.
MiniLM → Qwen3: retrieve the most relevant note, then answer from it (RAG).
import { pipeline, TextStreamer } from "@huggingface/transformers";
const generate = await pipeline("text-generation",
"onnx-community/Qwen3-0.6B-ONNX", { dtype: "q8" }); // ~618 MB, cached once
const messages = [{ role: "user", content: "…" }];
const streamer = new TextStreamer(generate.tokenizer, { skip_prompt: true });
const out = await generate(messages, {
max_new_tokens: 256, do_sample: true, temperature: 0.7,
streamer,
chat_template_options: { enable_thinking: true }, // ← reasoning on/off
});
// out[0].generated_text.at(-1).content → "<think>…</think> …answer"
This page runs exactly that in a Web Worker (so streaming never blocks the UI), splits the <think> chain from the answer, and does one extra forward pass for the real next-token probabilities.