cd /news/artificial-intelligence/show-hn-a-52-kb-webassembly-engine-t… · home › topics › artificial-intelligence › article
[ARTICLE · art-177529] src=tesseracted.com ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Show HN: A 52 KB WebAssembly engine that runs Qwen3.5-2B in a browser tab

A developer released LLM.OS, a roughly 52 KB WebAssembly inference engine written in Zig that runs Qwen3.5-2B and Qwen3-0.6B models entirely in a browser tab with no server, GPU or API key. On an Apple M3 Max with 8 threads, the engine generates about 39 tokens per second for Qwen3.5-2B and about 124 tokens per second for Qwen3-0.6B, reaching roughly 65–75% of native llama.cpp CPU throughput on the Qwen3 comparison models. The engine's exact path matches PyTorch logits to about 4 decimal places, while the page's faster 8-bit activation path diverges by up to about 0.6 in logits, and the Q4_K_M weights it uses keep the same top prediction as full precision 90.6% of the time on a 645-token mixed test.

key takeaway

A 52 KB Zig-to-wasm32 engine runs Qwen3.5-2B at about 39 tok/s and Qwen3-0.6B at about 124 tok/s in a browser tab, roughly 65–75% of native llama.cpp CPU speed, using Unsloth Q4_K_M weights that match full-precision top predictions 90.6% of the time.

read4 min views11 publishedNov 28, 2026

001 LLM.OS / local inference

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 52 KB. No GPU code, no inference API; what you type and what the model answers never leave the tab.

~39tok/s Qwen3.5-2B, 8 threads, Apple M3 Max

~124tok/s Qwen3-0.6B, same machine

~52KB inference engine (Zig → wasm32; 52–55 KB depending on the build)

0 servers, GPUs or API keys involved

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'sQ4_K_M GGUF 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 towasm32-freestanding ; it started as a port of the pure-assemblyllm.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/python and 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.
  • 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%.

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.
── more in #artificial-intelligence 4 stories · sorted by recency
── more on @llm.os 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/show-hn-a-52-kb-weba…] indexed:0 read:4min 2026-11-28 · —