Open & local AI

Running Qwen LLMs locally in the browser with WebAssembly

Tesseracted Labs demonstrates running Qwen models entirely client-side using a 52 KB WebAssembly engine, achieving significant token speeds without servers or GPUs.

A glass cube with glowing circuits representing local AI processing on a desk.
Illustration generated for this article

A new demonstration by Tesseracted Labs shows large language models running entirely within a web browser tab, eliminating the need for remote servers or graphics processing units. Published in late November 2026, this implementation uses a lightweight WebAssembly module to execute Qwen models directly on the user's CPU, ensuring that all input and output data remains local.

What happened

The project, titled LLM.OS, enables users to interact with Qwen3.5-2B and Qwen3-0.6B models without any network dependency after the initial weight download. The core innovation is a inference engine compiled from Zig to WebAssembly, weighing only about 52 KB. This module handles all computation on the client side, meaning no API keys, GPU code, or backend infrastructure are required for operation. The model weights are cached in the browser, allowing subsequent sessions to load instantly without re-downloading data.

This approach contrasts sharply with standard AI deployments that rely on cloud APIs or local installations of heavy frameworks like PyTorch. By moving execution into the browser sandbox, the system guarantees privacy by design; prompts and responses never leave the device. The interface presents a terminal-like environment where users can chat with the model or trigger specific computational tasks, all processed through the browser’s JavaScript and WebAssembly capabilities.

The implementation supports multiple versions of the Qwen family, including the older Qwen3-1.7B and 0.6B variants. These models use Unsloth’s Q4_K_M GGUF weights, which employ a mixed-precision quantization strategy. This method averages about 5.3 bits per weight, balancing memory efficiency with computational accuracy. The architecture of Qwen3.5 further optimizes this setup by replacing attention mechanisms in three out of every four layers with a gated delta rule, a recurrent state that keeps memory usage stable regardless of conversation length.

How it works

The engine operates by compiling integer kernels directly from Zig to the wasm32-freestanding target. It started as a port of pure-assembly code, optimized to work on packed 4-bit and 6-bit weights without decompression. A small thread pool manages parallel execution using shared memory, while browsers supporting relaxed SIMD instructions benefit from accelerated dot-product calculations. This low-level optimization allows the tiny 52 KB binary to perform complex matrix operations efficiently on general-purpose CPUs.

For tasks requiring precise arithmetic or logic, the system includes a Python sandbox. When a user types /python followed by a query, the model generates code that executes in a secondary WebAssembly instance running CPython. This isolated environment has no network access but can handle counting, date calculations, and chart generation. This feature addresses a common weakness in small language models, which often struggle with exact mathematical reasoning when relying solely on next-token prediction.

Accuracy is maintained through rigorous validation against reference implementations. The engine’s output matches PyTorch logits to approximately four decimal places for smaller models and aligns with native llama.cpp outputs for the larger Qwen3.5-2B variant. While a faster rendering path rounds activations to 8 bits, causing minor logit deviations, the greedy decoding usually selects the same tokens as the exact path. Tokenizers also match official Qwen specifications across multiple test strings, ensuring consistent text processing.

Key details

  • The inference engine is approximately 52–55 KB, compiled from Zig to WebAssembly.
  • Qwen3.5-2B achieves roughly 39 tokens per second on an Apple M3 Max with 8 threads.
  • Qwen3-0.6B reaches approximately 124 tokens per second on the same hardware configuration.
  • Browser-based performance is about 65–75% of native llama.cpp CPU speeds for generation tasks.
  • Prompt processing is slower in the browser, handling about 160 tokens per second compared to 513 in native builds.
  • All model weights and computations remain local, with zero data transmitted to external servers during inference.

Why it matters

For software developers and technical founders, this development signals a shift toward truly private, client-side AI interactions. Removing the server from the inference loop eliminates latency associated with network round trips and removes the cost burden of GPU hosting. It also solves critical data sovereignty issues, as sensitive corporate or personal data never leaves the user’s device. This makes it viable to deploy capable assistants in environments with strict compliance requirements or limited connectivity.

The performance gap between browser-based WebAssembly and native CPU execution is narrowing, though not yet closed. Achieving 65–75% of native speed suggests that for many interactive applications, the convenience of zero-install deployment outweighs the raw performance loss. However, the bottleneck in prompt processing indicates that current WebAssembly implementations still struggle with batched operations compared to highly optimized native binaries. Engineers building AI products must weigh these trade-offs when deciding between web-native and hybrid architectures.

What you can do

  • Test the LLM.OS demo in a modern browser to evaluate real-world latency on your specific hardware.
  • Benchmark your own devices using the built-in /bench command to compare token generation speeds.
  • Explore the /python feature to see how code-interpreter capabilities can improve accuracy for logical tasks.
  • Review the Qwen3.5 architecture details to understand how recurrent states reduce memory growth in long conversations.
  • Consider WebAssembly as a distribution channel for lightweight AI tools where privacy and ease of access are priorities.
  • Monitor updates to browser SIMD support, as these hardware accelerations will directly impact future inference speeds.
  • #webassembly
  • #llm
  • #qwen
  • #privacy
  • #zig

Tools from the Bytechap store

$89

DocBento

Self-hosted document management that reads every scan and answers with page citations.

Live demo

Keep reading

All stories