1. Introduction

A typical microcontroller offers a single low-frequency core, a few hundred kilobytes of static memory at best, a megabyte or so of flash, and no memory management unit. Deep learning grew up on hardware many orders of magnitude larger. The work that closed part of this distance was reviewed for larger embedded processors by Sze et al. (2017), and the microcontroller case was brought to a wide engineering audience by Warden and Situnayake (2019), whose book also popularised the name TinyML.

The motivation is practical. Inference at the sensor avoids sending raw audio, images or vibration data over a radio, which saves energy and bandwidth and keeps the data on the device. It also lets a product respond without a network connection. Keyword spotting, the task of recognising a small spoken vocabulary, was the early demonstration that useful neural networks fit in this class of device (Zhang et al., 2017), and it remains a reference workload together with visual wake words, small image classification and anomaly detection.

Fitting a model into a microcontroller is a joint problem in machine learning and embedded software. The network must be made small, and the code that runs it must waste nothing. This review treats the two halves in turn, compression first and toolchains second, and then considers how they interact and what remains unsolved.

2. Scope and Approach

The article is a narrative review. It is built around the papers that introduced the main techniques and the tools that are in common use, as judged from their adoption in the field and in the community benchmark. It was not compiled through a systematic database search and does not attempt to list every proposal. Hardware accelerators and neuromorphic devices are outside its scope; the focus is the general-purpose 32-bit microcontroller, of which the Arm Cortex-M family is the usual example.

3. The Resource Constraints That Shape the Problem

Three budgets matter. Flash holds the weights and the code, so parameter count and numeric precision determine whether the model can be stored. Static memory holds the activations, the intermediate tensors passed between layers, and the requirement is set by the largest set of tensors that must be alive at once. Latency and energy follow from the number of arithmetic operations and from how well the kernels use the processor. Of the three, activation memory is usually the hardest. A convolutional network for images has its largest feature maps in the first layers, and a design that looks small by parameter count can still exceed the available memory many times over. Lin et al. (2020) make this point forcefully and design their system around the peak memory figure.

4. Model Compression Techniques

Compression methods are complementary and are normally combined. Table 1 summarises the main families, what each reduces and what it demands of the deployment software.

Table 1: Principal model compression techniques and their implications for microcontroller deployment
TechniqueWhat it reducesRequirement on the runtimeRepresentative source
Efficient architectureOperations and parametersOptimised depthwise and pointwise kernelsHoward et al., 2017
Unstructured pruningNon-zero weightsSparse storage and sparse kernels to realise any gainHan et al., 2015
Structured pruningFilters and channelsNone; the result is a smaller dense networkLi et al., 2017
Integer quantisationBits per weight and activationInteger-only kernels with fixed-point scalingJacob et al., 2018
BinarisationPrecision to one bitBitwise kernels; careful first and last layersCourbariaux et al., 2016
Knowledge distillationAccuracy lost by a small modelNone; affects training onlyHinton et al., 2015
Constrained architecture searchPeak memory and latencyAccurate memory and latency model of the targetLin et al., 2020

4.1. Efficient architectures

The cheapest operation is the one never performed, and the largest savings come from choosing a frugal architecture before any compression is applied. MobileNet replaced the standard convolution with a depthwise convolution followed by a pointwise one, cutting both operations and parameters, and exposed width and resolution multipliers that scale the network down smoothly (Howard et al., 2017). MobileNetV2 added inverted residual blocks with linear bottlenecks (Sandler et al., 2018). The depthwise separable networks that performed best in the keyword spotting study of Zhang et al. (2017) follow the same pattern, and most microcontroller vision and audio models today descend from these designs.

4.2. Pruning

Pruning removes parameters that contribute little. The idea predates deep learning: optimal brain damage used second-derivative information to select weights for deletion (LeCun et al., 1990). Han et al. (2015) showed that simple magnitude pruning followed by retraining removes a large share of the weights of modern networks with little loss of accuracy, and the lottery ticket hypothesis of Frankle and Carbin (2019) gave the observation a theoretical framing. On a microcontroller the distinction between unstructured and structured pruning is decisive. Unstructured pruning leaves a sparse matrix whose storage needs indices and whose multiplication needs irregular memory access, so the saving in flash is partial and the saving in time is often nil on a processor without sparse support. Structured pruning deletes whole filters or channels (Li et al., 2017) and yields a smaller dense network that any runtime executes faster. A critical survey by Blalock et al. (2020) also cautions that pruning results are hard to compare across papers because baselines and metrics differ.

4.3. Quantisation

Quantisation stores weights and activations at reduced precision. Moving from 32-bit floating point to 8-bit integers cuts model size by a factor of four and, as important, allows inference with integer arithmetic alone, which suits cores that lack a floating-point unit. The affine scheme of Jacob et al. (2018), in which a real value is represented by an integer, a scale and a zero point, is the basis of the formats used by the mainstream tools. Quantisation can be applied after training using a small calibration set, or simulated during training so that the network adapts to it; Krishnamoorthi (2018) sets out the practical trade-offs, and Gholami et al. (2021) survey the wider literature. Below eight bits, accuracy becomes harder to hold. Binarised networks constrain weights and activations to two values (Courbariaux et al., 2016) and replace multiplication with bitwise operations, at a cost in accuracy that has limited their use to simple tasks.

