# LiteRT Samples: Official On-Device ML Examples for Android, Python, and the Web

> LiteRT Samples is Google AI Edge's official repository of sample applications, model conversion recipes, agent automation skills, and shared utilities for LiteRT (formerly TensorFlow Lite) and LiteRT-LM. It covers the full deployment lifecycle from Hugging Face checkpoint to a running Android app, with examples across speech, vision, text generation, and web inference.

**google-ai-edge/litert-samples** — LiteRT and LiteRT-LM sample apps, model recipes, agent skills and utilities.

- Repository: https://github.com/google-ai-edge/litert-samples
- Website: https://developers.google.com/edge/litert
- Stars: 446 · Forks: 121
- Language: Python
- License: Apache-2.0
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/google-ai-edge-litert-samples

## What LiteRT Samples Contains and Who It Is For

LiteRT Samples is the official companion repository for Google's LiteRT framework, which Google describes as formerly known as TensorFlow Lite. The repository consolidates sample applications, model conversion recipes, shared utilities, and automation agent skills into a single location. Its primary audience is mobile and edge ML engineers who need working examples of the CompiledModel API, the legacy Interpreter API, LiteRT-LM for on-device LLMs, and the Tensor API for WebAssembly.

The scope is wider than a typical samples collection. The models/ directory contains conversion scripts for specific model families including Qwen3-TTS, Qwen3 ASR, and Bonsai Image 4B. The skills/ directory holds automation scripts that carry a model through the deployment lifecycle in sequence. The utilities/ directory provides shared Kotlin helpers for Android camera pipelines and the LiteRT GPU Toolkit for pre-converting PyTorch patterns before they reach the LiteRT GPU delegate.

The repository's last recorded push was on 2026-09-28, and it is actively updated with new samples and model recipes. It carries no formal GitHub releases; the main branch is the reference.

## Repository Structure: Four Directories, One Lifecycle

The top-level layout reflects the four stages of on-device model deployment. Under samples/, applications are grouped by API paradigm: samples/litert/ uses the CompiledModel API for hardware acceleration on GPU and NPU; samples/litert_interpreter/ uses the legacy Interpreter API for broad compatibility on Android, iOS, and Python; samples/litert_lm/ covers LLM and SLM inference via LiteRT-LM; samples/end_to_end/ contains full pipelines including model conversion, preprocessing, and classification; and samples/tensor_api_playground/ is an interactive WebAssembly playground running Gemma 3, image segmentation, Mandelbrot, and Conway's Game of Life directly in the browser.

Recent additions listed in the README include a streaming text-to-speech Android sample called KittenTTS nano (a 15-million-parameter model at 32 MB) with sentence-level streaming playback and live metrics; a PhotoTalk sample combining LiteRT vision with LiteRT-LM audio and text generation; and an Automatic Speech Recognition sample using the CompiledModel API.

Under models/, conversion scripts are organized by model family. The README points to models/conversion.md as a model conversion cookbook: step-by-step instructions for taking a Hugging Face checkpoint to a verified .litertlm bundle or .tflite graph, with the per-model recipes as worked examples.

The utilities/ directory holds shared Kotlin helpers (camera pipeline, CompiledModel runner, audio capture, image and tensor utilities) and the LiteRT GPU Toolkit, which rewrites common PyTorch patterns into forms the LiteRT GPU delegate accepts and includes a post-conversion checker.

## Getting Started: Python, Android, and the Web Playground

For Python-based samples, the README states the prerequisite is Python 3.9 or later and the ai-edge-litert package:

```bash
pip install ai-edge-litert
```

For Android samples, Android Studio in its latest stable version is required. Each sample under samples/litert/ or samples/litert_interpreter/ has its own README with setup instructions specific to that sample. The README advises navigating to the target sample directory and following that README rather than using a single top-level setup command.

The Tensor API Playground requires no local server for the hosted version: the README directs users to the interactive page at google-ai-edge.github.io/litert-samples/. For local experimentation or offline preview, running a local HTTP server from samples/tensor_api_playground/ is described:

```bash
cd samples/tensor_api_playground
python -m http.server
```

The README specifies that modern browsers with WebGPU or WebAssembly support are needed for the web samples.

## Agent Skills for the LiteRT Deployment Lifecycle

The skills/ directory contains six automation agent skills, each designed for a specific stage of deploying a model with LiteRT. The README describes them in lifecycle order:

