text-generation Β· text Β· WebAssembly / WebGPU Β· ~310 MB (q8)
Baguettotron is a small "encyclopedic" reasoning model from
Pleias, trained entirely on the synthetic SYNTH dataset. It is
unusually shaped: only ~321M parameters, but 80 layers deep β the bet being that
depth buys reasoning at a tiny size. It always thinks out loud inside a
<think> block, then gives its answer. This page runs it entirely in
your browser via Transformers.js: it streams tokens on the universal
WebAssembly/CPU path (no GPU required). Nothing is uploaded; there is no API key
and no server.
A different family from the other small chat models here (Qwen, Llama, Gemma, Falcon, SmolLM).
Its ONNX build exports as the standard llama decoder architecture, so it loads
through the ordinary text-generation pipeline β but the model, data, and training recipe are
Pleias's own.
| Model | onnx-community/Baguettotron-ONNX (ONNX build of PleIAs/Baguettotron) |
|---|---|
| Task | text-generation (causal LM, ChatML reasoning chat) |
| Architecture | Deep-narrow decoder-only transformer (model_type: llama) β hidden size 576, 80 layers, ~321M params |
| Params / dtype | ~321M Β· q8 on WASM (onnx/model_quantized.onnx) |
| Backend | WebAssembly (CPU) β no WebGPU required; WebGPU used as an optional accelerator with a WASM fallback |
| Download | ~310 MB (q8, external-data ONNX), cached after first load |
| Reasoning | Opens every reply with a <think> block (visible in the transcript), then answers β this is a feature, not a bug |
| dtype note | The q4 block-quantized build (MatMulNBits / GatherBlockQuantized) aborts on the WebAssembly backend during ONNX Runtime Web session creation, so this demo ships q8, which runs everywhere. |
| License | Apache-2.0 (Pleias) |
| Web APIs | WebAssembly, Web Workers, ES module imports (WebGPU optional) |
Heads up: the first load transfers the weights (~310 MB), then it's cached. Because it's a deep 80-layer model on the WASM/CPU path, tokens stream at a modest pace β and it spends its first tokens thinking before it answers. That's the honest cost of a GPU-free reasoning model.
An LLM never "picks a word" β every step it produces a probability over its whole vocabulary, and
the sampler chooses one. Below is the exact templated prompt the model receives
(ChatML, ending with the opening <think>), and β from one real forward pass
over the current conversation β the actual top candidates for the very next token,
with their probabilities. Raise the temperature and the tail fattens; drop it and the top token
dominates. This is the real distribution, computed on your device, not a mock-up.
Load the model and click "Show next-token distribution".
Baguettotron is a bet that a tiny, deep model can reason β and that you can run that reasoning locally. Because the weights are fully synthetic (SYNTH) and Apache-2.0, and the model is small enough to cache in a browser, it makes private, offline, auditable reasoning a client-side primitive: it works on a locked-down laptop or an older phone, with no GPU, no key, and nothing sent to a server.
<think> block lets you see the model's reasoning, which is useful for teaching, debugging prompts, and trust.Ask a question, watch it think then answer β the core reasoning chat loop.
Separate the reasoning from the answer: a helper that shows the <think> trace and the final reply apart.
Reasoning race: run the same puzzle greedy vs sampled and compare the two thought processes.
On-device RAG: MiniLM retrieves, Baguettotron reasons over the snippets and answers with citations.
It's the standard Transformers.js text-generation pipeline β pass a messages array
(the pipeline applies Baguettotron's ChatML template, which appends the opening
<think>), a TextStreamer for token-by-token output, and your
sampling settings:
import { pipeline, TextStreamer } from "@huggingface/transformers";
// q8 runs on the universal WASM/CPU path. (The q4 block-quant build aborts on the
// WASM backend during ORT-Web session creation, so we use q8 everywhere.)
const generator = await pipeline(
"text-generation", "onnx-community/Baguettotron-ONNX", { device: "wasm", dtype: "q8" },
);
const messages = [
{ role: "system", content: "You are a helpful, concise assistant." },
{ role: "user", content: "What is the capital of France?" },
];
const streamer = new TextStreamer(generator.tokenizer,
{ skip_prompt: true, skip_special_tokens: true, callback_function: (t) => append(t) });
// The model streams a <think> reasoning trace, then its answer.
await generator(messages, {
max_new_tokens: 220, do_sample: true, temperature: 0.7, top_p: 0.9, streamer,
});
The "see inside" panel runs one raw forward pass β
generator.model(generator.tokenizer(prompt)) β reads the last position's
logits, softmaxes them, and shows the real top-k. Everything runs in a Web Worker so
generation never blocks the page; the loader auto-inits an already-cached copy and never silently
re-downloads.