# Run LLM inference on Android with KleidiAI, MediaPipe, and XNNPACK

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/kleidiai-on-android-with-mediapipe-and-xnnpack/)
- [Install dependencies](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/kleidiai-on-android-with-mediapipe-and-xnnpack/1-x86-install-dependencies/)
- [Run the Gemma 2B model using MediaPipe with XNNPACK](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/kleidiai-on-android-with-mediapipe-and-xnnpack/2-run-gemma-2b/)
- [Benchmark the Gemma 2B Model with KleidiAI](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/kleidiai-on-android-with-mediapipe-and-xnnpack/3-benchmark-gemma-i8mm/)
- [Next Steps](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/kleidiai-on-android-with-mediapipe-and-xnnpack/_next-steps/)

## About this Learning Path

|  |  |
| --- | --- |
| Skill level: | Advanced |
| Reading time: | 1 hr |
| Last updated: | 12 Nov 2026 |

| Authors: |
|----------|
| Pareena Verma, Arm [GitHub](https://github.com/pareenaverma) [LinkedIn](https://linkedin.com/in/pareena-verma-7853607) |
| Joe Stech, Arm [GitHub](https://github.com/JoeStech) [LinkedIn](https://linkedin.com/in/joestech) |
| Adnan AlSinan, Arm |

|  |  |
| --- | --- |
| Authors: | Pareena Verma , Arm<br>[GitHub](https://github.com/pareenaverma)<br>[LinkedIn](https://linkedin.com/in/pareena-verma-7853607)<br>Joe Stech , Arm<br>[GitHub](https://github.com/JoeStech)<br>[LinkedIn](https://linkedin.com/in/joestech)<br>Adnan AlSinan , Arm |
| Arm IP: | [Cortex-A](https://support.arm.com/?tab=compute-ip&Product%20Type=Application%20Processors) |
| Tags: | [AI/ML](https://learn.arm.com/tag/ai-ml/) [Linux](https://learn.arm.com/tag/linux) [Java](https://learn.arm.com/tag/java) [MediaPipe](https://learn.arm.com/tag/mediapipe) [Android SDK](https://learn.arm.com/tag/android-sdk) [Android NDK](https://learn.arm.com/tag/android-ndk) [Bazel](https://learn.arm.com/tag/bazel) [XNNPACK](https://learn.arm.com/tag/xnnpack) [Hugging Face](https://learn.arm.com/tag/hugging-face) |

### Who is this for?
This is an advanced topic for Android developers who want to efficiently run LLMs on-device.

### What will you learn?
After completing this Learning Path, you'll be able to perform the following tasks:
- Install the prerequisites for cross-compiling new inference engines for Android.
- Run LLM inference on an Android device with the Gemma 2B model using the Google AI Edge's MediaPipe framework.
- Benchmark LLM inference speed with and without the KleidiAI-enhanced Arm i8mm processor feature.

### Prerequisites
Before starting, you'll need the following prerequisites:
- An x86_64 Linux machine running Ubuntu with approximately 500 MB of free space, or a docker daemon that can build and run a provided x86_64 Dockerfile.
- An Android phone with support for i8mm (tested on Google Pixel 8 Pro).

### Summary
You’ll cross-compile MediaPipe with XNNPACK for Android `arm64` and run Gemma 2B on an i8mm-capable device. First, you’ll build and verify the binary with Bazel, then run inference. After running inference, you’ll create a second build without i8mm and benchmark both variants to assess the effect of KleidiAI integration on supported Android hardware.
