LiteRT.js: Google's High-Performance Web AI Inference Library
Technical Deep-Dive · July 2026

LiteRT.js: Google's High-Performance
Web AI Inference Library

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.

Oleg Maximov July 16, 2026 14 min read

What Is LiteRT.js?

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.

Architecture: Three Hardware Backends

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:

CPU — XNNPACK

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.

🎮

GPU — ML Drift + WebGPU

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.

🧠

NPU — WebNN (Experimental)

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.

Performance: Up to 3x Faster Than TensorFlow.js

Google benchmarked LiteRT.js against existing web AI solutions across classical computer vision and audio processing models. The results are striking:

2-3x

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.

Classical Model Performance

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

Getting Started

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.

Image Upscaling with Real-ESRGAN

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.

PyTorch Model Conversion

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.

Real-World Use Cases

LiteRT.js opens up web applications that were previously only possible with native apps. Here are the most compelling use cases:

Object Detection with YOLO

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.

Depth Estimation

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.

Vector Search

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.

Audio Transcription

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.

Comparison: LiteRT.js vs TensorFlow.js

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.

Limitations and Considerations

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.

FAQ

What is LiteRT.js?
LiteRT.js is Google's JavaScript binding for LiteRT — the same on-device ML runtime that powers AI features on Android, iOS, and desktop. It runs .tflite models directly in the browser with hardware acceleration via WebGPU, WebAssembly with XNNPACK for CPU, and experimental WebNN support for NPUs.
How does LiteRT.js compare to TensorFlow.js?
LiteRT.js is 2-3x faster than TensorFlow.js on both CPU and GPU inference. It uses Google's native LiteRT runtime via WebAssembly instead of JavaScript-based kernels, giving it access to XNNPACK (CPU optimization), ML Drift (GPU acceleration), and upcoming WebNN (NPU). TensorFlow.js remains useful for training in the browser, but for inference with .tflite models, LiteRT.js is significantly faster.
What models can I run with LiteRT.js?
LiteRT.js runs any .tflite model. This includes popular computer vision models (YOLO for object detection, Depth-Anything-V2 for depth estimation, Real-ESRGAN for image upscaling), audio processing models, and text models. You can convert PyTorch models to .tflite using LiteRT Torch (one-step conversion), and optimize them with AI Edge Quantizer for size and performance gains.
Does LiteRT.js support WebGPU?
Yes. LiteRT.js uses WebGPU for GPU acceleration via ML Drift — Google's on-device GPU optimization library. On supported hardware, this delivers 5-60x speedup over CPU execution. WebGPU is supported in Chrome, Edge, and Firefox, making GPU-accelerated ML inference widely available on the web.
Is LiteRT.js production-ready?
Yes. LiteRT.js is a stable release from Google with the npm package @litertjs/core, official documentation, and a growing collection of demos. It's backed by the same LiteRT runtime used on billions of Android and iOS devices. WebGPU support is stable in Chrome and Edge; WebNN support is experimental and available behind flags.
What hardware does LiteRT.js support?
LiteRT.js runs on CPU (via WebAssembly with XNNPACK optimizations), GPU (via WebGPU with ML Drift), and NPU (via experimental WebNN API). CPU works everywhere. WebGPU works on Chrome, Edge, and Firefox with a compatible GPU. WebNN is experimental in Chrome and Edge for NPU hardware (e.g., Apple Neural Engine).
Can I use LiteRT.js with PyTorch models?
Yes. LiteRT Torch (ai-edge-torch on GitHub) provides one-step PyTorch to .tflite conversion. You can convert any PyTorch model, quantize it with AI Edge Quantizer for size and performance optimization, and deploy it to the browser with LiteRT.js. This makes Google's entire model optimization pipeline accessible to web developers.

Should You Use LiteRT.js?

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.

Contact

Let's discuss your project

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.