Topic hub

TinyML and edge AI on microcontrollers

How to fit a trained model onto a microcontroller (memory limits, integer quantisation, optimised kernels, which runtime suits which chip) and how to measure latency, energy and accuracy on the board.

Updated 28 November 2026 · TinyML, LiteRT for Microcontrollers, TensorFlow Lite for Microcontrollers, TFLM, int8 quantisation, CMSIS-NN, ESP-DL, ESP-PPQ, Edge Impulse, MLPerf Tiny, tensor arena

Overview

TinyML means running a trained machine-learning model on a microcontroller, next to the sensor, instead of sending raw data to a server. A vibration monitor that reports “bearing wear likely” once an hour sends far less data than one that streams raw acceleration. It also keeps working when the network does not. This hub is for makers who want a keyword spotter or gesture classifier on a devkit and for product teams deciding whether on-device inference is worth the flash, RAM and engineering time.

The hub covers deployment: getting a model onto a chip, making it fit and fast, and measuring it honestly. It does not teach how networks are designed or trained. For that, our sister site the AI/ML Field Guide covers model theory, training and quantisation from the machine-learning side.

Key ideas

Memory sets the limits

A microcontroller model has two memory costs. The weights live in flash. The activations, the intermediate results between layers, live in RAM. The MLPerf Tiny paper’s reference models show the range: a DS-CNN (depthwise separable convolutional network) keyword spotter of 52.5 KB, a ResNet image classifier of 96 KB, an autoencoder for anomaly detection of 270 KB and a MobileNetV1 person detector of 325 KB. The runtime adds its own cost. Google states that the core of LiteRT for Microcontrollers “just fits in 16 KB on an Arm Cortex M3”, and that it needs no operating system, no standard C or C++ libraries and no dynamic memory allocation. Instead, the application hands the interpreter one fixed-size block of RAM, the tensor arena, and every buffer comes from there. In the original TensorFlow Lite Micro paper, the person-detection reference model used 81.79 kB of memory in total on a SparkFun Edge board.

Quantise to integers

Float32 weights take four bytes each. Full-integer quantisation converts weights and activations to 8-bit integers. Google’s table lists it as 4x smaller with a 3x or greater speed-up, and as the option for microcontrollers. It needs a representative dataset, roughly 100 to 500 real samples, so the converter can measure the range of each activation. Use real sensor data from your own board here, not a tidy public dataset.

The tooling moved in 2026. Google’s post-training quantisation page now says that quantisation during conversion is deprecated. The recommended path is to convert to a float32 model, then quantise with LiteRT Quantizer (formerly AI Edge Quantizer). Its integer-only recipe for microcontrollers is static_wi8_ai8. The migration guide was last updated on 13 October 2026, so older tutorials that set quantisation flags on the converter will drift out of date.

Kernels decide the speed

The runtime walks the model’s graph and calls a kernel for each operation. The interpreter itself costs little: in the TFLM paper it was under 0.1% of run time for the person-detection model on an Ambiq Apollo3 (Arm Cortex-M4) and about 3% to 4% for a very small hotword model. The kernels matter much more. Swapping reference kernels for Arm’s CMSIS-NN gave more than a 4x speed-up on the person detector, but only 25% on the hotword model, because less of its time went to the inner loops. CMSIS-NN has plain C, DSP-extension and Helium (M-profile Vector Extension) paths, supports int8 and int16, and its README states that it is bit-exact with the TFLM reference kernels.

On the hosttrainfloat32 modelconvert.tflite or ONNXquantiseint8, calibratedpackageC array, .espdlbuilt into the firmware imageOn the microcontrollersensor inputpre-processingruntimefixed tensor arenakernelsCMSIS-NN, ESP-DLresultclass, scoremeasure on the board: latency, energy per inference, accuracy
The deployment path for a microcontroller model: train and quantise on the host, embed the model in firmware, run it from a fixed tensor arena with optimised kernels, then measure on the board. Our own drawing, based on the LiteRT for Microcontrollers workflow and the ESP-DL getting-started guide.

