hn.today

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

tesseracted.com13 points2 comments
Screenshot of Show HN: A 52 KB WebAssembly engine that runs Qwen3.5-2B in a browser tab

This project demonstrates local language-model inference in a browser: after model weights are downloaded and cached, a roughly 52 KB Zig engine compiled to WebAssembly generates responses on the user’s CPU, without sending conversations to a server or requiring a GPU or API key. It supports several Apache-licensed Qwen models using Unsloth’s quantized GGUF weights, including Qwen3.5-2B. That newer model uses recurrent state in most layers, so memory use grows little as a conversation continues. An optional `/python` mode lets the model write code for a separate, network-free WebAssembly Python sandbox, useful for calculations and other tasks small models often mishandle.

On an Apple M3 Max, the page reports about 39 tokens per second for Qwen3.5-2B and 74 for Qwen3.5-0.8B; older Qwen models reach roughly 65-75% of native llama.cpp CPU generation speed, though prompt processing is substantially slower. The engine’s exact computation closely matches reference implementations for tested models, while the faster browser path rounds activations and can produce different tokens. Quantization reduces model size but also changes predictions: Q4_K_M matches the full-precision model’s top choice 90.6% of the time in one 645-token test. The demonstration needs up to about 1.4 GB of tab memory, and its small models can confidently give false answers; browser throttling can also slow generation in background tabs.

Read on tesseracted.com2 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in AI

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.