WebGPU and WebNN Drive 3x Faster Browser AI in LiteRT.js
Google's new LiteRT.js framework leverages WebGPU and WebNN to run machine learning models directly in the browser at up to three times the speed.
Google has officially launched LiteRT.js, a high-performance JavaScript binding for the LiteRT edge AI runtime. The release allows developers to execute machine learning models directly in web browsers with near-native performance. By leveraging modern web standards like WebGPU and WebNN, LiteRT.js shifts computational loads to client-side hardware, reducing server costs and eliminating network latency for real-time applications.
Hardware Acceleration and Benchmarks
LiteRT.js manages execution across different hardware profiles using a dynamic CompiledModel API. This implementation automates accelerator selection and handles I/O buffers asynchronously to keep latency low.
| Backend | Technology | Target Hardware |
|---|---|---|
| GPU | ML Drift via WebGPU | High-throughput parallel processing graphics units |
| NPU | WebNN API | Dedicated Neural Processing Units for low-power efficiency |
| CPU | XNNPACK mapped to WebAssembly | Legacy devices via multi-threading and relaxed SIMD |
In controlled browser environments running on a 2024 Apple MacBook Pro with M4 Apple Silicon, Google recorded up to a 3x increase in inference throughput across both CPU and GPU backends compared to previous web runtimes. The gains were particularly pronounced in classical computer vision and audio processing workloads.
Generative AI and Gemma 4 Integration
Alongside the core library, Google introduced LiteRT-LM.js, a specialized API built specifically for browser-based Large Language Models. This module handles streaming token output and conversation state management.
It ships with native support for web-optimized variants of Gemma 4. Developers can target specific configurations like gemma-4-E2B-it-web.litertlm and gemma-4-E4B-it-web.litertlm. If you plan to run Gemma 4 on-device, this specialized web variant avoids the memory bottlenecks typically associated with loading billion-parameter models into a browser tab.
Ecosystem Interoperability
LiteRT.js utilizes the standard .tflite flatbuffer format. This ensures that models deployed to web environments remain consistent with those compiled for Android and iOS.
For teams working outside the Google ecosystem, the release includes a litert-torch converter. Developers can write their models in PyTorch, JAX, or standard TensorFlow, export them via standard tooling, and run the resulting .tflite files directly in the browser. The package also integrates with existing TensorFlow.js pipelines, meaning you can swap out the underlying AI inference engine without rewriting your application’s data preprocessing or rendering logic.
The core package is available via npm as @litertjs/core. If you are building client-side AI features, you should test your existing .tflite models in the new LiteRT.js model tester application to measure the exact throughput gains on your target hardware before migrating your production dependencies.
Get Insanely Good at AI
The book for developers who want to understand how AI actually works. LLMs, prompt engineering, RAG, AI agents, and production systems.
Keep Reading
How to Cut CPU Costs with Cloudflare Workers Cache
You will learn how to configure Cloudflare Workers Cache to serve responses directly from entrypoints, handle invalidations, and partition cache keys.
Claude 4 Opus Hits Microsoft Foundry With 30% Faster Throughput
Anthropic has made Claude 4 Opus, Sonnet, and Haiku generally available on Microsoft Foundry, offering increased throughput via Blackwell clusters.
TPU v5p Inference Speeds Triple With DFlash Block-Diffusion
Google and UCSD researchers released DFlash, a block-diffusion speculative decoding method that achieves a 3.13x average inference speedup on TPU v5p hardware.
NotebookLM Gains Cloud Environments and Gemini 3.5 Agents
Google has upgraded NotebookLM to an agentic research assistant featuring Gemini 3.5, secure cloud computing environments, and autonomous web search.
Crypto Key Stealer Hidden in Usage Telemetry Hits Injective SDK
Attackers compromised a maintainer's GitHub account to inject wallet-stealing malware disguised as telemetry into the official Injective SDK on npm.