Who is this for?

This is an introductory topic for software developers interested in learning how to build an Android chat app with Llama, KleidiAI, ExecuTorch, and XNNPACK.

What will you learn?

Upon completion of this Learning Path, you will be able to:

  • Set up an ExecuTorch development environment.
  • Describe how ExecuTorch uses KleidiAI kernels to accelerate performance on Arm-based platforms.
  • Describe how 4-bit groupwise PTQ quantization reduces model size without significantly sacrificing model accuracy.
  • Build and run Llama models using ExecuTorch on your development machine.
  • Build and run an Android Chat app with different Llama models using ExecuTorch on an Arm-based smartphone.

Prerequisites

Before starting, you will need the following:

  • An Apple M1/M2 development machine with Android Studio installed or a Linux machine with at least 16GB of RAM.
  • An Arm-powered smartphone with the i8mm feature running Android, with 16GB of RAM.
  • A USB cable to connect your smartphone to your development machine.
  • Android Debug Bridge (adb) installed on your device. Follow the steps in adb to install Android SDK Platform Tools. The adb tool is included in this package.
  • Java 17 JDK. Follow the steps in Java 17 JDK to download and install JDK for host.
  • Python 3.10.

Summary

AI-assisted

This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
You’ll build and deploy an Android LLM chat app with ExecuTorch, XNNPACK, and KleidiAI on an Arm smartphone. First, you’ll set up an isolated Python environment, prepare a Llama 3.2 1B Instruct model, and enable KleidiAI through XNNPACK for supported Arm chips. Then, you’ll cross-compile the runner and JNI libraries with the Android NDK, integrate them, deploy the app, and run benchmarks.

Frequently asked questions

AI-assisted

These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
Which Python environment should I use to install ExecuTorch dependencies?
Use an isolated environment. You can choose either a Python virtual environment or a Conda environment. You need only one environment.
How do I obtain and prepare the Llama 3.2 1B Instruct model for ExecuTorch?
Request access on Meta’s Llama Downloads page and use the time-limited download link you receive. Install the llama-stack package from pip, then run the provided command to download the model using your download link.
How do I know my Android NDK is set correctly before cross-compiling?
Set the ANDROID_NDK environment variable to your NDK path. Confirm that $ANDROID_NDK/build/cmake/android.toolchain.cmake exists so CMake can locate the Android toolchain.
What gets built when I compile for Android with KleidiAI enabled?
You’ll build the ExecuTorch runtime and a Llama runner binary for Android, along with JNI libraries for the app. Use these artifacts to run the model and execute benchmarks on the Android device.
Can I use a different Llama model instead of 3.2 1B Instruct?
Yes. The same instructions apply to other Llama options with minimal modification.
Next