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 app 在 CPU 或 GPU 上运行自定义的 ML 模型,我们鼓励您在 Google Play 服务中切换到 LiteRT。 您可以在 Google AI Edge Gallery app中看到它在动作中,Scrapbook 特性的图像分解在 Google Play 服务的LiteRT上运行。
Google Play 服务中采用 LiteRT 的开发者享有直接的好处:
- 更小的应用程序,更免费的存储:由于没有 ML 运行时间被捆绑到您的 APK,您的应用程序更小,更快的下载。 此外,由于应用程序共享一次运行,存储和内存节省随着每个开关的应用程序的增长。
——自动更新:性能改进,bug修正,以及安全补丁通过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 Gem Box. All rights belong to the original author.