How to Run ML Models On-Device in Android Apps at 35ms Inference
A software engineer outlines a complete pipeline for integrating machine learning models into Android apps using TensorFlow Lite, drawing on three years of real-world client work. The approach was originally driven by a health-tech startup that needed on-device skin-screening to avoid sending sensitive medical images to the cloud and stay GDPR-compliant. An early attempt failed due to unquantized models running on the main thread, causing bloated APK sizes, UI freezes, and poor battery performance. The article details how converting models from float32 to int8 via post-training quantization can reduce model size by 75 percent and significantly speed up inference. Key recommendations include choosing between on-device, cloud, or hybrid inference based on privacy needs, and keeping the model conversion pipeline in CI to prevent versioning errors.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in