# LiteRT

**LiteRT**（Lite Runtime 的缩写）是谷歌开源、跨平台的端侧机器学习推理运行时，也是2024年采用的新名称，取代了此前的 [TensorFlow](https://www.edgepedia.org/zh/tensorflow) Lite。运行时本身并未随更名而改变；谷歌将其描述为同一个高性能端侧 AI 运行时，但愿景有所扩展，涵盖经典机器学习模型、大语言模型和扩散模型，并支持 GPU 和 NPU 加速。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup> LiteRT 在 google-ai-edge/LiteRT GitHub 仓库中公开开发，是谷歌通过转换、运行时和优化，在边缘平台上部署高性能机器学习和生成式 AI 的框架。<sup>[2](https://github.com/google-ai-edge/LiteRT/)</sup>

| 关键事实 | 详情 |
|---|---|
| 是什么 | 谷歌的端侧推理运行时，2024年由 TensorFlow Lite 更名而来；运行时未变。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup> |
| 采用情况 | 自2017年首次亮相以来，TensorFlow Lite 已在27亿台设备上的超过10万个应用中驱动机器学习功能。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup> |
| 模型格式 | 基于 FlatBuffers 构建的 .tflite 文件；更名未改变扩展名或格式。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup> |
| 执行方式 | 解释器解析模型的算子并运行内核；默认使用针对 ARM Neon 指令集优化的 CPU 内核。<sup>[3](https://docs.qualcomm.com/doc/80-70020-54/topic/arch.html)</sup><sup> • </sup><sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup> |
| 加速 | 支持 GPU（Android 和 iOS）、Apple Neural Engine（A12 SoC 及以上）和高通 QNN 的委托，后者覆盖 CPU、GPU 和 Hexagon Tensor Processor。<sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup><sup> • </sup><sup>[3](https://docs.qualcomm.com/doc/80-70020-54/topic/arch.html)</sup> |
| 量化收益 | Pixel 2 上的 MobileNet v1 224：经量化感知训练后，从124毫秒、16.9 MB 降至64毫秒、4.3 MB。<sup>[5](https://developers.google.com/edge/litert/conversion/tensorflow/quantization/model_optimization)</sup> |
| 厂商性能声明 | 谷歌内部测试（2025年5月）发现 NPU 加速的速度最高可达 CPU 的25倍、能效最高可达 CPU 的5倍；此为厂商自测基准。<sup>[6](https://developers.googleblog.com/litert-maximum-performance-simplified/)</sup> |

## 历史与更名

TensorFlow Lite 于2017年首次亮相，是谷歌用于在手机和嵌入式设备上运行 TensorFlow 模型的运行时；到更名时，它已在27亿台设备上的超过10万个应用中支持机器学习体验。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup> 2024年，谷歌宣布了 LiteRT 这一名称。此次更名在文件层面刻意保持表面化：.tflite 文件扩展名和格式均未改变，转换工具继续输出 LiteRT 可读取的 .tflite flatbuffer 文件，现有生产应用不受影响。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup> [文档](https://www.edgepedia.org/zh/documentation)逐步迁移，tensorflow.org/lite 页面重定向至 ai.google.dev/edge/litert 的对应页面。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup> TensorFlow Lite 仍在积极开发，但以 LiteRT 之名进行。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup>

谷歌给出的动机是范围而非技术：更名之前，该运行时已扩展至 TensorFlow 之外，可接受 PyTorch、JAX 和 Keras 编写的模型，谷歌将 LiteRT 的愿景定位为跨平台部署经典机器学习模型、大语言模型和扩散模型，并支持 GPU 和 NPU 加速。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup>

## 架构与工作原理

LiteRT 模型是一个 .tflite [FlatBuffers](https://www.edgepedia.org/zh/flatbuffers) 文件。推理时，模型被加载到 LiteRT 解释器接口中，该接口解析模型以识别其中存在的神经网络算子，并可配置为使用委托运行模型。<sup>[3](https://docs.qualcomm.com/doc/80-70020-54/topic/arch.html)</sup> 默认情况下，LiteRT 使用针对 ARM Neon 指令集优化的 CPU 内核。<sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup>

**委托。** 委托通过利用 GPU 和数字信号处理器（DSP）等端侧加速器来实现硬件加速，充当运行时与 OpenCL 或 [OpenGL ES](https://www.edgepedia.org/zh/opengl-es) 等底层 API 之间的桥梁。<sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup> 例如，若将一个浮点模型提供给仅支持8位量化操作的委托，该委托会拒绝其所有操作，模型将完全在 CPU 上运行。<sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup>

**CompiledModel。** 谷歌文档将 CompiledModel API 呈现为端侧机器学习推理的现代标准，提供简化的硬件加速，并称其显著优于旧的 Interpreter API；此为厂商声明。CompiledModel 利用 ML Drift（谷歌描述为最先进的 GPU 加速库）在移动平台上实现 GPU 推理。<sup>[7](https://developers.google.cn/edge/litert/inference)</sup>

## 通过委托实现硬件加速

委托目录覆盖主要移动加速器系列：

- **GPU 委托。** 在 Android 和 iOS 上均可使用，针对32位和16位浮点模型优化，也支持8位量化模型，GPU 性能与浮点版本相当。<sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup>
- **Core ML 委托。** 在配备 Apple Neural Engine 的 iPhone 和 iPad 上加速推理，适用于搭载 A12 SoC 及以上的 Apple 移动设备，支持32位或16位浮点模型。[Core ML](https://www.edgepedia.org/zh/core-ml) 不支持动态范围、整数或[量化感知训练](https://www.edgepedia.org/zh/quantization-aware-training)的模型，而 GPU 委托支持所有这些类型。<sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup>
- **高通 QNN 委托。** 高通 AI Engine direct（QNN）委托覆盖 CPU、GPU 和 Hexagon Tensor Processor；高通的 Linux 部署文档还在 GPU 委托之外列出了用于 CPU 的 XNNPACK。<sup>[3](https://docs.qualcomm.com/doc/80-70020-54/topic/arch.html)</sup>
- **NPU 支持。** 2025年5月的版本新增了与联发科和高通联合开发的 NPU 支持（早期访问）。谷歌将 LiteRT 定位为在 NPU 上部署模型的统一方式，抽象掉否则必须匹配特定 SoC 版本的厂商专属 SDK。<sup>[6](https://developers.googleblog.com/litert-maximum-performance-simplified/)</sup>

委托的计算精度可能与 CPU 对应物不同，通常带来轻微的精度权衡；在 GPU 的浮点精度上运行量化模型甚至可能带来轻微的精度提升，例如在 ILSVRC 图像分类中 Top-5 提升不到1%。<sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup>

## 模型优化与量化

LiteRT 支持通过量化、剪枝和聚类进行优化，为资源受限的边缘设备在模型大小和推理速度与精度之间进行权衡。<sup>[5](https://developers.google.com/edge/litert/conversion/tensorflow/quantization/model_optimization)</sup> 在量化中，模型参数的数值精度——默认存储为32位浮点值——被降低。<sup>[5](https://developers.google.com/edge/litert/conversion/tensorflow/quantization/model_optimization)</sup>

各优化选项在数据需求和效果上有所不同：<sup>[5](https://developers.google.com/edge/litert/conversion/tensorflow/quantization/model_optimization)</sup>

- 训练后 float16 量化无需数据，可将模型大小减少至多50%，精度损失不显著。
- 训练后动态范围量化和整数量化可将大小减少至多75%；整数量化需要无标签的代表性数据样本，并带来小幅精度损失。
- 量化感知训练可实现至多75%的缩减，精度损失最小。

**剪枝**移除模型中对预测影响较小的参数。剪枝不改变模型的磁盘占用和推理速度，但结果更易于压缩。<sup>[5](https://developers.google.com/edge/litert/conversion/tensorflow/quantization/model_optimization)</sup>

## 数据一览

谷歌公布的优化基准测试在 [Pixel 2](https://www.edgepedia.org/zh/pixel-2) 上使用单个大核测量，展示了量化感知训练对两个标准图像模型的效果：<sup>[5](https://developers.google.com/edge/litert/conversion/tensorflow/quantization/model_optimization)</sup>

| 模型 | 延迟（原始 → 优化后） | 大小（原始 → 优化后） | Top-1 精度（原始 → 优化后） |
|---|---|---|---|
| MobileNet v1 224 | 124毫秒 → 64毫秒 | 16.9 MB → 4.3 MB | 0.70 → 0.709 |
| Inception v3 | 1130毫秒 → 543毫秒 | 95.7 MB → 23.9 MB | 0.780 → 0.775 |

对于 [MobileNet](https://www.edgepedia.org/zh/mobilenet) v1，优化后的模型既更快又略更准确；对于大得多的 [Inception](https://www.edgepedia.org/zh/inception-network) v3，延迟大约减半，模型缩小至四分之一大小，代价是 Top-1 精度下降0.005。<sup>[5](https://developers.google.com/edge/litert/conversion/tensorflow/quantization/model_optimization)</sup>

谷歌较新的加速声明为厂商自测。在与 CPU 比较的内部测试中，2025年5月的 NPU 加速被发现速度最高可达 CPU 的25倍、能效最高可达 CPU 的5倍。<sup>[6](https://developers.googleblog.com/litert-maximum-performance-simplified/)</sup> 异步执行使用操作系统级机制，如 Android 和 Linux 上的同步栅栏，允许一个硬件加速器在另一个完成时直接触发，无需 CPU 介入；在谷歌的 GPU 异步演示中，这最多将延迟缩短至原来的一半。<sup>[6](https://developers.googleblog.com/litert-maximum-performance-simplified/)</sup>

对于独立测量，LiteRT 附带一个基准测试工具，可估算模型性能，包括平均推理延迟、初始化开销和内存占用，使用如 --gpu_backend=gl 结合 --use_gpu 等标志。<sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup> OpenBenchmarking.org 维护一个独立测试配置（pts/litert，版本2024-10-15，模型 Inception ResNet V2，平均运行时间6分钟，至少运行三次），不过其当前 Linux 支持仅限于在 CPU 上运行。<sup>[8](https://openbenchmarking.org/test/pts/litert)</sup>

## 平台、工具链与版本

LiteRT 面向 Android 和 iOS，GPU 委托在两者上均可用，Core ML 委托覆盖 Apple Neural Engine 设备。<sup>[4](https://developers.google.com/edge/litert/performance/delegates)</sup> 高通文档记录了在高通 Linux 上的部署，其中解释器加载模型并通过 XNNPACK、GPU 委托或 QNN 委托进行分发。<sup>[3](https://docs.qualcomm.com/doc/80-70020-54/topic/arch.html)</sup> 在模型开发端，运行时接受来自 TensorFlow、PyTorch、JAX 和 Keras 的模型，通过转换为 .tflite 实现。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup>

开发在 GitHub 上的 google-ai-edge 下开源进行。<sup>[2](https://github.com/google-ai-edge/LiteRT/)</sup> 一个发布里程碑宣布了与 TensorFlow Lite 的完整功能对等、稳定的 LiteRT API，以及 GPU 和 NPU 加速的关键性能增强。<sup>[9](https://github.com/google-ai-edge/LiteRT/releases/)</sup> 10月发布的 LiteRT 2.3.0 旨在提升大语言模型的端侧 AI 效率和跨平台 GPU/NPU 利用率，新增融合的 QKV-RMSNorm-RoPE 和 [SwiGLU](https://www.edgepedia.org/zh/swiglu) GPU 内核，带来约12%的提升。<sup>[10](https://developers.google.cn/edge/litert/releases/litert_oct)</sup>

## 与其他运行时的比较

一份可获得的比较来自单一博客来源，按11项标准对三个开源机器学习推理运行时进行排名，[ONNX Runtime](https://www.edgepedia.org/zh/onnx-runtime) 以84/100居首，LiteRT 以77/100次之，[ExecuTorch](https://www.edgepedia.org/zh/executorch) 以75/100居第三。<sup>[11](https://faun.dev/toolbox/compare-open-source-ml-inference-runtimes/)</sup> 在该比较中，LiteRT 在模型格式与算子覆盖（64）和硬件后端（86）上得分最高，ONNX Runtime 在成熟度与稳定性（92）上领先，ExecuTorch 在可移植性（84）上领先；该来源自身的建议是，若模型格式与算子覆盖最重要，则选择 LiteRT。<sup>[11](https://faun.dev/toolbox/compare-open-source-ml-inference-runtimes/)</sup>

## 近期发展

2023年以来的时期重塑了项目的身份和 API 面貌。2024年，TensorFlow Lite 更名为 LiteRT，运行时未变，文档迁移至 ai.google.dev/edge/litert。<sup>[1](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)</sup> 随后一个发布里程碑宣布了与 TensorFlow Lite 的完整功能对等和稳定的 LiteRT API。<sup>[9](https://github.com/google-ai-edge/LiteRT/releases/)</sup> 2025年5月，一个版本引入了新的推理 API（基于 MLDrift GPU 后端的 CompiledModel API）、与联发科和高通联合开发的 NPU 支持（早期访问），以及异步加速器到加速器的执行。<sup>[6](https://developers.googleblog.com/litert-maximum-performance-simplified/)</sup> 10月发布的2.3.0版本继续聚焦大语言模型，为 QKV-RMSNorm-RoPE 和 SwiGLU 提供融合 GPU 内核。<sup>[10](https://developers.google.cn/edge/litert/releases/litert_oct)</sup>

## References

1. [TensorFlow Lite is now LiteRT, Google Developers Blog](https://developers.googleblog.com/tensorflow-lite-is-now-litert/)
2. [google-ai-edge/LiteRT, GitHub repository](https://github.com/google-ai-edge/LiteRT/)
3. [LiteRT architecture, Qualcomm Linux Lite Runtime Reference](https://docs.qualcomm.com/doc/80-70020-54/topic/arch.html)
4. [LiteRT Delegates, Google AI Edge](https://developers.google.com/edge/litert/performance/delegates)
5. [Model optimization, Google AI Edge](https://developers.google.com/edge/litert/conversion/tensorflow/quantization/model_optimization)
6. [LiteRT: Maximum performance, simplified, Google Developers Blog](https://developers.googleblog.com/litert-maximum-performance-simplified/)
7. [On-device Inference with LiteRT, Google AI Edge](https://developers.google.cn/edge/litert/inference)
8. [LiteRT Benchmark, OpenBenchmarking.org](https://openbenchmarking.org/test/pts/litert)
9. [Releases, google-ai-edge/LiteRT](https://github.com/google-ai-edge/LiteRT/releases/)
10. [LiteRT October Release, Google AI Edge documentation](https://developers.google.cn/edge/litert/releases/litert_oct)
11. [Best open source ML Inference Runtimes: ranked and compared, faun.dev](https://faun.dev/toolbox/compare-open-source-ml-inference-runtimes/)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Neural networks and deep learning › Deep learning software and hardware › Edge and mobile deep learning

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/litert

English original: https://www.edgepedia.org/litert
