+1 (415) 366-1364

Migrating from TensorFlow Lite to LiteRT

In September 2024 Google renamed TensorFlow Lite to LiteRT ("Lite Runtime") and moved it under the Google AI Edge umbrella. The announcement was easy to misread as a rebrand and nothing more. It is a little more than that: the .tflite model format and the runtime are unchanged, but the legacy TensorFlow Lite packages no longer receive feature updates - GPU and NPU acceleration work, new ops, and new platform support land in the LiteRT packages only. If you ship on-device models, you want to be on the new packages. This is the migration as we do it for clients.

What changed and what did not

Unchanged:

  • The .tflite flatbuffer model format. Existing model files work as-is.
  • The converter. tf.lite.TFLiteConverter in TensorFlow still produces .tflite files.
  • The core runtime APIs: Interpreter, tensors, signatures, delegates.

Changed:

  • Package and artifact names on every platform (Python, Android, iOS, C++).
  • Where development happens: github.com/google-ai-edge/LiteRT and the docs at ai.google.dev/edge.
  • Where new capability lands: the production LiteRT release added GPU and NPU acceleration paths that the legacy packages will not get.

Google's own migration page is at ai.google.dev/edge/litert/migration; keep it open while you work, since package coordinates are the thing most likely to move again.

Python: tflite-runtime to ai-edge-litert

The standalone Python interpreter package is now ai-edge-litert:

pip uninstall -y tflite-runtime
pip install ai-edge-litert

And the import changes:

# before
from tflite_runtime.interpreter import Interpreter

# after
from ai_edge_litert.interpreter import Interpreter

interpreter = Interpreter(model_path="model.tflite")
interpreter.allocate_tensors()

runner = interpreter.get_signature_runner("serving_default")
output = runner(input_1=batch)

If you were using tf.lite.Interpreter from the full TensorFlow package, it still exists, but the standalone LiteRT package is smaller and is what you want on an edge device that should not carry all of TensorFlow.

Android: Maven coordinates

The legacy artifacts were under org.tensorflow. The LiteRT artifacts are under com.google.ai.edge.litert:

// before
implementation("org.tensorflow:tensorflow-lite:2.x.y")
implementation("org.tensorflow:tensorflow-lite-gpu:2.x.y")

// after
implementation("com.google.ai.edge.litert:litert:<version>")
implementation("com.google.ai.edge.litert:litert-gpu:<version>")

Take the current version numbers from the migration page or the GitHub releases rather than from this post. In the classic Interpreter API the Java package remains org.tensorflow.lite for compatibility, so for many apps the Gradle change is the whole migration. The newer LiteRT CompiledModel API - which is where the GPU/NPU acceleration story is - lives under com.google.ai.edge.litert and is worth adopting once the dependency swap is done.

iOS: CocoaPods

# before
pod 'TensorFlowLiteSwift'

# after
pod 'LiteRTSwift'

Same pattern: swap the pod, rebuild, run your existing tests. Again, confirm the pod name against the migration page at the time you do the work.

C++ and embedded

Build from the LiteRT repository instead of the TensorFlow tree. The headers still present the tflite:: namespace in the classic API, so source changes are usually limited to include paths and build targets. If you vendor a prebuilt static library, this is the moment to regenerate it from LiteRT so you pick up the accelerated paths.

The acceleration payoff

The reason to do this migration rather than just leaving it is the hardware acceleration work. The production LiteRT release added GPU and NPU execution paths that can deliver large speedups over CPU for convolutional and transformer workloads - but only if the ops in your model are supported by the accelerator, and only if you actually enable it. After the package migration:

  1. Benchmark CPU-only on your real target devices to get a baseline.
  2. Enable the GPU delegate (or CompiledModel with the GPU accelerator) and benchmark again.
  3. Check the logs for ops that fell back to CPU. Fallbacks at the wrong point in the graph can make the accelerated path slower than CPU because of memory copies.
  4. Where fallbacks hurt, re-export the model with those ops replaced or fused.

We do step 3 and 4 on every edge engagement; it is usually where the real win comes from.

Gotchas we have hit

  • Mixed packages. Having both tflite-runtime and ai-edge-litert installed in the same Python environment causes confusing import behaviour. Uninstall the old one.
  • Transitive dependencies. A third-party Android library may pull the legacy org.tensorflow:tensorflow-lite artifact transitively. Check ./gradlew app:dependencies and exclude it, or you will ship two runtimes.
  • Model metadata / task libraries. If you used the TensorFlow Lite Task Library or Support Library, check the migration page for the current equivalents; these moved on different schedules from the core runtime.
  • Quantized model op coverage. Full-integer quantized models have a different supported-op set on GPU than float models. Re-run the fallback check per quantization variant.
  • "Nothing changed, so nothing to test." The artifacts changed. Run the on-device test suite, including the accuracy check against your golden outputs.

Should you wait for the next rename?

No. The .tflite format has been stable across the entire TensorFlow Lite and LiteRT history, and the runtime API surface has been deliberately preserved. The package coordinates are the part that changes, which is why this migration is mostly a build-file exercise. Doing it now means your next model update can use the accelerated paths; deferring it means carrying packages that are frozen in time while your device fleet moves on.

Migration checklist

  1. Inventory every place you depend on TFLite packages: Python, Gradle, Podfile, C++ build files, CI images.
  2. Swap to the LiteRT packages one platform at a time.
  3. Rebuild; run existing tests and an accuracy check against golden outputs.
  4. Enable hardware acceleration; benchmark; chase CPU fallbacks.
  5. Remove the legacy packages and any transitive copies.

If you would like help - especially with the delegate tuning, which is where most of the time goes - our Edge AI & LiteRT Deployment engagement covers the whole path from trained model to tuned on-device artifact. Contact us to talk about your target devices.