The litert-conversion-workflow skill takes a Hugging Face LLM or VLM checkpoint and produces a verified .litertlm bundle for LiteRT-LM. The gpu-clean-conversion skill handles PyTorch and Hugging Face models destined for GPU-resident LiteRT deployment. The accuracy-safe-quantization skill quantizes models to fp16, int8, or int4 while tracking accuracy. The on-device-verification skill proves the converted model on the actual target device. The compiled-model-app-scaffolding skill builds an Android application around the verified model. The litert-compiled-model-migration skill handles the specific case of migrating Android TensorFlow Lite code to the LiteRT CompiledModel V2 API with NPU JIT acceleration and zero-copy buffers.

These skills are intended for AI coding agents that can read and execute skill files, not for manual step-by-step use. The skills/README.md file contains the full index.

## Limitations: Per-Sample Setup and Hardware Constraints

The decentralized structure is both the repository's strength and its practical friction point. Each sample has its own README, its own prerequisites, and sometimes its own specific device requirements that differ substantially from other samples. The CompiledModel API samples require a device with a supported NPU or GPU (modern Pixel, Samsung, Qualcomm, or MediaTek devices, per the README); they will not run correctly on older hardware or generic emulators.

The repository has no GitHub releases and no versioned SDK for the samples themselves. Samples are tied to the state of the main branch. A model recipe or conversion script that worked on a given date may require updates when the underlying LiteRT or LiteRT-LM libraries change, and there is no changelog that tracks sample-level compatibility.

ONNX Runtime is an alternative on-device inference runtime: it supports a broader range of model formats and targets a wider set of hardware backends including CPU, CUDA, DirectML, and TensorRT. The practical difference is that LiteRT is optimized specifically for mobile and edge deployment with first-party support from Google, while ONNX Runtime targets a wider set of deployment scenarios including server-side inference.

## License and Project Background

The repository is released under the Apache License 2.0, which permits commercial use, modification, and distribution with attribution. Third-party components (sentencepiece, PATCH.sentencepiece in the top-level entries, and items in third_party/) carry their own licenses that require separate review before redistribution.

LiteRT is Google's rebrand and evolution of TensorFlow Lite. The README states this relationship explicitly. Teams migrating from TensorFlow Lite can use the litert-compiled-model-migration skill to move Android TFLite code to the CompiledModel API with NPU JIT acceleration and zero-copy buffers. The legacy Interpreter API samples remain in samples/litert_interpreter/ as a reference during the transition, allowing direct comparison between the two APIs on the same model tasks.

## Conclusion

LiteRT Samples is the practical starting point for anyone deploying LiteRT models on Android, iOS, Python, or in a browser. Each sample is self-contained with its own README, so the first step is to open the sample directory for your target platform and follow its specific instructions. The repository is most useful to teams already committed to LiteRT or migrating from TensorFlow Lite; the model conversion cookbook and the TFLite-to-CompiledModel migration skill address that transition directly.

## FAQ

### What is LiteRT used for?

According to the README, LiteRT is Google's open-source, high-performance on-device machine learning framework. It is used to run ML models locally on Android, iOS, Python, and in the browser via WebAssembly, covering tasks such as speech recognition, image classification, object detection, and large language model inference.

### Is LiteRT open source?

Yes. The LiteRT Samples repository is released under the Apache License 2.0. The README links to the LiteRT project at github.com/google-ai-edge/litert.

### What is TensorFlow Lite used for, and how does it relate to LiteRT?

TensorFlow Lite was Google's previous on-device inference framework. The README states that LiteRT is formerly known as TensorFlow Lite. The repository includes a migration skill for moving Android TFLite code to the LiteRT CompiledModel API.

### What is Lite RT?

The README states that LiteRT is Google's open-source, high-performance on-device machine learning framework, formerly known as TensorFlow Lite. LiteRT-LM is a specialized orchestration layer for running LLMs with LiteRT for maximum performance and efficiency on device.

## Sources

- [google-ai-edge/litert-samples on GitHub](https://github.com/google-ai-edge/litert-samples)
- [Issues](https://github.com/google-ai-edge/litert-samples/issues)
- [License: Apache-2.0](https://github.com/google-ai-edge/litert-samples/blob/main/LICENSE)
- [Project website](https://developers.google.com/edge/litert)
- [README](https://github.com/google-ai-edge/litert-samples/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/google-ai-edge-litert-samples
