text-generation Β· text Β· WebAssembly (CPU) Β· ~1.76 GB
Apertus is the Swiss AI Initiative's (ETH Zurich + EPFL) push for a genuinely open model: open weights, open data, open recipe, trained only on compliant data with data-owner opt-outs respected. This is the v1.1 1.5B instruct model, distilled and quantization-aware trained to INT4 so it fits constrained hardware β running here on the WebAssembly backend, pure CPU. Chat with it, steer it with a system prompt and sampling controls, and watch the real next-token distribution. Nothing is uploaded; no key, no server.
Heads-up: this is a ~1.76 GB download (cached after the first load) β larger than the small 0.5β0.7B demos, because it's a 1.5B model with a high-precision embedding table. It runs on the CPU; a mid-range laptop generates a few tokens per second.
| Model | onnx-community/Apertus-v1.1-1.5B-Instruct-QAD-INT4-ONNX |
|---|---|
| Base | swiss-ai/Apertus-v1.1-1.5B-Instruct (Swiss AI Initiative / SNAI) |
| Task | text-generation (causal LM, chat-tuned) |
| Architecture | Apertus decoder-only transformer, 1.5B params, xIELU activation |
| Params / dtype | 1.5B Β· q4 (INT4 quantization-aware, onnx/model_q4.onnx) |
| Backend | WebAssembly (CPU) β no WebGPU required |
| Runtime | Transformers.js 4.2.0 (pinned in this worker β the apertus class isn't in the shared 3.7.5) |
| Download | ~1.76 GB, cached after first load |
| Languages | Massively multilingual (1000+ languages in the base model) |
| License | Apache-2.0 (this ONNX build) |
| Web APIs | WebAssembly, Web Workers |
An LLM never "picks a word" β every step it produces a probability over its entire vocabulary, and the sampler chooses one. Below is the exact templated prompt the model receives, 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 CPU, not a mock-up.
Load the model and click "Show next-token distribution".
Apertus is built to be auditable end-to-end β the weights, the data, and the training recipe are all public β which matters for regulated, research, and public-sector use where a black-box model is a non-starter. Running it client-side takes that further: the model is inspectable and the inference is private, offline-capable, and free to run once cached.
Ask a question, watch the answer stream on your CPU β the core chat loop.
Structured extraction: turn free text into schema-shaped JSON.
Polyglot: ask in one language, answer in another β the multilingual base at work.
On-device RAG: Qwen3-Embedding retrieves, Apertus answers with citations.
It's the standard text-generation pipeline with device: "wasm" and
dtype: "q4". The only twist is the runtime: the apertus model class is
in Transformers.js 4.x, not the shared 3.7.5 pin, so this model's worker imports 4.2.0 directly
(an isolated, per-model version pin β no other page is affected).
import { pipeline, TextStreamer } from "@huggingface/transformers"; // v4.2.0 in this worker
const generator = await pipeline(
"text-generation",
"onnx-community/Apertus-v1.1-1.5B-Instruct-QAD-INT4-ONNX",
{ device: "wasm", dtype: "q4" }, // CPU / WebAssembly β no WebGPU
);
const messages = [
{ role: "system", content: "You are a helpful, concise assistant." },
{ role: "user", content: "What makes a model 'fully open'?" },
];
const streamer = new TextStreamer(generator.tokenizer,
{ skip_prompt: true, skip_special_tokens: true, callback_function: (t) => append(t) });
await generator(messages, {
max_new_tokens: 200, do_sample: true, temperature: 0.8, 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
the CPU-bound generation never blocks the page; the loader auto-inits an already-cached copy and
never silently re-downloads the 1.76 GB weights.