Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: What is the ML Inference Advisor?

description: Understand where MLIA fits in model preparation and how Vela, Corstone FVP, Model Explorer, and runtime profiling tools support different checks.

weight: 2

### FIXED, DO NOT MODIFY
layout: "learningpathall"
---

## Understand what MLIA does

Arm ML Inference Advisor (MLIA) helps you evaluate whether a machine learning model is suitable for a target inference platform.
Comment thread
matt-cossins marked this conversation as resolved.

In this Learning Path, you use MLIA from the command line to check model compatibility, estimate performance, and read advice that points toward useful model changes. This Learning Path uses Arm Ethos-U as an example target.

MLIA is most useful before full deployment or runtime profiling, when you are asking questions such as:

- Will this model map cleanly to my target?
- Which operators or layers are likely to matter most for performance?
Comment thread
matt-cossins marked this conversation as resolved.
- Is the model compute-bound, memory-bound, or affected by low MAC utilization?
- Is the model well-optimized for my Arm target hardware?
- What should I investigate before building firmware or running on a board?

MLIA does not make the final optimization decision for you. It gives target-aware evidence so you can decide what to change, what to measure next, and which workflow stage deserves attention.

## Use the CLI first

The MLIA CLI is the primary workflow in this Learning Path. You will use it to:

- discover installed targets, target profiles, and backends
- run compatibility checks
- run performance analysis
- inspect advice and metrics

If you want to automate the same checks, there is an optional Python API section at the end of this Learning Path. The API is useful when you want to embed MLIA results in another product, dashboard, CI job, or tool.

## Using MLIA alongside other tools

MLIA is not a replacement for graph visualization or runtime profiling. It is an advisory layer that helps earlier in the model preparation workflow.

| Tool or backend | Use it to answer |
| --- | --- |
| MLIA | Is this model suitable for my target, and what should I change? |
| Vela | Which operators are supported, and which layers dominate compiler-estimated cycles? |
| Corstone FVP | What NPU performance counters does a packaged `.pte` artifact produce for the whole model run on a virtual platform? |
| Model Explorer | What does the generated model artifact graph look like? |
| Runtime-specific profiling tools | What happened when the model actually ran? For example, use ETRecord, ETDump, and ExecuTorch Inspector for ExecuTorch deployments, or LiteRT benchmark and profiling tools for LiteRT deployments. |

Vela-backed MLIA checks use compiler estimates. They can include operator-level breakdowns, such as which layers dominate estimated cycles or have low MAC utilization. Corstone-backed MLIA checks run a packaged `.pte` file on an FVP and report NPU performance counters for the whole model run. They do not provide per-layer estimates or operator breakdowns.

Model Explorer can show how an ExecuTorch `.pte` artifact is partitioned into delegate regions. Runtime-specific profiling tools can show behavior after you have a runnable deployment.

Use these tools together:

- Use MLIA before or during model preparation.
- Use Model Explorer to inspect generated artifacts and delegation structure.
- Use runtime profiling tools after you can execute the model.

## Understand the model formats

MLIA can analyze different kinds of model artifacts depending on what workflow you are using and the stage you want to analyze.

| Format | Where it fits |
| --- | --- |
| `.pte` | Serialized ExecuTorch program. Ethos-U `.pte` performance analysis uses Corstone backends. |
| `.tflite` | LiteRT model format used in many Ethos-U and embedded ML workflows. |
| `.tosa` | Intermediate representation consumed by compiler/backend flows such as Ethos-U Vela. |

## What you have learned

You have learned what MLIA does, what you use it for, and how MLIA fits alongside other tools.

Next, you will install MLIA and inspect the capabilities available in your environment.
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---
title: Install MLIA and discover capabilities

description: Install the MLIA Ethos-U plugin, inspect target profiles and backends, and download the model artifacts used in the analysis examples.

weight: 3

### FIXED, DO NOT MODIFY
layout: "learningpathall"
---

## Check your environment

Use Ubuntu 22.04 LTS or another compatible Linux environment with Python 3.10 or later.

Check that Git LFS is installed:

```bash
git lfs version
```

If this command fails, install Git LFS and the Python development package:

```bash
sudo apt update
sudo apt install -y git-lfs python3.10-dev
```

## Create a Python environment

Create a virtual environment so the MLIA packages do not conflict with any existing ML framework environment.

