A language model,
compiled to WebAssembly.
The terminal above is not talking to a server. The model's weights are downloaded once, kept in your browser's cache, and every token is computed on your CPU by a WebAssembly module of about 76 KB. No GPU code, no inference API; what you type and what the model answers never leave the tab. The one exception is /search, which sends a search query out, and only after you confirm it.
What is running
- Models: Qwen3.5-2B and 0.8B, and the older Qwen3-1.7B and 0.6B (all Apache-2.0), using Unsloth's
Q4_K_MGGUF weights. "4-bit" is the usual name; it is a mix of 4-, 5- and 6-bit blocks, about 5.3 bits per weight on average. The large weight matrices are used bit-for-bit as Unsloth published them. Qwen3.5 is a different architecture: three of every four layers replace attention with a small recurrent state (a gated delta rule), so its memory barely grows with the conversation. - Engine: written in Zig, compiled to
wasm32-freestanding; it started as a port of the pure-assembly llm.asm. Integer kernels work directly on the packed 4-bit and 6-bit weights, a small thread pool runs on shared memory, and browsers with relaxed SIMD get a faster dot-product path. - Python: type
/pythonand a question, and the model writes code that a second sandbox (CPython compiled to WebAssembly, no network) runs for it. Good for counting, arithmetic, dates, time zones and small charts, which small models get wrong in their head. - Search (optional): type
/searchand a question. The model in your tab writes a one-line search, and the page shows it and asks yes or no (you can also type a different one). Only on yes is that line sent to this site's server, which passes it to Brave Search; Brave's AI writes a short answer from live web pages, with links to its sources, and the model here replies from that. So for a search, the facts come from Brave's servers, not from the model in the tab, and the page labels them as such. Nothing else from the conversation is sent. If you never use/search, nothing you type leaves the tab. - Checked against references: the engine's exact path matches PyTorch running the same weights to about 4 decimal places in the logits (Qwen3-0.6B, Qwen3-1.7B, Qwen3.5-0.8B); Qwen3.5-2B is checked against native llama.cpp instead, which gives the same greedy output. The page itself runs a faster path that also rounds the activations to 8 bits; its logits differ from the exact path by up to about 0.6, so it usually, but not always, picks the same tokens. The tokenizers match the official Qwen tokenizers on 12 test strings each.
Speed against native llama.cpp
Tokens per second while generating: same weights, same machine (Apple M3 Max, 10 performance + 4 efficiency cores). "This page" is headless Chrome; llama.cpp is native build 8660. Measured 27–28 Nov 2026.
| model | download | this page, 8 threads | llama.cpp CPU, 8 threads | llama.cpp GPU (Metal) |
|---|---|---|---|---|
| Qwen3-1.7B Q4_K_M | 1060 MiB | ~52 | 80 | 147 |
| Qwen3-0.6B Q4_K_M | 382 MiB | ~124 | 163 | 242 |
So the browser reaches roughly 65–75% of native llama.cpp on the CPU when generating. Reading the prompt is where it is furthest behind: llama.cpp processes prompt tokens in batches (513 tok/s for the 0.6B model), this engine does them one at a time (about 160 tok/s).
The Qwen3.5 models, same machine and 8 threads: about 39 tok/s for the 2B and 74 tok/s for the 0.8B. They are slower per parameter here because their vocabulary is larger (248,320 tokens against 151,936), and I have not benchmarked them against llama.cpp.
Your own numbers appear in the terminal after every reply; type /bench for a fixed test and /numbers for the Qwen3 comparison as a chart.
What 4-bit costs
Share of next-token predictions that stay identical to the full-precision model (Qwen3-0.6B, 645 tokens of mixed English, German, code and chat):
| weights | size | same top prediction |
|---|---|---|
| 8-bit (llm.asm Q8_0) | 614 MiB | 98.5% |
| Unsloth Q6_K | 472 MiB | 96.8% |
| Unsloth Q5_K_M | 424 MiB | 94.7% |
| Unsloth Q4_K_M (used here) | 378 MiB | 90.6% |
| Unsloth Q4_0 | 364 MiB | 84.4% |
| naive 4-bit rounding (size estimated) | ~340 MiB | 81% |
Generic compression helps little: zstd at its highest setting shrinks the 8-bit file by about 6%.
How the model plays a game 60 times a second
Type /invaders or /bricks and the same model that takes seconds to write a reply picks a button for every frame of a game, in 5 to 15 milliseconds. The weights and the engine are the same. The speed comes from what is not computed.
- A decision is a classification, not a reply. The model reads the situation and stops. The answer is whichever of four one-token labels (left, right, fire, wait) scores highest at the last position. Nothing is sampled and no text is written.
- Four rows of the output layer instead of all of them. To write a token, the last step scores every entry of the vocabulary: 151,936 rows for Qwen3, 248,320 for Qwen3.5. A decision computes the four rows of its labels.
- The rules are read once. The instructions and ten worked examples, about 180 tokens, are read when the game starts and the model's state at that point is saved. Every decision starts from there.
- Only what changed is read again. The model is told the situation in six tokens, for example
shot none, target left =>. From one frame to the next usually only the last word changes, or nothing. With a KV cache the earlier tokens are still valid, so the engine goes back to the first token that differs: on average 1.8 of the 6 tokens. The answers are identical to reading all six again; a test checks that. - Qwen3.5 needs a different trick. Three of every four of its layers keep a recurrent state instead of a cache, and a recurrent state cannot step back one token. So the engine saves the state partway through a line, in one of four slots; a later line that starts the same way begins from its slot.
What is left is close to the cost of the tokens themselves. On Qwen3-0.6B a decision costs about 2.5 ms per token read, and the length of the saved instructions hardly matters (the same decision took 15 ms after 62 tokens of instructions and 20 ms after 358).
model, playing /invaders | every token, every frame | only what changed | decisions per second | followed the rules |
|---|---|---|---|---|
| Qwen3-0.6B | 17 ms | 7.0 ms | 56 | 98.7% |
| Qwen3-1.7B | not measured | 14.4 ms | 49 | 100% |
| Qwen3.5-0.8B | 19 ms | 8.3 ms | 60 | 97.2% |
Model time per decision in 30-second games, headless Chrome, Apple M3 Max, 8 threads, 28–29 Nov 2026. The game advances one frame per decision and is capped at the screen's refresh rate.
What the model is and is not doing
- The page does the geometry. It reads the ship, the enemies and the shots out of the game's memory and says in words whether a shot is coming and where the nearest target is. The model turns those words into a button, and has to put dodging first. Given raw coordinates instead, none of these models can compare two numbers reliably: in
/bricks rawthe 0.6B model follows the rules 22% of the time. - The moves are not a table in the page. The button pressed is always the label the model scored highest; the page's own copy of the rules is used only to count how often the model agreed with them. As a check, I swapped left and right in the rules and examples: both models then followed the swapped rules in 11 of the 12 possible situations. With the rules and examples removed, the 1.7B model answered fire to everything.
- The small model dodges badly. The percentages in the table are over a game, where most frames have no shot coming. Counting each of the 12 situations once, the 1.7B model gets 11 right and the 0.6B model 8: it usually moves the wrong way when a shot comes from the left.
- The wording decides whether it works. With options labelled A to D in JSON, the 0.6B model gave the same answer for every one of 80 test states. With the rules followed by worked examples, written as the model's own earlier answers, all four models got 80 of 80.
- Only the larger model generalises. Two situations are left out of the examples on purpose. Qwen3-1.7B gets them right; the 0.6B and 0.8B models do not, and get hit more often because of it.
- The game is someone else's. Cosmic Inw4ders by Pierro is an unmodified WASM-4 cart (CC BY-NC-SA 4.0), shown for demonstration purposes only. It runs as a second WebAssembly module next to the inference engine; the page copies a few numbers from one to the other and writes one gamepad byte back.
- It pauses. One decision per frame keeps every thread busy, so the game stops after 60 seconds and when the tab is in the background, and continues on a tap.
In the engine this is four small functions next to the generation loop: classify scores the labels, snapshot and restore save and return to the point after the rules, and classify_mark saves the mid-line point for the recurrent models.
Limits
- These are small models. They get facts wrong with confidence; treat answers as a demo, not a reference.
- Memory in the tab: about 1.4 GB for Qwen3.5-2B, 1.3 GB for Qwen3-1.7B, and 0.6 GB for the two small models.
- The Python sandbox has the standard library only, no network, and is stopped after 15 seconds.
- Keep the tab in the foreground: browsers throttle background tabs, and generation may slow down a lot there.
- Privacy: prompts and replies stay in the tab, and the Python sandbox has no network access. This site does load Cloudflare's page analytics, which reports the page address, load timings and browser version, never the conversation.