What TinyML is
Tiny machine learning (TinyML) is the practice of running machine learning inference on microcontrollers and other ultra-low-power devices, so that sensors can interpret data where it is collected instead of sending everything to the cloud. It is a field of research and engineering rather than a single framework: several software frameworks, model design methods and hardware platforms contribute to it (Banbury et al., 2021a; Banbury et al., 2021c).
The appeal is practical. A device that recognises a spoken keyword, detects a person in view or flags an unusual machine sound locally can respond quickly, work without a network connection, keep raw data on the device and run for long periods on a small battery. The difficulty is equally practical: the devices are far smaller than the phones and servers on which most machine learning is developed.
Banbury et al. (2021a) summarise the scale of the constraint. TinyML systems typically have a few hundred kilobytes of memory and processors clocked in megahertz, resources about two orders of magnitude smaller than a smartphone, and power budgets up to four orders of magnitude smaller than conventional systems, often below a milliwatt. Almost every methodological choice in TinyML research follows from these limits.
An important clarification for new researchers: in most current TinyML work, models are trained on an ordinary computer or in the cloud and only inference runs on the microcontroller. On-device training is an active but much less mature research area.
Machine learning foundations you need
A common definition says a program learns when its performance at a task improves with experience. In TinyML terms, the task might be classifying one-second audio clips, the experience is a labelled or unlabelled dataset, and performance is a measure of how well the task is done, such as accuracy or the area under the ROC curve. Resource cost (memory, latency and energy) is a separate set of measures that TinyML adds on top, and good studies report both (Banbury et al., 2021c).
| Supervised learning | Unsupervised learning | |
|---|---|---|
| Data | Labelled examples of inputs and the correct outputs | Unlabelled data; the model finds structure itself |
| Typical TinyML task | Keyword spotting, person detection, image classification | Anomaly detection in machine sounds or vibration |
| Example benchmark data | Speech Commands (Warden, 2018); Visual Wake Words (Chowdhery et al., 2019) | ToyADMOS machine-operating sounds (Koizumi et al., 2019) |
| Main risk | Labels that are noisy or unrepresentative of the deployment setting | Normal behaviour in training that differs from normal behaviour in the field |
Anomaly detection shows why unsupervised methods matter on small devices. Faults are rare, so it is often easier to train a compact autoencoder on normal operating data and treat inputs it reconstructs poorly as possible anomalies; the MLPerf Tiny anomaly detection task uses a small fully connected autoencoder in this role (Banbury et al., 2021c).
From data to device: the TinyML workflow
- 1Collect and label sensor data
- 2Train a compact model
- 3Validate and tune
- 4Quantise and convert
- 5Deploy as firmware
- 6Measure accuracy, latency, energy and memory
1. Data collection
Collect data with the same sensor, sampling rate and placement that the deployed device will use. A model trained on studio-quality audio may fail on a cheap microphone in a noisy room. Record how data were labelled and cleaned, and keep a held-out test set that reflects deployment conditions.
2. Model training
Models are usually trained in standard frameworks such as TensorFlow, Keras or PyTorch. Architectures are chosen with the target memory in mind: depthwise separable convolutions, as in MobileNets (Howard et al., 2017) and the DS-CNN keyword spotting models of Zhang et al. (2017), reduce computation and parameter counts substantially compared with standard convolutions.
3. Optimisation and model search
Hyperparameter tuning trades accuracy against size and latency. Neural architecture search can be constrained directly by microcontroller memory, as in SpArSe (Fedorov et al., 2019) and MicroNets (Banbury et al., 2021b), which search for networks that fit the flash and RAM of commodity microcontrollers.
4. Quantisation and conversion
Most models are trained with 32-bit floating-point numbers. Integer quantisation maps weights and activations to 8-bit integers, with biases held as 32-bit integers, using an affine mapping between real values and integers defined by a scale and a zero-point (Jacob et al., 2018). Because each weight then needs one byte instead of four, weight storage falls by roughly a factor of four, and integer arithmetic suits microcontrollers that lack fast floating-point units. Quantisation can be applied after training or simulated during training (quantisation-aware training), which usually limits the accuracy loss; Jacob et al. (2018) reported, for example, ResNet-50 ImageNet accuracy of 74.9% after 8-bit quantisation against 76.4% in floating point. Eight-bit integers were the most common numerical format among MLPerf Tiny submissions (Banbury et al., 2021c).
The quantised model is then converted to a format the device runtime can read. TensorFlow Lite Micro, for instance, runs converted TensorFlow Lite models through a small interpreter designed for devices without an operating system (David et al., 2020). Code generation and hand-written kernels are the main alternatives, and the choice affects portability and reproducibility (Banbury et al., 2021a).
5. Deployment and monitoring
The model is compiled into firmware with the code that reads the sensor and acts on predictions. Measure accuracy on the device as well as in simulation: quantisation, input pre-processing and real sensor noise can all change results.
Benchmarks: how TinyML systems are compared
Comparing TinyML systems is hard because hardware, software stacks and measurement methods vary widely (Banbury et al., 2021a). MLPerf Tiny, developed by more than 50 organisations from industry and academia, is the first industry-standard benchmark suite for these systems. It measures accuracy, latency and energy on four tasks with fixed reference models and quality targets (Banbury et al., 2021c).
| Task | Dataset | Reference model (size) | Quality target |
|---|---|---|---|
| Keyword spotting | Speech Commands (Warden, 2018) | DS-CNN (52.5 KB) | 90% top-1 accuracy |
| Visual wake words | Visual Wake Words (Chowdhery et al., 2019) | MobileNetV1 (325 KB) | 80% top-1 accuracy |
| Image classification | CIFAR-10 (Krizhevsky et al., 2009) | ResNet (96 KB) | 85% top-1 accuracy |
| Anomaly detection | ToyADMOS (Koizumi et al., 2019) | Fully connected autoencoder (270 KB) | 0.85 AUC |
For doctoral work, the benchmark is useful in two ways. It gives you recognised baselines to compare against, and it models good reporting practice: a stated quality target, a fixed dataset, a reference model and a defined measurement method. The image classification model is a small residual network in the tradition of He et al. (2016), scaled down to fit microcontroller memory.
Applications and research directions
| Application area | Example task | Research questions it raises |
|---|---|---|
| Smart sensors in buildings | Detecting whether a person is present from a low-resolution camera | How small can a person detector be before accuracy falls below a useful level? |
| Wearables and health monitoring | Recognising a spoken keyword or a movement pattern | How well do models trained on public data transfer to new users and devices? |
| Industrial monitoring | Flagging unusual machine sounds or vibration | How should anomaly thresholds adapt as machines age? |
| Agriculture and environment | Classifying sounds or images in the field on battery power | How do energy budgets limit sampling rate and model size over a season? |
Several open problems run across these areas. Energy measurement at sub-milliwatt levels is itself difficult, and fair comparison across heterogeneous hardware and software stacks remains unsettled (Banbury et al., 2021a). Designing models jointly with the memory limits of specific devices is an active line of work (Fedorov et al., 2019; Banbury et al., 2021b). On-device learning, privacy and robustness to changing field conditions are less mature. For a fuller treatment of open gaps and recent literature, see our TinyML future research directions brief.
When choosing a doctoral topic, start from the application constraint rather than the technique. A question such as "Can a keyword spotter run for a year on a coin cell while staying above a stated accuracy?" defines the task, the quality threshold and the resource budget at once, and it tells you which measurements will settle the answer. A question such as "Can deep learning be used on microcontrollers?" has already been answered by the benchmark literature (Banbury et al., 2021c). Contributions at doctoral level typically come from one of three places: a new model or compression method that improves the accuracy and resource trade-off on recognised tasks, a careful study of a real deployment setting that the public benchmarks do not represent, or better methods for measuring and comparing systems. Each needs a clear baseline, and each needs results measured on real hardware rather than estimated from model size alone.
Worked example: framing a doctoral TinyML study
The following example is illustrative. A doctoral researcher wants to detect bearing faults in small pumps using a vibration sensor and a low-cost microcontroller, without a network connection.
- Question. How accurately can an 8-bit quantised autoencoder running on a microcontroller detect early bearing faults, and at what energy cost per inference?
- Baseline. Use the MLPerf Tiny anomaly detection reference model as a starting architecture and compare it with a smaller variant found by constrained search (Banbury et al., 2021c; Banbury et al., 2021b).
- Data. Record normal operation on several pumps and a smaller set of seeded faults for testing only.
- Measurement. Report AUC on device, latency, energy per inference, flash and RAM use, and the measurement set-up, following the benchmark's practice.
- Threats to validity. Test on pumps not seen in training, and report how results change after quantisation.
| What to report | Why it matters |
|---|---|
| Hardware: microcontroller, clock speed, flash and RAM | Results do not transfer across devices without it |
| Software stack: framework, runtime and version | Interpreters, code generators and hand-written kernels differ |
| Numerical format: float32, int8 or other; post-training or quantisation-aware | Explains accuracy changes |
| Task quality: accuracy, AUC or F1 on a held-out set measured on the device | Shows the model still works |
| Latency and energy per inference, with the measurement method | Energy is the core TinyML constraint |
| Data: source, sensor, sampling rate, split and labelling | Allows replication and judging transferability |
Common mistakes
- Reporting accuracy only. Without latency, energy and memory, a TinyML result cannot be judged (Banbury et al., 2021c).
- Measuring only in simulation. On-device results can differ after quantisation and with real sensor input.
- Misdescribing quantisation. The usual step is from 32-bit floating point to 8-bit integers, not from 64-bit; state which values are quantised and how (Jacob et al., 2018).
- Ignoring the software stack. The same model can perform differently under different runtimes (Banbury et al., 2021a; David et al., 2020).
- Training on unrepresentative data. Public datasets are a starting point; deployment data from your own sensors are needed to test transfer.
Key takeaways
- TinyML works within memory and power budgets orders of magnitude smaller than phones or servers (Banbury et al., 2021a).
- Integer quantisation from 32-bit floating point to 8-bit integers cuts weight storage about fourfold and suits microcontroller arithmetic (Jacob et al., 2018).
- MLPerf Tiny offers four recognised tasks, datasets and reference models to benchmark against (Banbury et al., 2021c).
- Report hardware, software stack, numerical format, on-device quality, latency and energy together (Banbury et al., 2021c; David et al., 2020).
- Architecture search constrained by device memory is an active route to smaller, accurate models (Banbury et al., 2021b).
