Where to Find the LiteRT Repository: Official GitHub Location and Source Structure

The LiteRT repository is publicly hosted on GitHub at https://github.com/google-ai-edge/LiteRT, containing the complete source code for Google's lightweight machine learning runtime, including CMake and Bazel build configurations.

The LiteRT repository serves as the official home for Google's next-generation lightweight runtime for machine learning inference. Hosted under the google-ai-edge organization, this open-source project provides the core runtime libraries, build tools, and example implementations needed to deploy TensorFlow Lite models efficiently. Developers can access the complete source code to build, customize, and integrate LiteRT into edge computing applications.

Official Repository Location

The canonical source for LiteRT resides in the public GitHub repository google-ai-edge/LiteRT. You can browse the latest stable code, review release notes, and download the entire project directly from the main branch.

To obtain a local copy, use either HTTPS or SSH:


# Clone via HTTPS

git clone https://github.com/google-ai-edge/LiteRT.git
cd LiteRT

# Or clone via SSH (requires GitHub SSH key)

git clone git@github.com:google-ai-edge/LiteRT.git

Alternatively, download a ZIP archive directly from the GitHub interface using the "Code → Download ZIP" option.

Repository Structure and Organization

The LiteRT repository follows a conventional Bazel-oriented layout while maintaining comprehensive CMake support. The top-level directories separate the core runtime from utilities, examples, and build tooling.

Directory Purpose
litert/ Core LiteRT runtime, CMake build files, and documentation
tflite/ Helper utilities and type definitions used by the runtime
weight_loader/ APIs for loading external model weights
third_party/ External dependencies (e.g., xdsl)
docker_build/ Docker-based build scripts and environment specifications
cmake_example/ Minimal CMake example programs illustrating usage

Key configuration files at the root include BUILD* targets, WORKSPACE for Bazel, README.md for project overview, and RELEASE.md for version guidance.

Building from Source

LiteRT supports both CMake and Bazel build systems, accommodating different development workflows and platform requirements.

CMake Build Process

The repository provides predefined CMake presets for streamlined compilation. In litert/CMakeLists.txt and litert/CMakePresets.json, the build logic defines targets for the runtime library and example applications.


# Clone and enter the repository

git clone https://github.com/google-ai-edge/LiteRT.git
cd LiteRT

# Create build directory and configure

mkdir -p build && cd build
cmake .. --preset=default

# Build the runtime library

cmake --build . --target litert

After successful compilation, run the minimal example in cmake_example/run_model_simple.cc to verify your build:

./cmake_example/run_model_simple <path/to/model.tflite>

Bazel Build Process

For Bazel users, the repository includes BUILD files throughout the source tree and a root WORKSPACE file defining external dependencies. Build all targets using:

bazel build //...

Build definitions shared across the project reside in litert/build_common/litert_build_defs.bzl. For containerized builds, the repository provides docker_build/hermetic_build.Dockerfile for reproducible build environments.

Core API and Usage Examples

The litert/ directory contains the primary headers and implementation files for model loading and inference.

Loading and Running Models

The runtime API, defined in litert/runtime.h and litert/model.h, enables straightforward model execution. The tflite/util.h header provides additional helper utilities for tensor handling.

#include "litert/runtime.h"
#include "litert/model.h"
#include "litert/tensor.h"

int main() {
  // Load model from filesystem
  auto model = litert::Model::LoadFromFile("model.tflite");
  
  // Initialize runtime and allocate tensors
  litert::Runtime runtime;
  runtime.LoadModel(*model);
  runtime.AllocateTensors();
  
  // Execute inference
  runtime.Invoke();
  
  // Access output via runtime.GetOutputTensor(0)
  return 0;
}

External Weight Loading

For scenarios requiring separated model weights, the weight_loader/external_weight_loader_litert.h interface loads external binary blobs:

#include "weight_loader/external_weight_loader_litert.h"

// Load weights from external file
auto status = litert::ExternalWeightLoader::LoadFromFile("weights.bin");
if (!status.ok()) {
  // Handle error
}

Summary

  • The LiteRT repository is located at https://github.com/google-ai-edge/LiteRT under the google-ai-edge GitHub organization
  • The project uses a hybrid build system with CMake (primary for development) and Bazel (for internal Google workflows)
  • Core runtime code resides in the litert/ directory, with helper utilities in tflite/ and weight loading APIs in weight_loader/
  • Predefined CMake presets in litert/CMakePresets.json streamline the build process
  • The cmake_example/run_model_simple.cc file provides a minimal working example of model inference

Frequently Asked Questions

What is the exact URL for the LiteRT repository?

The official LiteRT repository is hosted at https://github.com/google-ai-edge/LiteRT. This URL provides access to the main branch containing the latest stable source code, build configurations, and documentation for Google's lightweight machine learning runtime.

Does LiteRT support both CMake and Bazel builds?

Yes. The repository maintains full support for CMake through litert/CMakeLists.txt and CMakePresets.json, making it accessible for standard open-source development. It also includes Bazel BUILD files and a WORKSPACE configuration used internally at Google and available for Bazel-based projects.

Where can I find example code for running inference?

Practical examples reside in the cmake_example/ directory, specifically cmake_example/run_model_simple.cc. This file demonstrates how to load a TensorFlow Lite model using litert::Model::LoadFromFile(), initialize the runtime, allocate tensors, and execute inference through runtime.Invoke().

How do I load model weights that are stored separately from the model file?

Use the External Weight Loader API defined in weight_loader/external_weight_loader_litert.h. The ExternalWeightLoader::LoadFromFile() method allows you to load binary weight blobs from external storage, enabling flexible deployment scenarios where model architecture and weights are distributed separately.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →