Google LiteRT.js Shifts Inference Workloads to WebAssembly Runtimes
The new library enables native browser-based machine learning by compiling C++ inference kernels to WebAssembly and leveraging WebGPU for hardware acceleration.
The new library enables native browser-based machine learning by compiling C++ inference kernels to WebAssembly and leveraging WebGPU for hardware acceleration.

Google released LiteRT.js on July 9, 2026, introducing a JavaScript binding that facilitates on-device machine learning inference within web browsers by bypassing traditional interpreted kernels. This library leverages WebAssembly to execute Google’s native C++ inference runtime, effectively eliminating the requirement for server-side processing and ensuring user data remains local to the client device.
The architecture replaces the previous TensorFlow.js approach, which relied on JavaScript-based kernels and WebGL abstractions that introduced significant latency through garbage collection and type checking. By compiling the XNNPACK CPU acceleration library and the ML Drift GPU inference engine to WebAssembly, the new runtime achieves performance parity with native mobile implementations. This transition allows developers to utilize the same optimized inference paths currently powering AI features on Android and iOS platforms.
Benchmark data collected on a 2024 MacBook Pro with M4 silicon demonstrates substantial performance gains across various workloads. For standard computer vision and audio processing tasks, LiteRT.js delivers inference speeds up to 3× faster than legacy web runtimes. When utilizing GPU or NPU acceleration, demanding real-time applications such as object tracking and audio transcription realize speedups ranging from 5× to 60× compared to CPU-only execution paths.
The library provides a unified JavaScript interface across three distinct backends to manage hardware diversity. The CPU backend utilizes XNNPACK with multi-threading and SIMD support, serving as the universal fallback for environments lacking hardware acceleration. This specific implementation allows for relaxed SIMD builds that maximize throughput on modern processors, ensuring that even systems without dedicated GPU resources maintain functional inference capabilities.
The GPU backend routes operations through WebGPU using ML Drift, which exposes dedicated compute shaders for parallel execution. Unlike previous WebGL implementations, this approach allows for the direct mapping of matrix multiplications and convolutions to hundreds of GPU cores. This parallelization is the primary driver behind the significant latency reductions observed in real-time image manipulation and object detection tasks.
The NPU backend targets dedicated neural processing units via the WebNN API, representing a shift toward hardware-specific acceleration for power-efficient inference. By offloading tensor operations to specialized silicon, this path minimizes the thermal and power constraints typically associated with continuous inference on mobile and laptop devices. While currently experimental, this integration provides a pathway for future-proofing web applications against the increasing prevalence of NPU-equipped consumer hardware.
Integration with existing ecosystems remains a priority, as LiteRT.js is designed to function alongside TensorFlow.js rather than replacing it entirely. Developers can manage pre-processing and post-processing pipelines in TensorFlow.js while delegating heavy model execution to the LiteRT.js runtime. The @litertjs/tfjs-interop package facilitates the necessary tensor transfers between these two layers, allowing for incremental migration of production applications.
Technical constraints exist within this initial v1 release that require careful management by engineering teams. The library enforces all-or-nothing model delegation, meaning a single model graph cannot be partitioned across CPU and GPU backends unless the browser supports JavaScript Promise Integration. Furthermore, GPU-resident tensors necessitate manual memory management, as they reside outside the standard JavaScript garbage collector, requiring developers to explicitly invoke deletion methods to prevent memory leaks.
The migration of model execution from cloud-based servers to the client-side browser environment fundamentally alters the economics and latency profile of web-based AI. By executing compute-intensive operations directly on the user’s graphics hardware, developers can eliminate per-inference costs and reduce the round-trip time associated with network requests. This architectural pivot prioritizes local data processing, which addresses critical privacy concerns by ensuring that sensitive user inputs never leave the local sandbox environment.
Future development cycles will focus on addressing current limitations regarding model size and hardware compatibility. While the current 2GB memory ceiling restricts the use of large language models, Google has announced a companion package, LiteRT-LM.js, to extend support for these architectures. Continued maturation of the WebNN API and broader browser adoption of WebGPU will be critical for achieving consistent performance across diverse hardware configurations.


