Sitemap
Sam Austin AI

Sam Austin AI

A lifelong learner! I enjoy learning &sharing things as possible. If you like my stories and would love to support more https://buymeacoffee.com/samaustin

TensorFlow Lite for Android: On-Device ML in Mobile Apps

5 min readSep 29, 2026

--

Here’s something that’ll save you a confusing afternoon: if you’re searching for “TensorFlow Lite” in 2026, you need to know it’s not really called that anymore. Google renamed it to LiteRT back in September 2024, and as of early 2026, TensorFlow Lite packages are in maintenance mode, receiving only critical security and stability updates. All active development happens under the LiteRT name now.

I’ll cover both names throughout, since half the tutorials online still say “TFLite” and the docs now say “LiteRT.” Same runtime, same .tflite file format, new name and a genuinely expanded scope.

Press enter or click to view image in full size

Wait, What Happened to TensorFlow Lite?

Let’s get the naming sorted first, because it trips up everyone returning to this space after a break. Google renamed TensorFlow Lite to LiteRT because the runtime had grown beyond its TensorFlow roots to support models authored in PyTorch, JAX, and Keras with the same performance. Naming it after one source framework no longer matched what it actually did.

The good news: your existing TFLite knowledge transfers directly. The on-disk file format and the original Interpreter API are preserved, so apps already using TensorFlow Lite keep working without changes. If you see org.tensorflow.lite in a Gradle dependency alongside "LiteRT" in Google's docs, they're the same thing.

  • Old package: org.tensorflow:tensorflow-lite → New package: com.google.ai.edge.litert:litert
  • Old Python package: tflite-runtime → New: ai-edge-litert
  • New PyTorch converter: litert-torch, which goes straight from torch.export to .tflite with no TensorFlow graph step in between

New projects should start on LiteRT packages directly. Existing apps aren’t broken, but they’re not getting new features either.

What LiteRT (Still) Does Well

The core value proposition hasn’t changed even though the name did. LiteRT is Google’s on-device inference engine for deploying ML and GenAI models across Android, iOS, web, desktop, and embedded IoT platforms. That cross-platform reach matters if your team ships more than just an Android app.

Real products already run on this stack: on-device image classification in Google Photos and offline mode in Google Translate both rely on this runtime. That’s the kind of reliability track record you want before betting your app’s ML feature on it.

Two APIs, One Recommendation

Here’s a distinction that matters for anyone starting fresh. LiteRT ships two runtime APIs:

  • Interpreter API: The original TensorFlow Lite API, kept around for backward compatibility
  • CompiledModel API: The newer, recommended choice for developers seeking top performance

The CompiledModel API automatically selects the best available accelerator, whether that’s CPU, GPU, or NPU, and handles asynchronous execution and zero-copy GPU buffers for you. The old system forced you to manually pick your accelerator, which meant extra code and extra chances to pick wrong for a given device. Start new projects on CompiledModel unless you have a specific reason to stick with Interpreter.

Setting Up Your Project

Add the LiteRT dependency to your Android app’s build.gradle:

gradle

dependencies {
implementation("com.google.ai.edge.litert:litert:2.2.0")
}

Check the current version before you pin it, since this stack updates frequently. One tracked snapshot found the package at 2.2.0 as of September 2026, but treat that as a starting point rather than gospel.

Converting a Model

You’ve got a few paths depending on your source framework. For PyTorch models, the newer litert-torch converter skips the old ONNX and TensorFlow-graph detour entirely:

Get Sam Austin AI’s stories in your inbox

Join Medium for free to get updates from this writer.

python

pip install litert-torch

python

import torch
import ai_edge_torch
model = YourModel()
model.eval()
sample_input = (torch.randn(1, 3, 224, 224),)
edge_model = ai_edge_torch.convert(model, sample_input)
edge_model.export("model.tflite")

For TensorFlow or Keras models, the classic conversion path still works the same way it always did:

python

import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model("saved_model_dir")
tflite_model = converter.convert()
with open("model.tflite", "wb") as f:
f.write(tflite_model)

Either route lands you at the same .tflite file, which is the format both the Interpreter and CompiledModel APIs consume.

Running Inference in Android (Kotlin)

Once your model file sits in your app’s assets folder, loading and running it looks like this with the CompiledModel API:

kotlin

val model = CompiledModel.create(context, "model.tflite")
val inputBuffer = model.createInputBuffer(0)
inputBuffer.writeFloat(preprocessedPixels)
val outputBuffer = model.run(inputBuffer)
val results = outputBuffer.readFloat()

For camera-based models, feed frames in efficiently. When processing camera frames with CameraX, copy decoded pixel buffers directly into input buffers, ideally using zero-copy techniques rather than manual array copying. That difference matters a lot once you’re processing video at 30 frames per second instead of a single static image.

Running LLMs On-Device: LiteRT-LM

If you want conversational AI running locally rather than just classic ML tasks like classification, that’s a separate piece called LiteRT-LM, which provides conversational LLM inference and replaces the older MediaPipe LLM Inference API. Don’t confuse the two: LiteRT handles classic ML inference, while LiteRT-LM sits on top specifically for LLMs.

Setting expectations here matters. Don’t expect to run a 70B-parameter model on a phone, but for developers integrating GenAI features without relying on the cloud, it handles smaller models solidly. Google’s own benchmarks claim up to 100x CPU speedup via NPU acceleration compared to earlier approaches, though as always, benchmark your specific model and device before trusting vendor numbers blindly.

LiteRT vs Core ML: Which Should You Pick?

If you’re building for both Android and iOS, this question comes up constantly.

FrameworkBest ForTrade-offLiteRTAndroid, cross-platform (Android/iOS/web/IoT)iOS support exists but Core ML has more mature Neural Engine accelerationCore MLiOS-specific apps chasing maximum on-device performanceApple platforms only

For Neural Engine acceleration specifically on iOS, Core ML remains the more mature option. If you’re Android-first or need one model format across many platforms, LiteRT is the more natural fit. Many teams genuinely run both: LiteRT for Android, Core ML for iOS, from the same trained model.

Common Pitfalls

  • Pinning an old TFLite tutorial’s package names: Update to the LiteRT package names for new projects, since the old ones only get security patches now
  • Forgetting to check accelerator support: Not every device has the same NPU or GPU capabilities, so test on real hardware across a few device tiers
  • Mismatched preprocessing: Just like Core ML, your input normalization needs to match exactly what the model saw during training
  • Confusing LiteRT and LiteRT-LM: They solve different problems and aren’t interchangeable

Wrapping Up

TensorFlow Lite didn’t disappear, it just grew up and got a new name. LiteRT keeps the same .tflite format and Interpreter API for backward compatibility, while pushing new development toward the CompiledModel API and cross-framework support for PyTorch, JAX, and Keras models.

Will your old TFLite code keep working? Yes, for now, but only with critical patches going forward. Will starting fresh on LiteRT’s newer tooling save you pain down the road? Almost certainly. Convert a small model tonight, run it through CompiledModel, and see the accelerator selection handle itself.

--

--

A lifelong learner! I enjoy learning &sharing things as possible. If you like my stories and would love to support more https://buymeacoffee.com/samaustin