← All models

text-generation · text · WASM · ~618 MB

Qwen3-0.6B — a tiny reasoning model on any device

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.

At a glance

Modelonnx-community/Qwen3-0.6B-ONNX — ONNX export of Qwen/Qwen3-0.6B
Tasktext-generation — ChatML with a toggleable thinking mode
ArchitectureQwen3 decoder — ~0.6B params, 28 layers, hidden 1024, GQA
ReasoningHybrid: enable_thinking on → a <think> chain then the answer; off → direct answer
Quantizationq8 (onnx/model_quantized.onnx). The q4 build aborts on WASM (GatherBlockQuantized has no wasm kernel); fp16/q4f16 are WebGPU-only
Runtime / backendTransformers.js · WebAssembly (runs anywhere; WebGPU used as an optional accelerator)
Download~618 MB (q8), cached after first load
LicenseApache-2.0
Web APIsWebAssembly, Web Workers, (optional WebGPU) — all Baseline widely available

Run it

Ask something. With thinking on, the model reasons in a collapsible panel, then answers below.

See inside — next-token probabilities

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.

Why it matters

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.

Use cases

Basics

A plain chat — ask questions and watch tokens stream, with the thinking chain collapsible.

Practical

A rewrite/summarise toolbox with a system prompt — the pattern you'd ship.

Wild

Thinking vs. non-thinking: run the same hard question both ways and compare.

Multi-model

MiniLM → Qwen3: retrieve the most relevant note, then answer from it (RAG).

How the API works

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.

References