LiteRT in Google Play services

Run your ML models on Android with hardware acceleration, without shipping the LiteRT runtime in your APK. LiteRT in Google Play services gives you:

  • Smaller apps (up to ~8 MB): Remove bundled runtime and GPU binaries from your APK by sharing a single runtime across apps through Google Play services.
  • Faster GPU inference: Run models up to 1.4x faster on GPU than with the previous TensorFlow Lite GPU delegate, powered by LiteRT's ML Drift GPU accelerator.
  • Production-ready and auto-updated: Hardened releases, performance improvements, and fixes arrive in phases through Google Play services updates across billions of Android devices, without an app release.
  • Frictionless migration, same API: Run models on CPU or GPU with the same CompiledModel API as standalone LiteRT. Only your dependency and how you create the Environment change. Continued Interpreter API support on CPU lets you switch your dependency first and migrate at your own pace. NPU acceleration is coming soon.
If your app… Then
Uses the Interpreter API in Google Play services (play-services-tflite-java) Switch your dependency to play-services-litert. Your Interpreter code keeps running on CPU. Then move to the CompiledModel API to add GPU acceleration. See Upgrade to the LiteRT v2 API.
Bundles standalone LiteRT 2.x or TensorFlow Lite (com.google.ai.edge.litert:litert, org.tensorflow:tensorflow-lite) Switch to Google Play services to remove the runtime from your APK. See Migrating from standalone LiteRT.
Needs NPU acceleration or custom ops today, or must run on devices without Google Play services Use standalone LiteRT.

Choose an API

play-services-litert includes both APIs, so you can update your dependency first and move to the CompiledModel API at your own pace.

API Kotlin and Java C++ Maven package
CompiledModel (recommended) Guide Guide com.google.android.gms:play-services-litert
Interpreter (older API) Guide Guide com.google.android.gms:play-services-litert (CPU only), or com.google.android.gms:play-services-tflite-java (16.x)
  • New features are added to the CompiledModel API.
  • LiteRT 1.x SDKs (Google Play services 16.x, play-services-tflite-*) receive only critical security fixes. Apps built with them keep working on the Google Play services runtime.
  • Use either play-services-litert or play-services-tflite-java, not both.

Get started

Step Kotlin and Java C++
1. Add the dependency Add dependencies Build configuration
2. Initialize Initialize Native handle
3. Run on CPU Run inference Run inference
4. Turn on GPU GPU acceleration GPU acceleration

Coming soon

  • NPU acceleration in Google Play services: NPU acceleration is available today in standalone LiteRT.

Support and feedback

Report issues and feature requests on the LiteRT GitHub issue tracker. Include "Google Play services" in the issue title so it reaches the right team. For more about Google Play services, see the Google Play services website.

Terms of service

Use of LiteRT in Google Play services APIs is subject to the Google APIs Terms of Service.

Privacy and data collection

When you use LiteRT in Google Play services APIs, processing of the input data, such as images, video, text, fully happens on-device, and LiteRT in Google Play services APIs do not send that data to Google servers. As a result, you can use our APIs for processing data that should not leave the device.

The LiteRT in Google Play services APIs may contact Google servers from time to time in order to receive things like bug fixes, updated models and hardware accelerator compatibility information. The LiteRT in Google Play services APIs also sends metrics about the performance and utilization of the APIs in your app to Google. Google uses this metrics data to measure performance, debug, maintain and improve the APIs, and detect misuse or abuse, as further described in our Privacy Policy.

You are responsible for informing users of your app about Google's processing of LiteRT in Google Play services APIs metrics data as required by applicable law.

Data we collect includes the following:

  • Device information (such as manufacturer, model, OS version and build) and available ML hardware accelerators (GPU and NPU). Used for diagnostics and usage analytics.
  • Device identifier used for diagnostics and usage analytics.
  • App information (package name, app version). Used for diagnostics and usage analytics.
  • API configuration (such as which accelerators or delegates are used). Used for diagnostics and usage analytics.
  • Event type (such as model compilation, interpreter creation, and inference). Used for diagnostics and usage analytics.
  • Error codes. Used for diagnostics.
  • Performance metrics. Used for diagnostics.