(How) Can LLMs run in the browser? NobodyWho has spent several weeks mapping how to run language models in the browser via WebAssembly and concluded that Emscripten plus WebGPU with a CPU fallback is the practical path, since WASI in the browser and WebNN remain experimental. The company, which uses llama.cpp and the ONNX Runtime as inference engines, ruled out the wasm32-unknown-unknown target with wasm-bindgen because both engines assume a system library. NobodyWho is targeting websites rather than browser extensions, noting that even small models are typically a few hundred MB and that WebGPU runs slower on Firefox, while multi-threading requires COOP/COEP cross-origin headers. ← Back to blog https://www.nobodywho.ai/posts/ How Can LLMs run in the browser? A big push here at NobodyWho is to get language models running in the browser using WebAssembly. After working on it for a few weeks we’ve gotten a good idea of the landscape. One thing that’s very clear, and this will come as a surprise, is that browsers are actually kinda complicated. First, we use Rust at NobodyWho, and there are at least three different compilation targets for Rust for WASM: Emscripten, WASI, and wasm32-unknown-unknown with wasm-bindgen . All with different levels of support in various dependencies and within Rust itself. Second, there are at least three different hardware backends: CPU, WebGPU, and WebNN, with the last two being the only reasonably fast ones and both being very new or experimental. Third, there’s the question of whether the LLM will be running in a website or a browser extension. Fourth, and importantly, there are many different browsers and many different browser versions. Many of the features needed for running LLMs in a browser are relatively new, and browser support can be spotty, especially if your users haven’t updated for a while. Spoiled for choice Fortunately, many of these dimensions can get flattened by technical constraints or a specific use case. At NobodyWho we use both llama.cpp and the ONNX Runtime as inference engines, and they both assume a system library. That’s an issue for wasm-bindgen , since the second unknown in wasm32-unknown-unknown means “unknown OS”, i.e. no system library. This leaves WASI and Emscripten, with Emscripten being the obvious choice given that WASI in the browser is… experimental