[Paper Review] Enabling Large Neural Networks on Tiny Microcontrollers with Swapping
This paper proposes SwapNN, a system-level solution enabling microcontrollers (MCUs) to run large neural networks (NNs) far exceeding their on-chip SRAM by dynamically swapping data tiles between SRAM and external flash memory. By exploiting IO/compute parallelism and leveraging MCU hardware features, the approach achieves full-accuracy inference with negligible performance, energy, or security overhead, enabling MCUs to run models up to 1000× larger than their SRAM size.
Running neural networks (NNs) on microcontroller units (MCUs) is becoming increasingly important, but is very difficult due to the tiny SRAM size of MCU. Prior work proposes many algorithm-level techniques to reduce NN memory footprints, but all at the cost of sacrificing accuracy and generality, which disqualifies MCUs for many important use cases. We investigate a system solution for MCUs to execute NNs out of core: dynamically swapping NN data chunks between an MCU's tiny SRAM and its large, low-cost external flash. Out-of-core NNs on MCUs raise multiple concerns: execution slowdown, storage wear out, energy consumption, and data security. We present a study showing that none is a showstopper; the key benefit -- MCUs being able to run large NNs with full accuracy and generality -- triumphs the overheads. Our findings suggest that MCUs can play a much greater role in edge intelligence.
Motivation & Objective
- Address the critical challenge of running large, high-accuracy neural networks on memory-constrained microcontrollers (MCUs) with only tens to hundreds of KB of SRAM.
- Overcome the limitations of existing model compression and quantization techniques that sacrifice accuracy and generality to fit models into MCU memory.
- Demonstrate that out-of-core execution—dynamically swapping NN layers between SRAM and external flash—is feasible on MCUs despite concerns about IO overhead, wear, energy, and security.
- Develop a scheduler (SwapNN) that efficiently overlaps I/O and computation to minimize performance degradation and maximize hardware utilization.
- Establish that MCUs can now run large, unmodified NNs with full accuracy and generality, expanding their role in edge intelligence.
Proposed method
- Design a tile-based out-of-core execution model where each NN layer is split into small, manageable data chunks (tiles) that fit in MCU SRAM.
- Implement a parallel scheduler (SwapNN) that overlaps I/O operations (loading/storing tiles) with computation across multiple granularities: within a layer (tile-level), across layers (layer-level), and across data frames (pipeline-level).
- Leverage the fact that most NN layers (especially convolutions) are compute-bound, so I/O delays are naturally hidden by longer computation times.
- Use hardware-accelerated encryption (e.g., AES) and hash-based integrity checks to secure out-of-core data, ensuring confidentiality and detectability of silent data corruption.
- Utilize MCU-level hardware features such as DMA, crypto accelerators, and over-provisioned SD card durability to reduce energy and wear concerns.
- Integrate with existing inference frameworks (e.g., TensorFlow Lite Micro, CMSIS-NN) as a transparent extension to support large models without modifying the NN architecture.
Experimental results
Research questions
- RQ1Can out-of-core neural network inference be made practical on microcontrollers despite their limited SRAM and reliance on slow external flash storage?
- RQ2Does the I/O overhead from swapping between SRAM and external flash significantly slow down inference, or can it be hidden through effective task scheduling?
- RQ3What is the impact of frequent I/O operations on SD card durability, and can it be mitigated using hardware over-provisioning and intermittent access patterns?
- RQ4Does adding I/O operations significantly increase energy consumption on an already busy MCU, and can this be minimized?
- RQ5Can data security and integrity be preserved when neural network weights and feature maps are stored off-chip on untrusted storage like SD cards?
Key findings
- Out-of-core inference with swapping is feasible on MCUs: the system can execute large neural networks (e.g., VGG16, MobileNet, AlexNet) with up to 340 KB of SRAM, supporting models up to 1000× larger than available SRAM.
- IO overhead is minimal because most layers (especially convolutions) are compute-bound; I/O delays are naturally hidden by longer computation times, especially on low-clock-speed MCUs.
- SD card wear is not a concern due to intermittent I/O access patterns—IO is only active between compute-bound layers—combined with hardware over-provisioning, enabling over 10 years of write endurance even under heavy use.
- Energy overhead from I/O is marginal because the MCU is already in a high-power state during computation; activating the SD card adds only a small incremental energy cost.
- Data security is achievable with hardware-accelerated encryption and integrity checking (e.g., AES, SHA), with negligible performance impact—comparable to the slowest NN operations.
- The system achieves full model accuracy and generality, unlike compression-based approaches that trade accuracy for memory savings, thus enabling new use cases such as transfer learning and model profiling on-device.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.