AI
Google Releases LiteRT Tensor API for Custom On-Device AI Model Development
A new C++ authoring layer lets developers handcraft neural networks for mobile and edge devices with full control over inference while maintaining cross-platform compatibility.
Google Developers Blog (AI)
Google has announced the LiteRT Tensor API, a lightweight development framework that enables programmers to build and optimize machine learning models directly in C++ for edge devices. The tool addresses a longstanding tradeoff: while converting pre-trained models offers the easiest path to production, developers who need fine-grained control over model architecture and performance now have a structured alternative that doesn't require rewriting code for each hardware target.
The Challenge of Hand-Optimized ML#
Developing custom neural network implementations in C++ or shaders—as seen in projects like Apple's MLX and llama.cpp—gives researchers unprecedented control but comes with significant engineering overhead. Custom implementations typically become locked into specific hardware backends (Metal for Apple devices, OpenCL or Vulkan for others), forcing developers to maintain separate codebases for each platform. Managing zero-copy data buffers, synchronizing across CPU, GPU, and neural processing units, and orchestrating preprocessing, inference, and postprocessing also demands substantial manual work.
How the Tensor API Changes the Workflow#
The new Tensor API combines native-level control with portability across platforms. Developers construct computation graphs operation-by-operation in C++, explicitly choosing which ops execute and how they connect. The same codebase can run on CPU via XNNPACK, on GPUs powered by ML Drift, or on NPUs—without modification. Intermediate data can stay on accelerators throughout the inference pipeline, avoiding costly transfers between CPU and GPU memory.
The API also serves as a natural foundation for AI coding agents, which can programmatically generate, modify, and optimize model graphs. Google's own agent, Antigravity, used this capability to evolve SAM 2, pushing performance from under 10 to over 30 frames per second.
Key Capabilities#
The framework offers four main features:
- Complete graph control: developers specify every operation and tensor connection, from basic math to GPU-accelerated composite ops like scaled dot-product attention and RMSNorm

