r/androiddev • • 19d ago

How do you debug on-device ML inference (LiteRT / ONNX Runtime) in a shipped Android app?

For anyone running LiteRT (TFLite) or ONNX Runtime inside a production Android app: when inference fails, gets slow, or gives bad output on a user's device, how do you figure out what happened?

Android hardware varies so much that I'd expect GPU/NNAPI delegate fallbacks, OOMs on low-end devices, or thermal throttling to show up in ways that are hard to reproduce.

Are you tracking things like model load time, latency per device, or which delegate actually ran, or mostly relying on Crashlytics and user reports?

Curious what's been hardest to diagnose after release.

2 Upvotes

5 comments sorted by

1

u/simbolmina 19d ago

I have craslytics and custom crash logger that user can send the logs after crash. For development, tons of logs, benchmarks and tests.

1

u/trikboomie 17d ago

Thanks, that's useful. When inference gives a bad or slow result without crashing (a model that won't load, a delegate fallback, a latency spike on certain devices), does any of that reach your crash logger, or do you only find out from user reports?

1

u/simbolmina 17d ago

if user accepts data collection i do see them, if not, after fatal crash I prompt user to send bug report. I use it only for local LLM crashes and after initial a few months and fixing the issue crashes stopped. Tbh those report did not help much since they all happened for the same reason that I already knew, maybe a few tweak was added. It also provides a piece of mind to the user that they know they contribute and heard.

1

u/trikboomie 14d ago

Makes sense. So for non-crash problems (slow or wrong output, a GPU delegate silently falling back to CPU), do you have any visibility at all, or would you only hear about them from reviews or support?