wllama 4.0: Run GGUF Models Over 4 GB in a Browser Tab

Your browser tab is now a hybrid llama.cpp

On 22 November 2026, ngxson shipped wllama v4.0.0 (MIT, synced to llama.cpp commit 0b51bb2 in PR #368). Until this release, running a local GGUF inside a browser tab ran into a hard 4 GB WebAssembly memory wall, and v3.x recommended pre-splitting models into 512 MB shards. Version 4.0 removes that wall.

A single WebAssembly instance still cannot address more than 4 GB of memory. In v4.0.0, the main build uses 32-bit memory instead of Memory64 (PR #347), while the compat build used by Safari keeps Memory64 (with its cap raised to 16 GB in PR #339). For GGUF files of 4 GB or larger, wllama splits the file into virtual shards in memory with zero data copying. When the CPU portion of a model exceeds 4 GB, wllama spreads layers across extra WebAssembly RPC workers, each carrying its own 4 GB address space (PR #352). Turn on WebGPU and the engine uses llama.cpp's own "fit" placement logic (PR #358) to keep what fits on the GPU and spill the remaining layers onto CPU RPC workers.

There are two deployment catches worth knowing before you try a 5 GB file. First, RPC workers require multi-threading, so the hosting page must send cross-origin isolation headers (COOP and COEP); without them, or on older Firefox builds lacking JSPI, CPU models above 4 GB cannot load. Second, the multi-worker RPC load path does not yet use the fast OPFS sync access handle, so >4 GB models load slower (0.32 to 0.52 GiB/s) and peak at 1.5x to 1.7x file size in browser memory.

What fits in a tab: author-measured memory and speed

Because wllama 4.0 switches its main build to llama.cpp's SIMD and relaxed SIMD kernels (PR #331) and reads single-instance OPFS-cached models directly into wasm memory via a sync access handle (PR #356), both load times and token rates jumped.

Every number below comes from ngxson's 22 November 2026 benchmark (issue #338) on a MacBook Pro M5 Max (128 GB, macOS 26.3), CPU only (n_gpu_layers: 0, 6 threads, n_ctx: 1024, 270-token prompt + 64 generated tokens, median of 2 runs with 1 CPU core busy on a background job, Chrome 157 main build, comparing v3.13.0 against pre-release master 26a4e59 + llama.cpp cbb1c1c):

Model (file size) Load time (v3.13.0 -> v4.0.0) Prompt (t/s) Generation (t/s) Peak browser memory
LFM2 350M Q4_K_M (0.21 GiB) 385 -> 221 ms (1.7x) 247 -> 598 (2.4x) 134.6 -> 276.9 (2.1x) 0.62 -> 0.64 GiB
LFM2.5 1.2B Q4_K_M (0.68 GiB) 565 -> 232 ms (2.4x) 73 -> 207 (2.8x) 48.9 -> 117.8 (2.4x) 1.25 -> 1.10 GiB
Qwen2.5-Omni 3B Q4_K_M (1.96 GiB) 1,514 -> 535 ms (2.8x) 25 -> 66 (2.6x) 16.8 -> 41.8 (2.5x) 3.02 -> 2.49 GiB
Gemma 4 E4B Q4_0 (4.80 GiB) fails -> 9.3 s 56 18.9 7.04 GiB

Look at the peak memory column. A 1.96 GiB 3B model now peaks at 2.49 GiB (down from 3.02 GiB in v3.13.0) and loads in 535 ms. A 4.80 GiB Gemma 4 E4B Q4_0 file, which failed outright in v3.13.0, loads in 9.3 s at 0.52 GiB/s, peaks at 7.04 GiB of browser memory, and generates at 18.9 t/s on 6 CPU threads with zero install.

Firefox 161 now runs the same main build when JSPI and relaxed SIMD are present, hitting 200 -> 430 t/s prompt and 112.5 -> 221.4 t/s generation on LFM2 350M (0.63 GiB peak) and 56 -> 129 t/s prompt / 38.2 -> 80.7 t/s generation on LFM2.5 1.2B. Safari still uses the compat build.

Drafting, LoRAs, and faster downloads

Version 4.0 brings several features that previously belonged to native llama-server installs:

  • Speculative decoding (PR #362): supports MTP, DFlash, DSpark, Eagle3, and smaller same-family draft models. On WebGPU, DFlash, DSpark, and MTP add about 1.2x generation speed; on CPU they usually slow generation down and are not recommended.
  • LoRA adapters (PR #362, #363): load one or more adapters from URLs or Blobs and adjust per-request scale at runtime.
  • Multi-connection downloads (PR #364, #336): files of 64 MB or more download in parallel parts (default 4 connections, configurable up to 8 or more) with resume after interruption.
  • Audio, video, and state: full-duplex realtime audio (such as Hibiki), video input, saveSlotState / restoreSlotState for prompt reuse, and batched decision models (createSystemOne, packing up to 16 questions in one prompt for LFM3-D1).

When to stay native

A browser tab is ideal for zero-install demos, small 350M to 3B assistants, and client-side privacy tools. Once you move past Gemma 4 E4B's 7.04 GiB of peak browser memory or want sustained desktop GPU throughput, native builds like llama.cpp 1.0 or local agent stacks like n8n Nod still win on memory efficiency and kernel speed. Use our VRAM calculator to size native GPU fits, or our speed estimator to compare desktop cards.