```bash
python3 -m venv mlia_env
source mlia_env/bin/activate
python -m pip install --upgrade pip
```

## Install MLIA

MLIA uses plugins. The examples in this Learning Path use Ethos-U as the target, so install the Ethos-U plugin package:

```bash
pip install mlia-ethos-u
```

The Ethos-U plugin package depends on a compatible MLIA core package. Installing the target plugin is the recommended starting point because it brings in the matching MLIA core dependency.

## Confirm the CLI works

Display top-level help:

```bash
mlia --help
```

You should see commands similar to:

```output
check Generate compatibility/performance advice for a model
backend Manage MLIA backends
target Manage MLIA targets
```

The `mlia check` command is the main command you will use to ask MLIA compatibility and performance questions about model artifacts.

## Discover target profiles

MLIA target profiles describe the target configuration used for analysis. List the target profiles available in your environment:

```bash
mlia target list
```

For Ethos-U, typical bundled profiles include:

| Target profile | Ethos-U NPU | MACs per cycle |
| --- | --- | --- |
| `ethos-u55-128` | Ethos-U55 | 128 |
| `ethos-u55-256` | Ethos-U55 | 256 |
| `ethos-u65-256` | Ethos-U65 | 256 |
| `ethos-u65-512` | Ethos-U65 | 512 |
| `ethos-u85-128` | Ethos-U85 | 128 |
| `ethos-u85-256` | Ethos-U85 | 256 |
| `ethos-u85-512` | Ethos-U85 | 512 |
| `ethos-u85-1024` | Ethos-U85 | 1024 |
| `ethos-u85-2048` | Ethos-U85 | 2048 |

In this Learning Path, the examples use one Ethos-U85 profile:

```output
ethos-u85-256
```

Use a different profile if you want MLIA to evaluate the same model for a different Ethos-U configuration.

## Discover backends

Backends perform the work behind an MLIA analysis flow. List available and installed backends:

```bash
mlia backend list
```

For this Ethos-U demonstration, you should expect Vela and Corstone backend options. You use Vela for the LiteRT and TOSA checks, and Corstone for the packaged ExecuTorch `.pte` checks later in this Learning Path.

```output
Name Installed Installable
corstone-300 no yes
corstone-310 no yes
corstone-320 no yes
vela no yes
```

When we later use `mlia check`, any missing backends required by your target will be installed.

## Clone model artifacts

This Learning Path uses prebuilt artifacts from the Arm ML model artifacts repository:

```bash
git lfs install
git clone --filter=blob:none --sparse https://github.com/arm-education/ml-model-artifacts.git
cd ml-model-artifacts
git sparse-checkout set pte tflite tosa
git lfs pull \
--include="pte/toy_conditional_select_int8_ethos_u55_256.pte,pte/toy_conditional_select_int8_ethos_u85_256.pte,tflite/mv2_fp32.tflite,tflite/mv2_int8.tflite,tosa/mv2_fp32.tosa,tosa/mv2_int8.tosa" \
--exclude=""
git lfs checkout
```

This downloads only the artifacts used in this Learning Path. It avoids larger unrelated files, such as transformer `.pte`, `.etdp`, and `.etrecord` artifacts.

Confirm that the artifacts are real model files, not Git LFS pointer files:

```bash
wc -c tflite/mv2_int8.tflite
```

You should see a size of several megabytes, similar to:

```output
3942808 tflite/mv2_int8.tflite
```

If the file is about 100 to 200 bytes, it is still a Git LFS pointer file. Run the `git lfs pull` command again from the `ml-model-artifacts` directory, then rerun the size check.

The model artifacts are provided for learning and analysis exercises. Use them to explore MLIA workflows, model formats, and target-aware advice, not as accuracy reference models.

The repository contains model artifacts such as:

```output
ml-model-artifacts/
├── pte/
│ ├── toy_conditional_select_int8_ethos_u55_256.pte
│ └── toy_conditional_select_int8_ethos_u85_256.pte
├── tflite/
│ ├── mv2_fp32.tflite
│ └── mv2_int8.tflite
└── tosa/
├── mv2_fp32.tosa
└── mv2_int8.tosa
```

## What you have learned

You have installed MLIA, along with the Ethos-U plugin, discovered available target profiles and backends from the CLI, and cloned model artifacts for analysis.

Next, you will run your first MLIA compatibility and performance checks.
Loading
Loading