Pick the runtime that matches the chip

LiteRT for Microcontrollers is the general option. Its GitHub repository still carries the name TensorFlow Lite for Microcontrollers (TFLM), while Google’s documentation uses the new name, so expect both in searches. It is C++17, needs a 32-bit platform, supports a subset of operations and cannot train on the device. Arm Cortex-M, Cadence Xtensa and Qualcomm Hexagon are tier-1 platforms tested in its CI, and Espressif ESP32 is listed as a community platform.

Espressif’s own ESP-DL targets the ESP32-S3 and ESP32-P4 (the original ESP32 runs its operators in plain C and is significantly slower). It uses its own FlatBuffers-based .espdl format, produced by the ESP-PPQ quantiser from ONNX or PyTorch models, and needs ESP-IDF release/v5.3 or later. Edge Impulse is a hosted service whose deployment step produces a C++ library with no external dependencies. It estimates latency, flash and RAM for the chosen target, and the company says its EON Compiler uses less RAM and flash than TFLite.

Measure on the board, the way MLPerf Tiny does

Vendor speed figures use their own models and clocks. MLPerf Inference: Tiny from MLCommons gives a common yardstick: keyword spotting, visual wake words, image classification, anomaly detection and streaming wakeword, each with a minimum accuracy, with v1.4 the latest published round. Its paper describes the method. Latency is the median of five runs, each at least 10 seconds and 10 inferences. Energy is reported in microjoules per inference, measuring only the power delivered to the device’s core, with the level shifters on a separate channel and excluded. Copy that discipline even for an informal test: fixed clock, fixed supply voltage, the radio state stated, and accuracy checked on the board with the quantised model, not on the laptop.

For makers

Start with a hosted flow such as Edge Impulse or a LiteRT for Microcontrollers example on a supported board. Record your own sensor data from the start. Check the quantised model’s accuracy on the board before you build anything around it.

For product teams

Budget flash for weights and RAM for the tensor arena before choosing the chip. Quantise with real field data, pin the quantiser version (the LiteRT tooling changed in 2026), and keep the float model to re-quantise. Report latency and energy per inference with clock, voltage and radio state, following the MLPerf Tiny method. Treat a model update as a firmware update, with OTA, signing and rollback.

Where to start

Get a toolchain working with /learn/beginner/03-toolchains-and-first-flash/, then read a real sensor with /learn/beginner/05-sensors-over-i2c/, because a model is only as good as the data you capture. /learn/beginner/08-power-and-sleep/ and the current measurement method show how to measure energy. For chip choice see /topics/microcontrollers-and-socs/. For ESP-DL, the ESP32-S3-DevKitC-1 and ESP32-P4-Function-EV-Board match its supported chips. Model updates follow /topics/ota-and-fleet-management/.

Tools and platforms

As of 28 November 2026, from each project’s own documentation.

Job Tool What it gives you Source
Portable inference on 32-bit MCUs LiteRT for Microcontrollers (TFLM) Interpreter with fixed arena, 16 KB core on Cortex-M3, Apache-2.0 Google AI Edge, GitHub
Integer quantisation for LiteRT LiteRT Quantizer static_wi8_ai8 integer-only recipe with calibration data Migration guide
Fast kernels on Arm Cortex-M CMSIS-NN C, DSP and Helium paths, int8 and int16, bit-exact with TFLM Arm CMSIS-NN
Inference on ESP32-S3 or ESP32-P4 ESP-DL with ESP-PPQ .espdl models from ONNX or PyTorch, 8-bit, 16-bit or mixed ESP-DL guide
Hosted flow to a deployable library Edge Impulse C++ library, int8 or float32 builds, latency, RAM and flash estimates Edge Impulse
Comparing boards fairly MLPerf Inference: Tiny Five tasks with accuracy targets, latency and energy rules MLCommons

