Skip to content
Binary Byline BB markBBBinaryByline

Reporting from the two sides of the AI story.

Model releases

LiteRT Tensor API loads Hugging Face safetensors directly for zero-copy C++ edge inference

A new authoring layer in the LiteRT stack allows developers to build computation graphs in C++ for cross-platform deployment on CPU, GPU and NPU hardware.

Depth
1 outlet · newest source 211h ago
LiteRT Tensor API loads Hugging Face safetensors directly for zero-copy C++ edge inference

Key points

  • The LiteRT Tensor API provides a lightweight layer for native C++ model authoring within the LiteRT stack.
  • It supports direct weight ingestion from Hugging Face .safetensors files without intermediate conversion scripts.
  • The API enables zero-copy buffer interoperability between pre-processing, inference and post-processing stages.

Google announced the release of the LiteRT Tensor API in an official advisory published on its developers blog. This new lightweight authoring layer sits within the LiteRT stack and is designed to improve the handcrafting of on-device models. It combines the flexibility of native code authoring with cross-platform portability for heterogeneous edge hardware.

Evidence: confirmedNative Model Authoring for Edge with LiteRT Tensor API

aifleet-google-dev

The figures

According to the Google Developers blog post, a coding agent used the Tensor API to evolve an implementation of Meta's Segment Anything Model 2. The agent improved performance from under ten to over thirty frames per second at a resolution of 512 by 512 pixels. This benchmark ran on WebGPU in a browser environment.

Evidence: reportedNative Model Authoring for Edge with LiteRT Tensor API

aifleet-google-dev

Evidence: reportedNative Model Authoring for Edge with LiteRT Tensor API

aifleet-google-dev

Behind the figures

The Google Developers blog states that the LiteRT Tensor API serves as a programmatic foundation for AI coding agents. These agents can generate, rewire and tune model graphs automatically using structured primitives. The specific Segment Anything Model 2 implementation was fully authored in C++ via this API. The complete code for the web app and model implementation is open source in the LiteRT Samples GitHub repository.

Evidence: reportedNative Model Authoring for Edge with LiteRT Tensor API

aifleet-google-dev

What changes, what does not

The advisory notes that converting trained models, such as PyTorch models using LiteRT Torch, remains the recommended path for most production projects. This conversion route offers the quickest and most reliable deployment method. Developers should reach for the Tensor API only when they require low-level control over the graph structure or need the entire pipeline to run end-to-end on the accelerator without model file dependencies.

What builders can do with it

Developers can construct computation graphs operation by operation in C++ using the LiteRT Tensor API. They decide exactly which operations run and how they connect. The same graph executes on CPU, GPU via open-source ML Drift, or NPU. It can also run directly on CPU through XNNPACK without a runtime or model file. This eliminates the need to rewrite code for each new hardware target.

Builders can chain pre-processing, inference and post-processing through shared accelerator buffers. This tensor-centric buffer interoperability ensures intermediate data remains on the accelerator with zero copies. The API supports direct weight ingestion from Hugging Face .safetensors files, removing the need for conversion scripts. Developers retain full control over graph structure, including composite operations like scaled dot-product attention and KV-cache updates.

Why it matters

  • Developers can avoid rewriting implementations for specific backends like Metal or Vulkan by using a single C++ graph that runs across CPU, GPU and NPU targets.
  • The ability to ingest weights directly from .safetensors files simplifies the workflow by removing intermediate conversion steps required in traditional model deployment pipelines.
  • Zero-copy buffer interoperability reduces engineering effort by allowing pre-processing and post-processing to share accelerator buffers with the model partitions.
  • The API provides structured primitives that enable AI coding agents to automatically generate and tune model graphs, accelerating development for complex architectures.

Topics: LiteRT, edge AI, C++, Google, model authoring

Updated

Ask the article

Local keyword search of this article; no generated answers.

Which of these is confirmed?

Check the answer

Google announced the release of the LiteRT Tensor API in an official advisory published on its developers blog.

The matched primary source and announcement wording support the confirmed label.

Did this article give you the evidence you needed?

No vote saved on this device.
Your choice stays on this device. No public tally.

Questions readers ask

Does the LiteRT Tensor API replace the standard model conversion path?

No, the Google Developers blog recommends converting trained models as the default path for most projects, reserving the Tensor API for cases requiring low-level graph control.

Can the LiteRT Tensor API run without a runtime or model file?

Yes, the advisory states that graphs can run directly on CPU through XNNPACK without a model file or runtime.

Is the Segment Anything Model 2 implementation available for developers?

Yes, the Google Developers blog confirms the complete implementation and web app are open source in the LiteRT Samples GitHub repo.

Connected stories

This storyFirst Dog on the Moon queries if AI summaries harm Google profitsFirst Dog on the Moon queries ifGoogle Dreambeans expands to India with 13 languages and Veo video animationGoogle Dreambeans expands to Ind

Reading receipt

  • The LiteRT Tensor API provides a lightweight layer for native C++ model authoring within the LiteRT stack.
  • It supports direct weight ingestion from Hugging Face .safetensors files without intermediate conversion scripts.
  • The API enables zero-copy buffer interoperability between pre-processing, inference and post-processing stages.
Time spent: 0:00 · Depth: Full

Sources

  1. Google Developers blog

Related stories

Background reading