Google brings its native on-device ML runtime to the browser — delivering up to 3x faster inference than TensorFlow.js with WebGPU acceleration. Hands-on guide with code examples, performance benchmarks, and real-world use cases.
On July 9, 2026, Google announced LiteRT.js — a JavaScript binding of LiteRT, Google's trusted on-device inference runtime that powers AI features on billions of Android, iOS, and desktop devices. LiteRT.js brings that same runtime to the web browser, letting JavaScript developers run ML and AI models with maximum performance entirely client-side.
The key insight: previous web AI solutions like TensorFlow.js relied on JavaScript-based kernels for model execution, which are inherently slower than native code. LiteRT.js compiles the entire LiteRT runtime — with all its performance optimizations — to WebAssembly, making it available directly in the browser without any server-side dependencies.
The result: zero server costs, enhanced user privacy, and ultra-low latency for real-time AI experiences. If you have existing .tflite models, LiteRT.js makes deployment to web browsers smoother than ever, serving as a powerful evolution from TensorFlow.js for model inference.
LiteRT.js doesn't just run models — it runs them on the right hardware. The architecture provides three acceleration backends, each optimized for a different target:
Google's highly optimized CPU acceleration library with multi-thread support and relaxed SIMD. Works everywhere, falls back gracefully, and is still 2-3x faster than JS-based kernels.
State-of-the-art GPU acceleration via WebGPU. Delivers 5-60x speedup over CPU for vision and audio models. Supported in Chrome, Edge, and Firefox.
Targets dedicated neural processing units for power-efficient, ultra-low-latency inference. Experimental in Chrome and Edge (Apple Neural Engine, etc.).
The runtime automatically selects the best available backend. If WebGPU is unavailable, it falls back to WebAssembly with XNNPACK. If the browser supports WebNN and the device has an NPU, that's used for maximum power efficiency.
Google benchmarked LiteRT.js against existing web AI solutions across classical computer vision and audio processing models. The results are striking:
Faster than TensorFlow.js across both CPU and GPU inference
Benchmarked on a 2024 Apple MacBook Pro M4 — individual results may vary by GPU, thermal conditions, and browser driver optimization.
For demanding real-time applications like object tracking, audio transcription, or image manipulation, leveraging the GPU or NPU via WebGPU or WebNN delivers 5-60x speedup compared to standard CPU execution. This makes the difference between a demo and a production-ready experience.
| Model | CPU (XNNPACK) | WebGPU | WebNN (CoreML) |
|---|---|---|---|
| MobileNet v3 | ~4 ms | ~1 ms | ~0.5 ms |
| YOLOv8n | ~15 ms | ~3 ms | ~2 ms |
| DeepLab v3 | ~40 ms | ~8 ms | ~5 ms |
| Real-ESRGAN (4x) | ~200 ms | ~35 ms | ~25 ms |
| Whisper Tiny | ~80 ms | ~12 ms | ~8 ms |
LiteRT.js is distributed as an npm package called @litertjs/core. Install it in your project:
npm install @litertjs/core
The API is clean and modern JavaScript. Here's the minimal example for loading and running a model:
import { LitertRuntime, LitertTensor } from '@litertjs/core';
// Initialize the runtime with WebGPU acceleration
const runtime = await LitertRuntime.create({
backends: ['webgpu', 'wasm'], // prefer GPU, fallback to CPU
});
// Load a .tflite model
const model = await runtime.loadModel('/models/mobilenet-v3.tflite');
// Create input tensor (shape depends on model)
const input = new LitertTensor('float32', [1, 224, 224, 3]);
input.setData(imageData); // preprocessed pixel data
// Run inference
const output = await model.invoke(input);
// Read results
const predictions = output.getData();
console.log('Top class:', predictions.indexOf(Math.max(...predictions)));
The runtime handles all backend selection automatically. If you pass backends: ['webgpu', 'wasm'],
it will try WebGPU first and fall back to WebAssembly with XNNPACK if WebGPU isn't available.
One of the most impressive LiteRT.js demos is real-time 4x image upscaling using Real-ESRGAN. The model upscales 128x128 pixel patches to 512x512, which are then reassembled into the final image:
import { LitertRuntime } from '@litertjs/core';
const runtime = await LitertRuntime.create({ backends: ['webgpu'] });
const model = await runtime.loadModel('/models/realesrgan-4x.tflite');
async function upscaleImage(imageData, width, height) {
const outputCanvas = document.createElement('canvas');
outputCanvas.width = width * 4;
outputCanvas.height = height * 4;
// Process in 128x128 patches
for (let y = 0; y < height; y += 128) {
for (let x = 0; x < width; x += 128) {
const patch = extractPatch(imageData, x, y, 128, 128, width);
const input = tensorFromImage(patch, 128, 128);
const result = await model.invoke(input);
renderPatch(outputCanvas, result, x * 4, y * 4);
}
}
return outputCanvas;
}
This runs entirely in the browser — no server upload, no GPU rental, no API keys. The user uploads an image, LiteRT.js processes it locally, and the upscaled result appears in seconds.
LiteRT.js isn't limited to TensorFlow/Keras models. With LiteRT Torch (ai-edge-torch), PyTorch models can be converted to .tflite in a single step:
import torch
import ai_edge_torch
# Load your PyTorch model
model = torch.load('yolov8n.pt')
model.eval()
# Convert to .tflite in one step
example_input = torch.randn(1, 3, 640, 640)
edge_model = ai_edge_torch.convert(model, example_input)
# Save for browser deployment
edge_model.export('yolov8n.tflite')
For further optimization, AI Edge Quantizer lets you configure tailored quantization schemes across different model layers — achieving substantial size reductions (4x smaller) while preserving overall model quality.
LiteRT.js opens up web applications that were previously only possible with native apps. Here are the most compelling use cases:
Ultralytics — the creators of YOLO — have built official LiteRT export support directly into their Python package. You can deploy YOLO26 models across mobile, edge, and browsers from just a few lines of code. The web demo runs real-time object detection from a webcam feed entirely in the browser.
The Depth Anything demo showcases monocular depth estimation powered by LiteRT.js via WebGPU. It transforms a standard webcam feed into an interactive 3D point cloud in real-time — calculating depth data and mapping video pixels into responsive 3D space, all in the browser.
An exciting application is vector search directly in the browser, powered by LiteRT.js and EmbeddingGemma. Text and images are converted to embeddings on-device, then searched using vector similarity — all without sending any data to a server. See the CodePen demo.
Whisper models converted to .tflite can transcribe audio in real-time on the client. This means voice notes, meeting transcriptions, and accessibility features work offline and with zero latency — ideal for Progressive Web Apps and Electron applications.
If you're already using TensorFlow.js, you might wonder whether to switch. Here's an honest comparison:
| Feature | LiteRT.js | TensorFlow.js |
|---|---|---|
| Inference Speed | 2-3x faster ★ | Baseline (JS kernels) |
| Model Format | .tflite | TF.js model, .tflite (limited) |
| PyTorch Support | LiteRT Torch (one-step) ★ | ONNX conversion needed |
| GPU Acceleration | WebGPU (ML Drift) ★ | WebGL (limited) |
| NPU / WebNN | Experimental support ★ | Not supported |
| Training in Browser | Not supported | Supported ★ |
| Model Size | Smaller (quantization) ★ | Larger |
| Ecosystem Maturity | New (July 2026) | Mature (6+ years) ★ |
| Documentation | Good, growing | Excellent ★ |
Bottom line: If you're running inference on existing .tflite models, LiteRT.js is strictly better — faster, smaller, and better hardware support. If you need to train models in the browser, or you have an existing TensorFlow.js pipeline that works well, there's no urgent need to migrate. TensorFlow.js users can gradually adopt LiteRT.js for inference while keeping TF.js for training — they can coexist in the same project.
LiteRT.js is impressive, but it's not a silver bullet. Here's what you need to consider:
Performance tip: For production applications, pre-compile your .tflite models with XNNPACK quantization during the build step. This reduces model size by ~4x and improves inference speed by 30-50% compared to runtime quantization. The litert_quantize CLI tool is available in the LiteRT SDK.
If you're building any web application that needs on-device AI — image recognition, object detection, audio processing, or text analysis — LiteRT.js is currently the best option for running inference in the browser. It's faster than TensorFlow.js, better at hardware acceleration, and backed by Google's mature LiteRT ecosystem.
The ideal time to adopt LiteRT.js is now. The library is stable, the npm package is published, and the ecosystem of pre-trained .tflite models is growing rapidly (Kaggle, Hugging Face). WebGPU support in major browsers means most users will get GPU acceleration without any configuration. For language-based AI features like summarization, classification, and content moderation, pair LiteRT.js with the Chrome Prompt API — Google's built-in browser AI for natural language tasks.
Looking ahead, Google's roadmap includes advancing WebNN integration for native NPU performance and optimized support for on-device generative AI (via LiteRT-LM.js for LLMs). The trajectory is clear: more of AI is moving to the client, and LiteRT.js is how web developers get there.
Working on an application that needs on-device AI? I can help integrate LiteRT.js or advise on the best architecture for your use case. Free initial consultation.