Skip to main content
QUICK REVIEW

[Paper Review] On-Device Training Under 256KB Memory

Ji Lin, Ligeng Zhu|arXiv (Cornell University)|Jun 30, 2022
Advanced Neural Network ApplicationsComputer Science71 citations
TL;DR

The paper presents a algorithm-system co-design enabling real CNN training on microcontrollers with only 256KB SRAM and 1MB Flash, using Quantization-Aware Scaling, Sparse Update, and a Tiny Training Engine to achieve significant memory and speedups while preserving accuracy.

ABSTRACT

On-device training enables the model to adapt to new data collected from the sensors by fine-tuning a pre-trained model. Users can benefit from customized AI models without having to transfer the data to the cloud, protecting the privacy. However, the training memory consumption is prohibitive for IoT devices that have tiny memory resources. We propose an algorithm-system co-design framework to make on-device training possible with only 256KB of memory. On-device training faces two unique challenges: (1) the quantized graphs of neural networks are hard to optimize due to low bit-precision and the lack of normalization; (2) the limited hardware resource does not allow full back-propagation. To cope with the optimization difficulty, we propose Quantization-Aware Scaling to calibrate the gradient scales and stabilize 8-bit quantized training. To reduce the memory footprint, we propose Sparse Update to skip the gradient computation of less important layers and sub-tensors. The algorithm innovation is implemented by a lightweight training system, Tiny Training Engine, which prunes the backward computation graph to support sparse updates and offload the runtime auto-differentiation to compile time. Our framework is the first solution to enable tiny on-device training of convolutional neural networks under 256KB SRAM and 1MB Flash without auxiliary memory, using less than 1/1000 of the memory of PyTorch and TensorFlow while matching the accuracy on tinyML application VWW. Our study enables IoT devices not only to perform inference but also to continuously adapt to new data for on-device lifelong learning. A video demo can be found here: https://youtu.be/0pUFZYdoMY8.

Motivation & Objective

  • Enable on-device training on ultra-tiny edge devices with strict memory budgets (256KB SRAM).
  • Develop quantization-aware optimization to stabilize 8-bit training without extra memory.
  • Reduce memory footprint via sparse gradient updates and automated update schemes.
  • Architect a lightweight compiler-based training system to prune and reorder backward graphs for efficiency.
  • Demonstrate deployment on real hardware and show accuracy competitive with cloud training for tinyML tasks.

Proposed method

  • Real quantized graphs are updated directly (int8 forward/backward) to fit tight memory budgets.
  • Quantization-Aware Scaling (QAS) automatically scales gradients to stabilize 8-bit training without extra memory.
  • Sparse Update selectively updates layers/tensors based on contribution analysis to meet memory constraints.
  • Automated contribution analysis selects which biases/weights to update and at what granularity.
  • Tiny Training Engine (TTE) uses code generation to compile static backward graphs, prune unused nodes, and enable in-place updates and operator fusion.
  • Graph pruning and operator reordering reduce peak memory and accelerate training on microcontrollers.

Experimental results

Research questions

  • RQ1Can on-device training be made feasible on devices with 256KB SRAM and 1MB Flash for CNNs?
  • RQ2Does QAS close the accuracy gap between int8 training and floating-point training without additional memory cost?
  • RQ3Can sparse update and compile-time graph optimizations meet strict memory budgets while maintaining transfer learning performance?

Key findings

  • Memory footprint is reduced more than 1000x compared to PyTorch/TensorFlow, enabling training on 256KB SRAM and 1MB Flash.
  • QAS enables fully quantized training in int8 that matches floating-point training accuracy across multiple datasets.
  • Sparse update combined with contribution analysis achieves higher downstream accuracy at much lower memory than updating all layers.
  • TTE graph generation and pruning achieve 7-9x memory savings, plus 20-21x peak memory reduction with operator reordering.
  • On-device training on a Cortex M7 MCU (STM32F746) achieves competitive accuracy (e.g., 89.1% top-1 on VWW) and significantly faster per-iteration performance (23-25x faster than full TF-Lite Micro style updates).
  • The framework enables lifelong on-device learning and privacy-preserving personalization for tinyML applications.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.