text-generation Β· chat LLM Β· WebLLM (MLC) Β· WebGPU Β· ~0.9 GB
The newest, lightest chat model in this showcase. Gemma 3 1B is Google's 2025 open model, compiled to WebGPU by MLC's WebLLM engine β you get streaming tokens, sampling controls, a system prompt and full conversation history, with nothing uploaded and no API bill. At ~0.9 GB it's the smallest WebLLM chat model here, so it reaches more devices than the 2B+ pages while staying a genuinely useful instruction-tuned assistant. Like every WebLLM model it needs a real GPU: no WASM fallback.
| Model | google/gemma-3-1b-it |
|---|---|
| MLC build | gemma3-1b-it-q4f16_1-MLC |
| Runtime | WebLLM / MLC β not Transformers.js. Weights are precompiled to WebGPU shaders. |
| Task | text-generation (instruction-tuned chat) |
| Params / dtype | 1B Β· q4f16_1 (4-bit weights, fp16 compute) |
| Chat template | <start_of_turn>user / <start_of_turn>model turns β no system role (folded into the first user turn) |
| Backend | WebGPU only β no WASM fallback. Gated on a real GPU adapter. under ~1 GB GPU memory. |
| Download | ~0.9 GB, cached after first load β the lightest chat model in the catalogue |
| Context window | 4096 tokens (MLC build cap; Gemma 3 supports far more) |
| License | Gemma Terms of Use |
| Web APIs | WebGPU, Web Workers, ES module imports |
How it differs from the other chat pages: it's the newest and smallest WebLLM chat model in the catalogue β Google's Gemma 3 generation, a step on from the Gemma 2 2B page β trading some capability for a lighter ~0.9 GB download that runs on more modest GPUs. It's a distinct Gemma 3 architecture from the Qwen (Qwen3 1.7B), Mistral (Mistral 7B) and Llama-family models here.
Heads up: loading transfers ~0.9 GB the first time (then it's cached). Needs a WebGPU-capable GPU.
An LLM does two very different jobs per turn: it prefills your whole prompt (fast, parallel) and then decodes the answer one token at a time (the part you watch stream). The split below is measured live β time-to-first-token is essentially the prefill cost; everything after is decode. A 1B model decodes quickly β the readout makes that concrete. WebLLM reuses a KV cache across turns, so later replies reprocess less of the history.
Send a message to see the messages array that WebLLM receives.
A useful chat LLM used to mean a server, an API key, and a per-token bill. Gemma 3 1B on WebLLM makes a capable conversational model a client-side primitive that fits in under a gigabyte: private by construction, free to run, and available offline once the weights are cached. Being the lightest WebLLM model here, it's the one most likely to run on a visitor's actual hardware.
A clean streaming chat β the fundamental "talk to the model" loop.
Structured extraction & rewriting: strict JSON and tone changes a business would ship.
Persona role-play β fold a character into Gemma's first turn and become someone else.
RAG: MiniLM retrieves from a pasted doc, Gemma 3 answers grounded in it.
WebLLM gives you an OpenAI-shaped chat API backed by a WebGPU engine. You create the engine
(which downloads and compiles the weights), then stream a completion. This page uses the shared
helpers in lib/webllm.js, running inside a Web Worker so the UI stays responsive.
Because Gemma 3's template has no system role, we fold the system prompt into the first user turn:
import { webGPUAdapterAvailable, createEngine, streamChat }
from "/lib/webllm.js";
// WebLLM is WebGPU-only β gate before doing anything (headless requestAdapter() β null).
if (!(await webGPUAdapterAvailable())) {
showNeedsWebGPU(); // never a faked reply
} else {
const engine = await createEngine({
model: "gemma3-1b-it-q4f16_1-MLC",
onProgress: (p) => setProgress(p.text, p.progress), // ~0.9 GB, cached after first load
});
// Gemma 3 has no system role β fold it into the first user message.
const messages = [
{ role: "user", content: "You are a concise assistant.\n\nExplain WebGPU in one sentence." },
];
const full = await streamChat(
engine,
{ messages, temperature: 0.7, top_p: 0.95, max_tokens: 256 },
(delta) => appendToken(delta), // streams token-by-token on your GPU
);
// engine.interruptGenerate() stops decoding early; engine.runtimeStatsText() reports tok/s.
}
Everything here runs exactly that path in worker.js, and gates on a real WebGPU
adapter first. No adapter β a labelled needs-WebGPU state, never a canned answer.