EfficientML.ai Lecture 10 - MCUNet and TinyML (MIT 6.5940 Fall 2026)
Overview
MCUNet brings useful deep learning to microcontrollers with roughly 256 to 320 KB of SRAM and 1 MB of flash, where both peak activation memory and model weights must fit. The lecture explains how TinyNAS and TinyEngine co-design models and inference, and how MCUNetV2 uses patch-based inference and receptive-field-aware architectures to enable low-memory vision, keyword spotting, and anomaly detection.
Key takeaways
- Microcontroller deployment has two separate hard limits: peak activation memory must fit in SRAM, while model weights and program code must fit in flash; a model that satisfies only one limit still cannot run.
- TinyNAS searches architecture choices against the target MCU's actual SRAM and flash budgets, then uses weight sharing so one supernetwork can provide subnetworks for multiple device sizes.
- Patch-based inference reduces peak SRAM by processing feature-map regions through early layers, but overlapping halos are necessary to preserve convolution results and can create substantial redundant computation.
- MCUNetV2 reduces patch overhead by limiting receptive-field growth in early layers and shifting more spatial convolution to later layers, when feature maps are smaller.
- The lecture reports that MCUNetV2 uses about four times less SRAM than first-generation MCUNet at around 90% accuracy, while enabling higher-resolution inputs such as 160×160 in an example configuration.
- Local TinyML enables always-on applications such as Visual Wake Words, keyword spotting, and fan anomaly detection without continuously sending sensor or microphone data to the cloud.
Chapters
- TinyML targets low energy, low latency, low cost, and improved privacy by running inference on microcontrollers instead of sending data to cloud servers.
- A typical microcontroller may have only hundreds of kilobytes of memory and is far more constrained than a smartphone with gigabytes of memory.
- Always-on sensing can support smart homes, manufacturing inspection, personalized healthcare, and precision agriculture, including battery-powered devices.
- The lecture contrasts cloud and mobile hardware with a typical microcontroller budget of about 300 KB of SRAM and 1 MB of flash.
- Input and output activations occupy SRAM during inference, while fixed convolution weights are stored in flash.
- A model must fit both the peak SRAM requirement and its static flash footprint; a small parameter count alone does not guarantee deployment feasibility.
- MobileNetV2 can have fewer parameters than ResNet-18 yet still use more peak activation memory, showing that mobile optimization does not automatically suit MCUs.
- MCUNet co-designs the neural architecture and inference engine rather than optimizing only the model or only the software runtime.
- The framework pairs TinyNAS, which searches for architectures that fit a target MCU, with TinyEngine, which compiles and executes the selected model.
- Architecture and runtime inform one another, allowing the design to account for real hardware limits and the operators used by the resulting network.
- Mobile-oriented neural architecture search spaces do not transfer directly to MCUs because microcontrollers have orders of magnitude less memory.
- TinyNAS uses a two-stage procedure: first select broad scaling choices such as input resolution and width multiplier, then search kernels, expansion ratios, and block counts.
- The search space is chosen for each hardware budget, balancing SRAM for activations against flash for weights.
- Under a fixed memory limit, a better search space can allocate more FLOPs to the model and improve the chance of higher accuracy.
- TinyNAS uses one-shot neural architecture search with weight sharing: a trained supernetwork contains nested subnetworks that can be selected for different device budgets.
- A single supernetwork training process can yield smaller subnetworks for tighter MCUs and larger ones for devices with more memory.
- Compared with MobileNetV2, TinyNAS distributes activation memory more uniformly across layers, reducing the gap between average and peak usage.
- On Visual Wake Words, MCUNet achieves a stronger accuracy and efficiency trade-off, with lower peak SRAM and latency than earlier manually designed and NAS models.
- Peak activation memory, not average memory across layers, determines whether a network can run on an MCU.
- Patch-based inference divides a large feature map into smaller regions and propagates each patch through several early layers before processing the next.
- Processing smaller input and output regions can reduce peak activation memory substantially, with an example showing roughly a fourfold reduction.
- Patch size can be selected to meet a target such as a 256 KB SRAM limit, enabling models that would not fit with ordinary per-layer inference.
- Convolution outputs near patch boundaries need neighboring input values, so patches must overlap to preserve the original network's results.
- The required overlap, called the halo, grows with the receptive field across layers and causes redundant computation between patches.
- For stacked 3×3 convolutions, the halo expands at each layer, potentially making duplicated work large relative to the useful patch area.
- Patch inference can add scheduling and computation overhead, but its main benefit is making otherwise infeasible networks fit within MCU SRAM.
- MCUNetV2 limits spatial convolution in early layers so patch halos do not grow rapidly while feature maps are large.
- It uses smaller or fewer spatial convolutions early, including 1×1 depthwise operations, then adds spatial convolutions later when feature maps are smaller.
- This redistribution preserves receptive-field capacity while reducing redundant patch computation.
- The search jointly selects architecture choices such as depth, width, and kernel size, plus scheduling choices such as patch count and which early layers use patch inference.
- At around 90% accuracy, MCUNetV2 uses about four times less SRAM than the first-generation MCUNet, according to the lecture's comparison.
- Reported gains extend beyond Visual Wake Words to ImageNet classification and PASCAL VOC object detection under constrained MCU memory.
- The searched architecture uses patch inference in early layers with large feature maps, then returns to ordinary layer execution after downsampling.
- Small expansion ratios in middle layers limit SRAM peaks, while later layers can use wider expansions because their feature maps are smaller.
- Patch-based memory savings allow a 160×160 input in an example configuration, compared with 128×128 for an earlier MobileNetV1 setup.
- MCUNet demonstrates ImageNet-scale classification on commercial microcontrollers, with reported top-1 accuracy above 70%.
- Once-for-all training supports subnetworks tailored to devices with different SRAM and flash limits.
- Visual Wake Words detects whether a person is present, enabling an always-on local trigger without continuously running a more expensive face-recognition model.
- For object detection, patch inference supports higher input resolution, which helps recover missed people and reduce false detections compared with lower-resolution inputs.
- A demonstration also shows on-device fine-tuning for distinguishing objects such as bananas and oranges.
- TinyML audio workloads include keyword spotting, speech recognition, and noise cancellation, where local processing avoids continuously uploading microphone data.
- A keyword-spotting pipeline divides audio into overlapping frames and converts them into frequency-domain features for a neural network.
- Convolutional networks exploit local patterns across neighboring time frames and frequencies, handling small shifts in speaking style better than a fully connected network at a similar compute budget.
- MCUNet applies hardware-aware search to speech commands to find accuracy, latency, and model-size trade-offs suited to microcontrollers.
- An autoencoder compresses an input into a latent code and reconstructs it; training on normal examples makes unusual inputs more likely to produce large reconstruction errors.
- This approach can be trained without labeled anomaly examples, which are often harder to collect than normal data.
- Potential applications include manufacturing inspection, health monitoring, and fraud or attack detection.
- A fan-monitoring demonstration raises a warning when the fan is obstructed or shaken and clears it when operation returns to normal.
- The lecture concludes that MCUNet and MCUNetV2 combine memory-aware design and patch-based inference to bring vision, audio, and anomaly detection directly to microcontrollers.
Transcript excerpt
0:01 Uh okay everyone uh let's started today's lecture. Uh so today we are going to talk about uh uh lecture 10 mcet and tiny ml. So we will go through a very detailed example on how do we uh do the model compression deployment for a very tiny scale model on microcontrollers and we will apply all the techniques that we have been discussing in the uh previous lectures such as qualization pruning uh neuro architecture search and distillation. Uh so this is uh today's lecture plan. So we will first discuss what is tiny ML and we will talk about the challenges and difficulties in tiny ML like how do we compress a model how do we fit that
0:50 into microcontrollers and we also talk about the neuron neural network design with some neuro architecture neuro arctexture search techniques and finally we will talk about some applications of tiny for examples vision applications audio applications and some uh for example anom anomaly detection. So let's begin with a very simple question. Uh what is tiny ML and why do we want to run our deep learning networks on very small micro tiny controllers? So uh as we can see in this figure um today's AI system can be extremely large and very expensive. So you uh we have uh discussed this figure I guess in uh the first lecture. So we can see that the
1:38 models parameters be become larger and larger nowadays while the GPUs also becomes larger but they are still a much smaller sense nowadays frontier models. So even with uh GP3 like three years uh that is um that is released on 2021. So it already has 175 billion parameters and it requires roughly more than 300 GPU years of training uh with an estimated
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, MIT HAN Lab.