4.4. Distillation and combined pipelines

Knowledge distillation trains a small student network to reproduce the softened output distribution of a large teacher, which often recovers accuracy that the student would not reach from labels alone (Hinton et al., 2015). It changes nothing at deployment and combines freely with the other methods. Deep compression chained pruning, weight sharing and entropy coding into a single pipeline (Han et al., 2016) and established the habit of stacking techniques that TinyML work has followed since.

4.5. Architecture search under memory constraints

Manual design gives way to automated search once the constraint is stated precisely. SpArSe searched jointly over architecture and pruning for networks that fit microcontroller memory (Fedorov et al., 2019). MCUNet coupled a search over a space tailored to the memory limit with an inference engine tuned for the resulting models (Lin et al., 2020), and MicroNets used differentiable search with operation count as a proxy for latency on Cortex-M devices (Banbury et al., 2021a). The shared lesson is that the search must optimise the quantities the hardware imposes, peak memory above all, and not parameter count.

5. Deployment Toolchains

A trained and compressed model still has to become firmware. Figure 1 shows the usual sequence, from choice of architecture to profiling on the target, with the return path that is taken when the device budget is missed.

Figure 1: Typical pipeline from model design to profiled firmware on a microcontroller

5.1. Interpreters and kernel libraries

TensorFlow Lite for Microcontrollers is the most widely used runtime. It is an interpreter that reads a serialised model, plans tensor memory in a single arena supplied by the application, and dispatches each operator to a kernel. Its design avoids dynamic allocation and operating system dependencies so that it builds for bare-metal targets (David et al., 2021). Interpretation adds a small fixed overhead; most of the execution time is spent in the kernels. On Arm cores those kernels are commonly provided by CMSIS-NN, a library of fixed-point convolution, pooling and activation routines that use the processor's DSP extensions where present (Lai et al., 2018).

5.2. Compilers and code generators

The alternative to interpretation is compilation of the model into code specialised for it. TVM introduced a compiler stack with a tensor-level intermediate representation and automated tuning of operator implementations for a given target (Chen et al., 2018), and its microcontroller support emits C that links without a runtime interpreter. Silicon vendors provide generators of their own that take a quantised model and produce a C library for their parts. Code generation removes the interpreter and allows optimisations across layers, such as the in-place depthwise convolution used in MCUNet's engine. The price is a less transparent build and tighter coupling between model and firmware.

5.3. Benchmarks

Comparing results was difficult while every paper used its own model, dataset and board. The MLPerf Tiny suite defines four tasks, keyword spotting, visual wake words, image classification and anomaly detection, with reference models and rules for reporting latency, accuracy and energy (Banbury et al., 2021b). The keyword spotting task uses the Speech Commands dataset (Warden, 2018). The suite has given toolchain developers a common yardstick, though its workloads are small and do not cover every sensing application.

6. How Compression and Toolchain Interact

The two halves of the problem cannot be optimised separately. A compression method pays off only if the runtime has a kernel that exploits it: per-channel quantisation needs kernels that accept a scale for each output channel, a pruned filter saves time only when the converter removes it from the graph, and an operator the runtime does not implement stops deployment altogether. The memory planner matters as much as the kernels. Peak activation memory depends on the order in which operators are executed and on whether buffers are reused in place, so the same model file can fit under one runtime and overflow under another. For this reason careful projects measure on the target early, with a first model that is deliberately too simple, and treat the figures reported by the device as the specification that the next round of design must meet.

7. Gaps and Directions for Future Work

Four gaps stand out in the literature reviewed. Sparse models remain hard to exploit, since the mainstream runtimes execute dense kernels and unstructured sparsity gives little benefit without hardware or kernel support. Learning on the device is at an early stage: training needs gradients and stored activations that inference does not, and work on fitting it into microcontroller memory is recent. Portability is limited, because latency and memory depend on kernel implementations and memory planners that differ between runtimes and processor families, so a model tuned for one target may not fit another. Finally, the effect of compression on robustness is less studied than its effect on average accuracy. A quantised or pruned network can agree with its original on a test set and still differ on unusual inputs, which matters once such models are used in medical, industrial or automotive settings where behaviour must be argued and not only measured.

8. Conclusion

Machine learning on microcontrollers rests on a small set of well-understood ideas. Compact architectures built from depthwise separable convolutions set the starting point, integer quantisation is close to universal, structured pruning and distillation recover margin, and architecture search tuned to peak memory pushes furthest. On the software side an interpreter with optimised kernels serves most projects, with compilation available where every byte and cycle counts. The field's open questions lie less in making models smaller than in making the results portable, adaptable after deployment and trustworthy enough for applications in which a wrong answer has a cost.

Conflict of interest

To be declared by the author(s) before publication.

Funding

To be declared by the author(s) before publication.