OCT. 28, 2026 (英语).
Google Play服务中的LiteRT是Android的端侧推断运行时间,用于定制模型,每天处理超过一万亿的推断,跨越数十亿个设备。 如今,它获得了最大的升级:GPU推论运行速度比遗留下来的GPU代表快约1.4x,由ML Drift提供动力,并通过新的编译Model API提供,LiteRT的现代继任者是遗留下来的口译员API.
直到现在,利用这个更快的GPU堆积需要捆绑LiteRT 在你的应用。 在我们的测试中,在Google Play服务中切换到LiteRT的应用大约更小8MB,使其在用户设备上下载的速度更快,更轻一些,因为运行时间,包括GPU加速器,曾经有Play服务的飞船,而不是每个应用内部。 超过100K Android的应用程序今天将自己的LiteRT或TensorFlow Lite拷贝捆绑起来,因此储蓄迅速增加为应用程序切换。
如果您的Android应用在CPU或GPU上运行自定义的ML模型,我们鼓励您在Google Play服务中切换到LiteRT. 您可以在Google AI Edge Gallery app中看到它在动作中,Scrapbook功能的图像分割在Google Play服务的LiteRT上运行。
Google Play Services中采用 LiteRT 的开发者享有直接的好处:
- 更小的应用程序,更免费的存储:由于没有 ML 运行时间被捆绑到您的 APK,您的应用更小更快的下载。 此外,由于应用程序共享一次运行,存储和内存节省随着每个开关的应用程序的增长。
- 自动更新:性能改进、 错误修正和安全补丁通过Play服务提前推出,以获取设备特定问题,而无需传送应用程序更新。
- 更多运行地点:Play服务中的LitERT运行于手机上可返回Android 7(API级别24),现在也运行于Wear OS 4+和Android汽车OS(Android 11+)上。
- 规模测试:ML Kit的Vision和Text API,如主题分割和文档扫描器,已经在Google Play服务中由LiteRT提供电力,规模为数十亿Android设备。 Google Play Services中的LiteRT,您正在自己的应用中使用同样的,战斗测试的基础设施。
LiteRT是TensorFlow Lite的进化。 它保持了您所依赖的.tflite模型格式和新增的编译模型API,这使得跨越分散硬件的加速是可靠的:
- 更简单:一个工作流程用于CPU和GPU加速,而不是另一个代表,并为每个加速器设置路径。 LiteRT在可用的情况下使用OpenCL,否则使用OpenGL. 如果您同时请求GPU和CPU,则在没有可用GPU的设备上会回归CPU.
- 更快:由ML Drift提供动力,LiteRT最新,开源 GPU引擎已经由Google应用在每日数百万设备上使用。 GPU推论运行速度比遗留的TensorFlow Lite GPU代表快约1.4x.
- 便携式:跨平台支持,因此同一.tflite模型运行在Android,iOS,桌面,和网络上。
- 灵活:CPU上仍然支持遗留下来的口译员API,因此您可以分阶段迁移。
无论是开始新鲜还是从捆绑的LiteRT切换,使用Google Play服务中的LiteRT需要几行代码:
- 添加com.google.android.gms: play-services-liter:17.0.0(或后版). 如果您今天将 LitERT 捆绑起来,请删除 liter 依赖。
- 从Play服务获得LitERT环境:
val lite 环境=
LiteRt. 初始化( R)
上下文
LiteRtDsl. 初始化选项 { setableGpu( true)}
)await () (中文(简体) ).
兹Kotlin
复制
- 创建您的编译模型时将 LitERT 环境传入。 其余的代码不变
如果您已经在Google Play服务中使用了遗留的口译员API,您的口译员代码在切换到播放服务读写器时会继续使用CPU. 要运行GPU,请移动到编译模型 API.
让你的编码agent来完成这项工作。 在Agent Mode中,Android Studio的新LiteRT技能将移动到Google Play服务的LiteRT和编译Model API自动化。 要求它“将我的TFLite代码复制到编译模型”或输入@litert-runtime,它将您的应用程序切换为播放服务-litert,改写您的口译电话,用CPU倒置设置 GPU 加速。 它也可以脚手架安装一个新的LiteRT应用程序。 把它当作一个强烈的首传:审查diff,构建,并比较一个真实设备上的输出。 获得GitHub技术。
从遗留的 API 升级吗?遗留下来的GPU代表和自定义代表API被贬值,有利于编译Model GPU加速和编译插件和调度API,NNAPI将从2027年开始被移除。 年长的SDK现在只获得关键的安全修复。 已经运出过的应用程序继续工作,但计划现在向编译模型 API 移动:使用已贬值的 API 的代码不会对最近的 SDK 进行编译,留在一个较老的 SDK 上会随着你的其他依赖性前进而引起冲突。 详情请参见发布指出。
展望未来,Google Play服务中的LiteRT是我们在Android上运行自己特定任务模型的基础,其中CPU和GPU加速。
- LitERT将继续获得定期更新,包括更好的GPU加速和更广泛的模型覆盖。
- Play服务中的NPU支助正在积极开展工作。
- 在 Google Play 服务中读取 LiteRT
- 试试Android工作室的LitERT技巧
- 在 Google AI Edge Gallery 应用中尝试Scrapbook
- 有东西阻止你切换还是需要帮助?联系GitHub讨论或提出问题。
我们等不及要看你造什么了
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
OCT. 28, 2026
LiteRT in Google Play services is Android's on-device inference runtime for custom models, handling more than a trillion inferences a day across billions of devices. Today, it gets its biggest upgrade yet: GPU inference that runs about 1.4x faster than the legacy GPU delegate, powered by ML Drift and available through the new CompiledModel API, LiteRT’s modern successor to the legacy Interpreter API.
Until now, taking advantage of this faster GPU stack required bundling LiteRT in your app. In our testing, apps that switched to LiteRT in Google Play services are about 8 MB smaller, making them faster to download and lighter on users' devices, because the runtime, including the GPU accelerator, ships once with Play services rather than inside every app. More than 100K Android apps bundle their own copy of LiteRT or TensorFlow Lite today, so the savings add up quickly as apps switch.
If your Android app runs custom ML models on CPU or GPU, we encourage you to switch to LiteRT in Google Play services. You can see it in action in the Google AI Edge Gallery app, where the Scrapbook feature's image segmentation runs on LiteRT in Google Play services.
Developers that adopt LiteRT in Google Play Services enjoy immediate benefits:
- Smaller apps, more free storage: As no ML runtime is bundled into your APK, your app is smaller and faster to download. In addition, as apps share one runtime, the storage and memory savings grow with each app that switches.
- Automatic updates: performance improvements, bug fixes, and security patches arrive through Play services in staged rollouts that catch device-specific issues early, without you having to ship an app update.
- More places to run: LiteRT in Play services runs on phones back to Android 7 (API level 24), and now also on Wear OS 4+ and Android Automotive OS (Android 11+).
- Tested at scale: ML Kit's Vision and Text APIs, like Subject Segmentation and Document Scanner, are already powered by LiteRT in Google Play services at scale across billions of Android devices. By adopting LiteRT in Google Play Services you are using the same, battle-tested infrastructure in your own app.
LiteRT is the evolution of TensorFlow Lite. It keeps the same .tflite model format you rely on and adds the CompiledModel API, which makes acceleration across fragmented hardware reliable:
- Simpler: one workflow for CPU and GPU acceleration instead of a different delegate and setup path for each accelerator. LiteRT uses OpenCL where available and OpenGL otherwise. If you request both GPU and CPU, it falls back to CPU on devices without a usable GPU.
- Faster: powered by ML Drift, LiteRT's latest, open-source GPU engine already used by Google apps on millions of devices daily. GPU inference runs about 1.4x faster than the legacy TensorFlow Lite GPU delegate.
- Portable: cross-platform support, so the same .tflite model runs on Android, iOS, desktop, and web.
- Flexible: the legacy Interpreter API is still supported on CPU, so you can migrate in phases.
Whether you're starting fresh or switching from bundled LiteRT, using LiteRT in Google Play services takes a few lines of code:
- Add com.google.android.gms:play-services-litert:17.0.0 (or a later version). If you bundle LiteRT today, remove the litert dependency.
- Get the LiteRT environment from Play services:
val liteRtEnvironment =
LiteRt.initialize(
context,
LiteRtDsl.initializationOptions { setEnableGpu(true) }
).await()
Kotlin
Copied
- Pass the LiteRT environment in when you create your CompiledModel. The rest of your code stays the same.
If you're already using the legacy Interpreter API in Google Play services, your Interpreter code keeps working on CPU when you switch to play-services-litert. To run on the GPU, move to the CompiledModel API.
Let your coding agent do the work. In Agent Mode, the new LiteRT skill for Android Studio automates the move to LiteRT in Google Play services and the CompiledModel API. Ask it to “migrate my TFLite code to CompiledModel,” or type @litert-runtime, and it switches your app to play-services-litert, rewrites your Interpreter calls, and sets up GPU acceleration with CPU fallback. It can also scaffold a new LiteRT app. Treat it as a strong first pass: review the diff, build, and compare outputs on a real device. Get the skill on GitHub.
Upgrading from legacy APIs? The legacy GPU delegate and custom delegate APIs are deprecated in favor of CompiledModel GPU acceleration and the Compiler Plugin and Dispatch APIs, and NNAPI will be removed starting in 2027. Older SDKs now receive critical security fixes only. Apps you've already shipped keep working, but plan your move to the CompiledModel API now: code that uses deprecated APIs won't compile against the latest SDK, and staying on an older SDK can cause conflicts as your other dependencies move forward. See the release notes for details.
Looking ahead, LiteRT in Google Play services is our foundation for running your own task-specific models on Android, with CPU and GPU acceleration.
- LiteRT will keep getting regular updates, including better GPU acceleration and wider model coverage.
- NPU support in Play services is actively being worked on.
- Read the LiteRT in Google Play services docs
- Try the LiteRT skill for Android Studio
- Try Scrapbook in the Google AI Edge Gallery app
- Something stopping you from switching, or need help? Reach out on GitHub Discussions or file an issue.
We can't wait to see what you build.
Auto-fetched and translated by AI Atlas. All rights belong to the original author.