tensorflow / tensorflow/tflite-micro
Remove monolithic `tensorflow` dependency from Python targets
@veblush is already working on this.
Since Aug 20, 2026.
- Dominant language
- C++
- Stars
- 3.1k
- Forks
- 1.1k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 43
Description
Background
While the core TFLite Micro (TFLM) C++ library is entirely independent of TensorFlow, our Python bindings, tests, and related tooling currently depend on the monolithic tensorflow Python package. While historically convenient, this dependency introduces severe maintainability and infrastructure issues for our Python ecosystem.
I propose completely removing the tensorflow dependency from the TFLM repository's Python targets, replacing it with leaner, standard alternatives.
Motivation
Keeping the monolithic TensorFlow dependency presents two major blockers:
1. Python Version Lock-in
The tensorflow package dictates which Python versions we can support. When a new Python version is released, TFLM is blocked from adopting or testing against it until the main TensorFlow project officially supports it and releases a new pip package.
For example, with the recent release of Python 3.14, tensorflow does not yet provide compatible wheels. As a result, TFLM is blocked from adding Python 3.14 support to our Python CI or releasing Python 3.14-compatible tflite-micro packages. This tight coupling slows our upgrade cycles and creates unnecessary friction.
2. Massive Size Causing CI Resource Exhaustion
The monolithic TensorFlow package brings in a massive amount of C++ core dependencies (e.g., XLA, MLIR, LLVM), making it incredibly difficult to work with:
- Package Size: A standard pip installation of
tensorflowconsumes about 1.8 GB of disk space per environment, whereas the lightweightai-edge-litert(formerlytflite-runtime) or nativetflite-micropackages are typically only a few megabytes. - GitHub CI Failures: Our GitHub Actions workflows frequently encounter Out of Memory (OOM) or out-of-space errors purely due to fetching, installing, and processing this gigantic footprint.
- Linker Bloat: When building with ASAN, compiling a simple Python debugging script that transitively depends on TensorFlow inflates the linked binary to ~2.36 GiB, requiring nearly 12 GB of memory to link. By removing the TF dependency locally, we prototyped dropping this binary size to a mere 108 MiB.
How is tensorflow currently used?
An audit of our codebase shows that tensorflow is used primarily for four reasons:
- Testing Infrastructure: Using
tf.test.TestCaseandtf.test.main(). - TFLite Interpreter: Using
tf.lite.Interpreterfor model evaluation. - File I/O (
gfile): Usingtf.io.gfilefor basic file reading. - Keras / Model Conversion: Using
tf.kerasfor loading/converting models to compare baselines.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.