Official sample applications, end-to-end model conversion recipes, model benchmarks, and AI coding agent skills for on-device ML & GenAI.
π Ecosystem β’ π€ Hugging Face Hub β’ π Quickstart (Level 1β5) β’ π± Sample Apps β’ π§ͺ Model Recipes β’ π€ Agent Skills β’ π Repo Map
Welcome to litert-samples β the central developer hub for
- LiteRT (Google's high-performance, cross-platform, production-proven on-device inference, powering Google and 3P applications globally, succeeding TensorFlow Lite) and
- LiteRT-LM (Google's specialized orchestration layer for running LLMs with LiteRT, unlocking maximum performance and efficiency).
Whether you want to try a model in your browser in 30 seconds, drop a pre-converted model from Hugging Face litert-community into a mobile/desktop/web app, or convert, quantize, verify, and benchmark a new checkpoint on CPU, GPU, and NPU, this repository takes you from first run to production deployment.
Tip
π Featured Community Showcase β Google Gemma Hardware Hackathon (AGI House)
Explore 29 verified on-device projects built with LiteRT and LiteRT-LM across Android/iOS phones, Raspberry Pi, NVIDIA Jetson, and robots β featuring the Best Use of LiteRT award winners (Sherpa Survival, DJemma, and Wonder Agent). π Browse the hackathon showcase, repos & demos β
- π¦ Cross-Platform Flutter & Intel NPU Showcases: Added a full multimodal Flutter app (
samples/litert/flutter/) running voice chat, live camera detection, RAG, and agent skills across Android, iOS, macOS, Linux, Raspberry Pi 5, Jetson Orin, and Qualcomm VENTUNO Q β plus a 3-act Intel Core Ultra NPU showcase (samples/litert/flutter_intel_npu/) running Gemma 4 across CPU, GPU, and NPU. - π± LiteRT Model Zoo (34 Tasks in One App): Expanded
samples/litert_model_zoo/to 21 Vision, 8 Audio, and 5 Text Decision models via the LiteRTCompiledModelAPI, streaming verified weights on-demand fromlitert-community. - ποΈ Offline Voice Assistant & Embodied Robotics: Added an offline Android voice assistant with tool calling (
samples/litert_lm/voice_assistant/) and a Raspberry Pi Reachy voice robot that sees, hears, reasons, and speaks (samples/litert_lm/reachy-voice-robot/). - π Client-Side WebGPU Demos & Chrome Extension: Added 5 zero-server browser demos built on
@litertjs/core(samples/web_demos/: SAM 2.1, CLIPSeg, MoGe-2 3D, PP-OCRv5, Matcha-TTS) and a Chrome Extension for on-page OCR, TTS, and 3D photo hover. - π§ͺ End-to-End Model Conversion Cookbook & Recipes: Added
models/conversion.mdand reproducible conversion/verification pipelines undermodels/for MiniCPM5-2B, Hunyuan Hy-MT2-1.8B, Nemotron-3-Nano-4B, Bonsai Image 4B, Qwen3-TTS, SAM 3, Zipformer ASR, wav2vec2 KWS, and GLiNER2.5. - π Real-Device Cloud Benchmarking & AI Agent Skills: Added Google Cloud Developer Device Platform (DDP) Colab notebooks, the LiteRT Performance Leaderboard, and 9 end-to-end
SKILL.mdplaybooks (skills/) for AI coding agents.
litert-samples connects the entire google-ai-edge open-source stack with the Hugging Face litert-community model ecosystem:
flowchart LR
subgraph Source["1. Author & Convert"]
PT["PyTorch / JAX / TF<br/>& HF Safetensors"] --> TORCH["litert-torch &<br/>ai-edge-quantizer"]
REC["litert-samples/models/<br/>Conversion Recipes"] -.->|Scripts & Gates| TORCH
end
subgraph Hub["2. Model Hub (Hugging Face)"]
TORCH -->|".tflite & .litertlm"| HF["π€ litert-community<br/>400+ Ready-to-Run Models"]
end
subgraph Runtime["3. On-Device Runtimes & CLI"]
HF --> RT["LiteRT Runtime<br/>CompiledModel & Tensor API"]
HF --> LM["LiteRT-LM Engine<br/>LLMs, VLMs & Tool Calling"]
HF --> CLI["LiteRT-CLI (litert)<br/>1-Command Run & Benchmark"]
end
subgraph Silicon["4. Hardware Acceleration"]
RT & LM --> HW["CPU (XNNPACK)<br/>GPU (ML Drift / OpenCL / Metal / WebGPU)<br/>NPU (Qualcomm, Google Tensor, MediaTek, Intel)"]
end
subgraph Apps["5. Apps, Web & Benchmarks (This Repo)"]
HW --> SAMP["π± samples/ β’ π web_demos/<br/>π benchmark/ β’ π€ skills/"]
end
| Repository / Hub | Role in the Stack | Artifact / API |
|---|---|---|
google-ai-edge/LiteRT |
Core on-device runtime featuring the CompiledModel API (V2), C++ Tensor API, LiteRT.js (WebGPU/WASM), and unified GPU/NPU acceleration. | .tflite |
google-ai-edge/LiteRT-LM |
Production inference engine for LLMs & VLMs (prefill/decode orchestration, KV cache, multimodal vision/audio towers, tool calling). | .litertlm |
huggingface.co/litert-community |
Official community hub hosting 400+ pre-converted, quantized, and verified .tflite and .litertlm models ready for on-device deployment. |
.tflite, .litertlm |
google-ai-edge/litert-samples (You are here) |
Reference apps (Android, iOS, Flutter, Web, Linux/Pi), conversion recipes (models/), DDP benchmarks (benchmark/), and agent skills (skills/). |
End-to-End Code |
google-ai-edge/LiteRT-CLI |
Unified command-line tool (litert) to download, convert, quantize, run, and benchmark models locally or on cloud device farms (--ddp). |
litert CLI |
google-ai-edge/litert-torch & ai-edge-quantizer |
PyTorch-to-LiteRT converter, Generative Torch API for re-authoring LLMs, and accuracy-safe PTQ/quantization toolkit (fp16 / int8 / int4). |
Python SDK |
google-ai-edge/gallery & model-explorer |
End-user showcase app for trying local GenAI models (gallery) and interactive hierarchical graph visualizer/debugger (model-explorer). |
App & Visualizer |
Every sample application, web demo, and recipe in this repository is tightly integrated with Hugging Face litert-community β no manual conversion is required to get started, and no heavy model weights are bloated into git history.
| Interactive Portal | What You Can Do | Source in This Repo |
|---|---|---|
π€ litert-community Organization |
Browse 400+ pre-converted models across LLMs, VLMs, ASR, TTS, Image Generation, Detection, Segmentation, and Depth. | models/ |
| π Find Your Models (HF Space) | Filter every litert-community model by family, parameter size, task, on-device latency/tokens-per-sec, conversion recipe, and copy ready-to-run litert CLI commands. |
community/models_page/ |
| π Trending & Weekly Picks (HF Space) | Track trending & newest edge models, weekly community picks, matching apps in litert-samples, and live browser Spaces. |
community/trending_page/ |
π‘ Browse by Hardware & Platform Collections on Hugging Face: Android β’ iOS β’ Web LLM β’ Web Classical β’ Desktop β’ Google Tensor TPU β’ Qualcomm NPU
We organized this repository progressively so you can start at the depth that matches your goal:
- Level 1 β Zero Install (30s): Run client-side WebGPU/WASM demos right in your browser.
- Level 2 β 3-Minute CLI Quickstart: Download, run, and benchmark any
litert-communitymodel in 3 commands. - Level 3 β Run & Build Sample Apps: Build full apps for Android, iOS, Flutter, macOS, Windows, Linux, Web, and Raspberry Pi.
- Level 4 β Convert & Quantize Models: Turn Hugging Face / PyTorch checkpoints into verified
.litertlmand.tfliteartifacts. - Level 5 β Agent Skills & Cloud Device Farm: Automate the entire lifecycle with AI coding agents and benchmark on real cloud phones.
Experience LiteRT running 100% client-side in your browser via LiteRT.js (WebGPU + multi-threaded WASM) with weights streamed directly from litert-community:
- Interactive Samples Portal (
google-ai-edge.github.io/litert-samples): Unified showcase of web demos and interactive playgrounds. - Client-Side Web Demos (
samples/web_demos/) (also available on HF Spaces Demos):- π±οΈ SAM 2.1 Click-to-Segment (
~60 msencoder /~4 msper click on WebGPU) β Source - π― CLIPSeg Open-Vocabulary Segmentation (Segment any photo by typing text prompts) β Source
- π§ MoGe-2 Photo-to-3D Point Cloud (Monocular geometry rendered in interactive Three.js) β Source
- π PP-OCRv5 Document & Screenshot OCR (Text detection + recognition in browser) β Source
- π£οΈ Matcha-TTS Neural Speech Synthesis (Flow-matching TTS + HiFi-GAN vocoder at 22 kHz) β Source
- π§© LiteRT Chrome Extension: Run MoGe-2 3D hover, PP-OCRv5, and Matcha-TTS on any webpage you browse.
- π±οΈ SAM 2.1 Click-to-Segment (
- C++ Tensor API Web Playground (
samples/tensor_api_playground/): Interactive browser sandbox demonstrating C++ LiteRT Tensor API programs compiled to WebAssembly (Gemma 3, Image Segmentation, Mandelbrot, Game of Life).
Use LiteRT-CLI (litert) or LiteRT-LM (litert-lm) to pull any model from litert-community and run or benchmark it immediately:
# 1. Install LiteRT-CLI and LiteRT-LM
pip install litert-cli-nightly
# 2. Run an LLM (.litertlm) from Hugging Face litert-community
litert download litert-community/Qwen3-0.6B
litert lm run Qwen3-0.6B.litertlm --prompt "Explain on-device AI in two sentences."
# 3. Benchmark any .tflite or .litertlm model locally or on real cloud phones (--ddp)
litert download litert-community/efficientnet_b1
litert benchmark efficientnet_b1.tflite --gpuβοΈ No phone attached? Run benchmarks on real physical Android & iOS devices in Google Cloud's Developer Device Platform (DDP) directly from Colab β see
benchmark/developer_device_platform/.
All runnable applications live under samples/. New applications use the LiteRT CompiledModel API (for .tflite models with automatic GPU/NPU acceleration and zero-copy buffers) and LiteRT-LM (for .litertlm generative models).
| Sample App | Highlights & Modality | Platforms & Accelerators | Models Used (litert-community) |
|---|---|---|---|
samples/litert_model_zoo/ |
34 Tasks in One Android App (21 Vision, 8 Audio, 5 Text Decision). On-demand SHA-256 verified downloads from HF, live latency/backend cards, 122 JVM tests. | Android (CompiledModel GPU / CPU) |
34 repos on litert-community (RF-DETR, PIDNet, MODNet, DINOv2, PP-OCRv5, Depth Anything 3, Zipformer, Matcha-TTS, Laya, etc.) |
samples/litert/flutter/ |
All-in-One Edge AI Assistant: Spoken voice chat, live camera object detection + visual memory, local RAG knowledge base, and function-calling agent skills. | Android, iOS, macOS, Linux, Windows, Raspberry Pi 5, Jetson Orin, Qualcomm VENTUNO Q, Intel Core Ultra PCs (CPU / GPU / NPU) | Gemma 4 E2B, EmbeddingGemma 2, Whisper Base, Moonshine Tiny, Inflect-Nano-v2, YOLO26n |
samples/litert/flutter_intel_npu/ |
3-Act Hardware Showcase: Compare CPU vs. GPU vs. Intel Core Ultra NPU in a live speed race, 45-min transcript Q&A, and live 3D scene narration. | Windows 11 (Intel Core Ultra CPU / GPU / NPU), macOS (CPU / Metal GPU) | Gemma 4 E2B & Gemma 4 12B |
samples/litert_lm/voice_assistant/ |
100% Offline Voice Agent: Listens to speech, executes device tool calls (alarm, timer, calendar), and speaks back offline. | Android (Kotlin) | Gemma 4 E2B + Zipformer CR-CTC + KittenTTS Nano |
samples/litert_lm/reachy-voice-robot/ |
Embodied Voice Robot: Sees via camera, hears questions, reasons with Gemma, and speaks aloud on Raspberry Pi. | Raspberry Pi (Python) | Gemma 4 E2B + Moonshine Tiny + Inflect-Nano-v2 + YOLO26 |
samples/litert/phototalk_sample_app/ |
Vision + LLM Pipeline: Combines CompiledModel image classification with LiteRT-LM multimodal conversation. |
Android (Kotlin) | EfficientNet-Lite0 + Gemma 4 E2B / Gemma 3 1B / FastVLM-0.5B |
| Sample Directory | Target Silicon | What It Demonstrates |
|---|---|---|
samples/litert/google/sample_app_tpu/ |
Google Tensor TPU (Pixel) | Multimodal chat with Gemma 4 E2B (gemma-4-E2B-it_Google_Tensor_G5.litertlm) on Pixel Tensor TPU. |
samples/litert/qualcomm/llm_chatbot_npu/ |
Qualcomm Snapdragon NPU | Multimodal chat (text, image, audio) with Gemma 4 E2B and FastVLM-0.5B on Snapdragon 8 Elite NPU. |
samples/litert/qualcomm/gemma3/ & gemma4/ & fast_vlm/ |
Qualcomm NPU / GPU / CPU | Dedicated Gemma 3 1B, Gemma 4 E2B, and FastVLM 0.5B Android apps with NPU compilation guides. |
samples/litert/qualcomm/mobilenet_v2/ & object_detection/ |
Qualcomm NPU (JIT & AOT) | Zero-config on-device JIT NPU compilation (MobileNet-v2) and live camera NPU object detection (EfficientDet-Lite0). |
samples/litert/colab/ |
Multi-Vendor NPU AOT | Interactive Colab tutorial for Ahead-of-Time (AOT) NPU compilation with LiteRT. |
| Sample | Task | Platforms | litert-community Model(s) |
|---|---|---|---|
speech_recognition/ |
Multi-model Automatic Speech Recognition (ASR) | Android, Python | Parakeet TDT/CTC 0.6B, Whisper Tiny, Moonshine Tiny, Qwen3-ASR-0.6B |
text_to_speech_lm/ |
LLM-based TTS with zero-shot voice cloning | Android, Python | Qwen3-TTS-12Hz-0.6B-Base |
text_to_speech_streaming/ |
Ultra-light (15M, 32 MB) sentence-streaming TTS with live TTFA/RTF metrics | Android, Python | KittenTTS Nano + Matcha-TTS G2P |
text_to_speech/ |
Fast neural Text-to-Speech | Android, iOS | Matcha-TTS |
image_generation/ |
On-device Text-to-Image diffusion | iOS, macOS | Bonsai-Image-ternary-4B |
image_segmentation/ |
Real-time camera segmentation (CPU, GPU, NPU JIT/AOT) | Android (Kotlin & C++), iOS (Swift) | MediaPipe-Selfie-Segmentation |
zero_shot_classification/ |
Runtime-defined zero-shot text decisions (choice, score, yes/no) | Android (CPU / GPU / NPU JIT) | Laya-Multilingual-LiteRT |
semantic_similarity/ |
C++ sentence embedding & similarity | Linux, Android (C++) | embeddinggemma-300m |
image_classification/, text_classification/, digit_classifier/ |
Starter CompiledModel API templates for Vision & Text |
Android | EfficientNet-Lite, BERT Classifier, MNIST |
samples/end_to_end/imagenet/ |
End-to-end PyTorch conversion β preprocessing β evaluation pipeline | Python / Android | ImageNet classifiers |
Step-by-step instructions to build, deploy, and run LiteRT & LiteRT-LM demos on specific hardware targets:
- π€ Android Phones (
samples/platforms/android/) β GPU, CPU, and Snapdragon NPU setup. - π iPhone / iOS (
samples/platforms/ios/) β Xcode signing and Metal GPU acceleration. - π’ NVIDIA Jetson Orin (
samples/platforms/nvidia/) β Edge Linux GPU deployment. - π Qualcomm / Arduino VENTUNO Q (
samples/platforms/qualcomm/ventuno/) β Development board NPU/CPU guide. - π Raspberry Pi 5 (
samples/platforms/raspberry/) β Embedded Linux setup for voice & vision agents. - π» Intel Core Ultra PCs, Windows (
samples/platforms/intel/) β Windows build with the Intel NPU, GPU and CPU.
Want to bring a new Hugging Face checkpoint to LiteRT and publish it to litert-community? Start with the Model Conversion Cookbook (models/conversion.md).
| Model Type | Output Artifact | Target Runtime | Guide & Tooling |
|---|---|---|---|
| Text LLMs & Multimodal VLMs | .litertlm bundle |
LiteRT-LM | Cookbook Β§1β11 + litert-conversion-workflow |
| Vision, Audio, Diffusion & Encoders | .tflite graph(s) |
LiteRT CompiledModel API |
Cookbook Β§12 + utilities/litert_gpu_toolkit/ |
| Zero-Converter C++ Graphs | Native C++ binary / WASM | LiteRT Tensor API | models/*/tensor_api/ & samples/tensor_api_playground/ |
Each directory under models/ is a complete, reproducible recipe containing export scripts, numerical parity checks against the source checkpoint, and published weights on Hugging Face:
Point your AI coding agent (Claude Code, Gemini CLI, Cursor, etc.) at skills/ to automate model conversion, GPU surgical patching, quantization, verification, benchmarking, and Android app generation.
- Model Lifecycle Skills (in execution order):
skills/litert-conversion-workflow/β Convert HF LLM/VLM checkpoints into verified.litertlmbundles (architecture classification, export, chat templates, quality gates).skills/gpu-clean-conversion/β Convert PyTorch/HF models into 100% GPU-resident.tflitegraphs usingutilities/litert_gpu_toolkit/.skills/accuracy-safe-quantization/β Quantize (fp16/int8/int4) withai-edge-quantizerwhile enforcing numerical parity against float reference.skills/on-device-verification/β Verify GPU residency, numerical accuracy, and multi-turn stability on physical devices.skills/benchmark-on-ddp/β Benchmark models on Google Cloud Developer Device Platform (DDP) phones or macOS and update the leaderboard.skills/compiled-model-app-scaffolding/β Scaffold a production Android app (Kotlin, Jetpack Compose,CompiledModelRunner) around a verified model.skills/litert-compiled-model-migration/β Migrate legacy TensorFlow Lite (Interpreter) Android apps to LiteRTCompiledModelV2 with zero-copy buffers and NPU JIT.
- Android App Developer Skills (a mirror of
android/skillsdevice-ai/litert, device-tested viaskills/android/tests/):skills/android/litert-runtime/β Build an Android app running a.tflitemodel on CPU/GPU viaCompiledModel.skills/android/litert-lm/β Build an Android app running a.litertlmmodel fromlitert-communitywith streaming multi-turn chat.
Don't have a fleet of test phones? Run reproducible benchmarks on real phones in Google Cloud's Developer Device Platform (DDP) straight from your browser:
| Resource | Description | Launch |
|---|---|---|
litert_cli_benchmark.ipynb |
Benchmark any litert-community .tflite or .litertlm model on cloud phones with litert benchmark --ddp. |
|
ddp_cli_benchmark.ipynb |
Multi-device fleet benchmarking for Gemma 4 E2B using gcloud beta device-run with warmup & cooldown control. |
|
embedding_gemma_ddp_benchmark.ipynb |
Benchmark tri-modal (text + image + audio) EmbeddingGemma on DDP devices. | |
benchmark/leaderboard/ & benchmark/ios/ |
Data-driven Performance Leaderboard and iOS XCTest / Metal benchmark harness. | View Leaderboard |
litert-samples/
βββ samples/ # π± Runnable sample applications across platforms
β βββ litert/ # Core LiteRT CompiledModel API & NPU/GPU samples (Android, iOS, Flutter, C++, Python)
β βββ litert_model_zoo/ # 34-task Android Model Zoo app streaming on-demand from HF litert-community
β βββ litert_lm/ # LiteRT-LM agentic showcases (Offline Android Voice Assistant, Raspberry Pi Reachy Robot)
β βββ web_demos/ # Client-side WebGPU/WASM demos (@litertjs/core) + Chrome Extension
β βββ tensor_api_playground/ # Interactive browser playground for the C++ LiteRT Tensor API
β βββ platforms/ # Hardware setup guides (Android, iOS, NVIDIA Jetson, Qualcomm VENTUNO Q, Raspberry Pi, Intel PCs)
β βββ end_to_end/ # Full conversion-to-deployment pipelines (ImageNet)
β βββ litert_interpreter/ # Legacy TensorFlow Lite Interpreter API reference samples (maintenance mode)
βββ models/ # π§ͺ End-to-end model conversion recipes & verification gates
β βββ conversion.md # Step-by-step Model Conversion Cookbook (.litertlm & .tflite)
β βββ <family>/<model>/ # Reproducible export, quantization & verification recipes linked to litert-community
βββ skills/ # π€ SKILL.md playbooks for AI coding agents (convert, quantize, verify, benchmark, scaffold)
βββ benchmark/ # π Real-device performance benchmarking suite
β βββ leaderboard/ # Live performance leaderboard UI & measurement datasets (Android, iOS, macOS)
β βββ developer_device_platform/ # Colab notebooks for benchmarking on Google Cloud DDP real phones
β βββ ios/ # Xcode / XCTest benchmark framework for local & DDP iPhones
β βββ driver/ # Matrix runners and result collectors for building leaderboard rows
βββ community/ # π€ Community showcases & Hugging Face litert-community Spaces
β βββ gemma-hardware-hackathon/ # Google Gemma Hardware Hackathon (AGI House) LiteRT & LiteRT-LM showcase
β βββ models_page/ # Powers huggingface.co/spaces/litert-community/find-your-models
β βββ trending_page/ # Powers huggingface.co/spaces/litert-community/trending-models
βββ utilities/ # π οΈ Shared libraries & conversion toolkits
βββ common/ # Shared Kotlin helpers for Android (CompiledModelRunner, camera, audio, tensor math)
βββ litert_gpu_toolkit/ # PyTorch pre-conversion surgical patches & post-conversion GPU residency checker
When authoring new application or inference code with LiteRT:
- β
MUST USE: The LiteRT
CompiledModelAPI for.tflitemodels (Kotlin, C++, Swift, Python, JS) and LiteRT-LM for.litertlmLLM/VLM bundles. - β DO NOT USE: The legacy TensorFlow Lite
InterpreterAPI (tflite::Interpreter,org.tensorflow.lite.Interpreter,tf.lite.Interpreter) or manual delegate wiring. Samples undersamples/litert_interpreter/are preserved only for legacy migration reference. - π MIGRATING: Follow the LiteRT Migration Guide or run the
litert-compiled-model-migrationagent skill.
- LiteRT Developer Docs: ai.google.dev/edge/litert
- LiteRT-LM Developer Docs: ai.google.dev/edge/litert-lm
- Unified NPU Acceleration: ai.google.dev/edge/litert/next/npu
- LiteRT for Web (
LiteRT.js): ai.google.dev/edge/litert/web - Hugging Face Community Hub: huggingface.co/litert-community
Contributions of new sample apps, model conversion recipes, and community models are welcome!
- Read CONTRIBUTING.md and GOVERNANCE.md.
- To contribute a converted
.tfliteor.litertlmmodel, follow the Model Conversion Cookbook and publish to Hugging Facelitert-community. - Licensed under the Apache License 2.0 β see LICENSE for details.
Disclaimer: This is a sample repository maintained by Google. It is provided "as is" without warranty of any kind.