Common mistakes

  • Training on a public dataset and deploying next to a sensor with a different noise, gain and sample rate.
  • Calibrating quantisation with a handful of samples, or with data that misses the edge cases.
  • Checking accuracy with the float model on the host and never with the int8 model on the board.
  • Sizing the tensor arena by guesswork, then losing RAM the radio stack needed.
  • Timing only the inference and forgetting pre-processing, which can dominate for audio and vibration.
  • Quoting speed without the clock, voltage and kernel library used.

Going deeper

What this page adds: Cross-vendor map of LiteRT, CMSIS-NN, ESP-DL and Edge Impulse, with the 2026 LiteRT quantiser migration trap and the MLPerf Tiny method for energy per inference.

Sources

  1. LiteRT for Microcontrollers — Google AI Edge
  2. Post-training quantization — Google AI Edge
  3. Migrate from TFLite converter quantization to LiteRT Quantizer — Google AI Edge, 13 October 2026
  4. TensorFlow Lite for Microcontrollers (tflite-micro) repository — TensorFlow
  5. TensorFlow Lite Micro: Embedded Machine Learning on TinyML Systems — arXiv (R. David et al.), v3, 13 March 2021
  6. CMSIS-NN repository — Arm
  7. ESP-DL User Guide, Getting Started — Espressif Systems, v3.3.15
  8. ESP-DL repository — Espressif Systems
  9. Edge Impulse deployment — Edge Impulse
  10. MLPerf Inference: Tiny — MLCommons, v1.4 results
  11. MLPerf Tiny Benchmark — arXiv (C. Banbury et al.), v4, 24 August 2021

Last verified 28 November 2026.

Recent papers

  • TinyML Hits the Memory Wall: A Benchmark of Ten Sub-Watt Edge Devices

    P. Bonazzi, L. Capogrosso, A. Celik, R. Manzo, M. Giordano, S. Ruciński, J. Hungerbuehler, M. Magno · arXiv cs.AR (preprint, not peer-reviewed) · digest

    The authors ran four CNNs and two small vision transformers on ten commercial sub-watt devices, from the Sony IMX500 in-sensor processor and MCUs with a neural processing unit (NPU), such as the STM32N6, Alif Ensemble E7 and GAP9, to MCUs without one, including the ESP32-S3 and a 1 GHz Cortex-M85 part. On every accelerator, latency followed the bytes of weights and activations moved (r ≥ 0.98), not the multiply-accumulate (MAC) count, and no MCU without an NPU behaved this way. The NPU advantage over the 1 GHz Cortex-M85 ranged from 1.4× on MCUNetV1 to 8.2× on SqueezeNet. Energy above idle was 0.13 to 0.35 mJ per inference on the IMX500 against 0.31 to 1.05 mJ on the STM32N6. The result holds for TinyML-scale CNNs at 64 × 64 input, and the authors say larger models and resolutions remain to be tested.

  • Does synthetic pre-training pay off on a microcontroller? Accuracy, latency and energy across two MCUs

    A. Yadav · arXiv cs.LG (preprint, not peer-reviewed) · digest

    The study fine-tuned five image classifiers with and without a synthetic pre-training stage and deployed them at INT8 on an ESP32-S3 and an RP2040. With all the real data the stage gave no detectable gain, and it helped the smallest CNN only when 10% of the real data was used. On the ESP32-S3 the main model took 152.7 ms and 16.3 mJ above idle per inference, against 1.80 s and 27.3 mJ on the RP2040. The ESP32-S3 outputs matched TensorFlow Lite's reference kernels exactly only after the author patched an out-of-bounds write in the ESP-NN 1.3.1 depthwise kernel, and neither the RP2040 build nor the host interpreter reproduced the reference arithmetic. It is a case study with one dataset and one board of each kind.