NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Memory-efficient Patch-based Inference for Tiny Deep Learning

Ji Lin, Wei-Ming Chen, Han Cai, Chuang Gan, Song Han

Introduction

Microcontroller units (MCUs) are the backbone of the Internet of Things (IoT), but their extremely limited SRAM (often under 512kB) makes deploying deep learning models a significant challenge. Traditionally, fitting a model onto an MCU required aggressively pruning the network or shrinking the input resolution. MCUNetV2 breaks this memory bottleneck by introducing a patch-based inference strategy that processes small spatial regions of an image instead of entire layers at once. By co-designing the neural architecture with this execution schedule, researchers achieved record-breaking ImageNet accuracy on microcontrollers and enabled complex tasks like object detection within tiny SRAM budgets.

The Bottleneck: Imbalanced Memory Distribution

The authors identify a specific structural problem in standard Convolutional Neural Network (CNN) designs: imbalanced memory distribution.

Memory usage comparison showing the front-heavy bottleneck and the impact of per-patch inference.

As shown above, the first few layers of a network consume an order of magnitude more memory than the rest because they operate on high-resolution input images with large feature maps. This "front-heavy" memory usage forces developers to use tiny input resolutions (e.g., <224x224). While simple image classification is somewhat robust to low resolutions, performance plummets for "dense" tasks like object detection when the resolution is reduced.

Methods: Bypassing the Peak

To solve this memory bottleneck, the paper introduces three key innovations:

1. Patch-based Inference Instead of the standard layer-by-layer execution—which requires storing the entire feature map of a layer in SRAM—MCUNetV2 processes the initial, memory-intensive layers patch-by-patch. By only holding a small spatial region in memory at any given time, peak SRAM usage is slashed by 4-8x.

2. Receptive Field Redistribution Naive patch-based inference is inefficient. Because convolutional filters have a "receptive field" (they look at neighboring pixels), patches must overlap to produce valid outputs. Large overlaps mean redundant computations.

Receptive field redistribution shifts heavy computation to later stages to minimize patch overlap overhead.

To mitigate this, the authors propose shifting the "heavy lifting" (large kernels and high FLOPs) to the later stages of the network where the resolution is lower. This minimizes the overlap overhead in the early, patch-processed layers.

3. Joint Neural Architecture Search (NAS) Manually balancing the neural architecture and patching schedules is nearly impossible. The authors utilized an evolutionary search algorithm to jointly optimize the network's hyperparameters (kernel sizes, expansion ratios, etc.) and the inference schedule (number of patches and which blocks to run patch-wise).

Key Results and Insights

By bypassing the peak memory rather than just compressing the whole model, MCUNetV2 frees up enough SRAM to process higher-resolution inputs. This is the "secret sauce" that enables dense vision tasks on $5 hardware.

Evaluated across standard benchmarks (ImageNet, Visual Wake Words, Pascal VOC, and WIDER FACE), MCUNetV2 demonstrated remarkable versatility and efficiency:

  • SRAM Efficiency: Reduced peak memory usage of existing networks by 4-8x.
  • Classification Records: Achieved 71.8% ImageNet accuracy on a commercial MCU, setting a new record.
  • Extreme TinyML: Achieved >90% accuracy on the Visual Wake Words dataset using only 32kB of SRAM—4x less memory than the previous state-of-the-art (MCUNetV1).
  • Object Detection Breakthrough: Achieved a 16.9% higher mAP (mean Average Precision) on Pascal VOC compared to previous MCU-based solutions, making real-time person detection on microcontrollers a reality.

Limitations and Future Work

While groundbreaking, patch-based inference requires specialized software support. The authors implemented this in their custom "TinyEngine," but it is not yet a standard feature in common frameworks like TensorFlow Lite Micro. Furthermore, despite Receptive Field Redistribution reducing the computation overhead to roughly 3%, patch-based inference still involves some redundant calculations compared to theoretical layer-by-layer execution. Future work exploring lower-bit precisions (like int4) or mixed-precision quantization could further push the boundaries of what these tiny chips can accomplish.

Summary updated

BibTeX
@inproceedings{lin2021memory,
  author = {Ji Lin and Wei-Ming Chen and Han Cai and Chuang Gan and Song Han},
  title = {{Memory-efficient Patch-based Inference for Tiny Deep Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=C1mPUP7uKNp},
}
Figure