Skip to content
heliaAOT
Examples
HELIA HUB

First model

Convert the MLPerf Tiny keyword-spotting model into a stand-alone C module and inspect its sources, headers and memory plan. This is a runnable companion to Getting started. It selects CMake packaging; the tutorial’s complete firmware path uses Zephyr.

Field Value
Model kws_ref, MLPerf Tiny keyword spotting, int8
Target apollo510_evb
Shows One conversion, the emitted module tree, and the arena summary the converter prints
CI Conversion and host compilation are declared in the examples CI job

The model is the committed kws_ref/model.tflite, MLPerf Tiny keyword spotting: int8, 53,936 bytes, SHA-256 aeea4368…bd0ae, Apache-2.0. Its README records where it comes from.

Use a repository checkout with Bash and the environment from Running examples: uv sync --frozen --group ci, then activate .venv. Run the commands below from this example directory. Conversion runs on the host; it does not execute the emitted firmware.

Terminal window
./run.sh

The script runs the conversion in config.yaml, which reads the committed model and golden fixture. Anything you add on the command line is passed through to helia-aot convert, so

Terminal window
./run.sh --module.type zephyr --module.path /tmp/zephyr-module

emits the same model for a different build system without editing the file. A second run stops with Output path ... already exists, because the first run’s module is still in out/. Run ./run.sh --force to replace it.

The model and target match Convert your first model, with CMake selected here as the output format. The scalar CLI equivalent is:

Terminal window
helia-aot convert --model.path kws_ref/model.tflite --model.name kws_ref \
--module.path ./out --module.name kws_ref --module.type cmake \
--platform.name apollo510_evb --test.enabled --test.golden-data kws_ref/golden.npz

The final result frame names the model, target, output path and arena plan. Check that conversion exits successfully, writes out/kws_ref/, and reports no unsupported model or memory-planning error. Counts and sizes can change with compiler/transform versions; preserve the log with the model hash and configuration instead of treating a captured count as a permanent contract.

Read the arena roles before tuning: scratch slots can be reused within a run; cold constants are read in place. Target capabilities constrain eligible implementations but do not prove that every operation uses an optimized kernel.

The module itself is one directory:

out/kws_ref/
includes-api/ start with aot_model.h
src/ model, tensor, context, constants and operator sources
CMakeLists.txt the CMake library target
aot_plan.json the optimization plan
aot_report.json why each choice was made
LICENSE
README.md

aot_model_init() and aot_model_run() are the minimal application lifecycle. Check both status values before using outputs. Optional test, callback, arena binding and hydration interfaces have additional contracts in their generated headers; per-node wrappers and private context fields are implementation details.

test.enabled added src/aot_test_case.c, a harness that runs the module against the golden fixture on target and reports the largest difference per output. Converting emits it. Running it is a separate step, on hardware or a simulator.

The pinned fixture has one int8 input [1, 49, 10, 1] (490 bytes) and one int8 output [1, 12] (12 bytes). The archive keys are input_0 and output_0. The model’s SHA-256 is aeea436800704fce17b17292e4412630ad856e9d777c044c64ef748a880bd0ae and the golden’s is 434290baa67ce60cf6e7b0d3f5539acae92d3c0890d9f30636d16b3762402f13. Inspect the generated README’s I/O tables for quantization parameters; raw integer bytes must match the model’s scale and zero point. Generating the test harness does not execute it on a board or establish application accuracy.