Logic Foundry

Build with understanding.

Google introduces LiteRT Tensor API for building on-device models in C++

Reported by InfoQ on November 13, 2026.

Google has introduced the LiteRT Tensor API, a C++ interface for building, customizing and optimizing on-device machine-learning models. Developers can define a computation graph operator by operator, then use LiteRT to run that graph across CPU, GPU and NPU hardware. Google says this approach offers more control over model architecture and accelerator execution without rewriting the graph for each hardware target.

The API also supports loading weights directly from checkpoints, including Hugging Face .safetensors files. Its zero-copy buffer interoperability is intended to reduce copying between preprocessing, inference and postprocessing. Google says coding agents can generate C++ to build, modify, validate and benchmark model graphs.

To demonstrate the API, Google used a coding agent to build a multi-object segmentation and tracking application. It said the same SAM 2 model code ran on a macOS laptop and an iOS phone using Metal, and an Android phone using OpenCL. In Google’s tests, the image encoder and mask decoder ran about 1.5 times faster on a MacBook Pro than Apple MLX at fp16. That is a reported result for this test, not a general performance guarantee.

Google said the agent also moved SAM 2’s per-frame decisions, such as whether an object remained visible, from CPU code into the computation graph. It rewrote operations that triggered CPU fallback on WebGPU using GPU-compatible arithmetic. Commenting on the announcement, Arm AI director Laurence Moroney said WebGPU performance at 512 × 512 resolution rose from under 10 fps to over 30 fps through the agent-led optimization.

Moroney advised developers to start with model conversion and consider the C++ API when they need graph-level control or want preprocessing and postprocessing to remain on an accelerator. Google listed native support for the ML Drift backend, more NPU-friendly operations, automatic whole-graph quantization and broader dynamic-shape support as planned improvements—not features it said were already available.

Source: infoq.cn (originally published 2026-11-13 09:17 UTC+8)