YONO: Modeling Multiple Heterogeneous Neural Networks on Microcontrollers

Young D. Kwon, Jagmohan Chauhan, Cecilia Mascolo

Abstract

Microcontrollers (MCUs) are fundamental to the Internet of Things (IoT), yet their constrained memory—typically less than 1MB of Flash and 512KB of RAM—severely limits their ability to run multiple deep learning models simultaneously. Traditional Multi-Task Learning (MTL) often requires shared architectures, which is impractical for diverse tasks like keyword spotting and image classification. This paper introduces YONO (You Only Need One pair of codebooks), a framework that leverages Product Quantization (PQ) to compress multiple heterogeneous neural networks into a single shared set of weight blueprints. YONO achieves an average compression ratio of 12.37× with negligible accuracy loss and reduces model-switching latency by over 93% by enabling on-chip weight reconstruction.

Introduction

The "TinyML" ecosystem faces significant hurdles when implementing multi-tasking on edge devices. These challenges are categorized into three primary areas: heterogeneity, resource constraints, and switching overhead. Most existing solutions either compress models in isolation, failing to exploit cross-model weight patterns, or rely on external storage (e.g., SD cards) for model switching, which introduces significant latency and energy costs. YONO addresses these issues by allowing completely different neural network architectures to coexist and switch instantaneously on a single chip through a shared vocabulary of weights.

Methodology

The core of the YONO framework is built upon Product Quantization (PQ). Rather than storing individual weights, PQ decomposes weight matrices into sub-vectors, which are then represented by indices pointing to a "codebook" of representative vectors.

Shared Codebooks and Spatial Differentiation

Unlike traditional PQ implementations that generate unique codebooks for every layer or model, YONO concatenates the weights of all target models into two primary matrices. A key insight of the research is that spatial information matters; consequently, YONO utilizes exactly two codebooks: one for 3x3 convolutional kernels and another for 1x1 kernels and Fully Connected (FC) layers. This separation is vital for maintaining high reconstruction accuracy across diverse architectures.

Iterative Optimization and Smart Finetuning

YONO employs an Expectation-Maximization (EM) inspired iterative process to optimize the system. After initial quantization, the framework identifies specific layers with the highest "error-per-parameter" using a custom heuristic. Only these high-impact layers undergo finetuning to recover accuracy, keeping the uncompressed portion of the model footprint minimal. The updated weights are then re-assigned to the codebook indices to further refine the representation.

Online Execution

At runtime, the shared codebooks reside in the MCU's read-only eFlash. When a task switch is required, the system reconstructs the specific model weights into SRAM. This approach bypasses the need for slow external memory access, facilitating near-instantaneous transitions between tasks.

Experimental Evaluation

The authors evaluated YONO across a diverse range of modalities and datasets, including:

  • Images: MNIST, CIFAR-10, SVHN, GTSRB, FashionMNIST, and STL-10.
  • Audio: Google Speech Commands (GSC), EmotionSense, and UrbanSound.
  • Inertial (IMU): HHAR, PAMAP2, and Skoda.
  • Muscle Activity (sEMG): Ninapro (DB2, DB3, DB6).

Key Results

  • Compression and Accuracy: YONO achieved a 12.37× compression ratio on average. Accuracy degradation was minimal, typically between 0.4% and 0.6%. Notably, on the GSC audio dataset, YONO improved accuracy by 1.2%, suggesting a regularizing effect from the quantization process.
  • Switching Performance: Compared to external storage solutions, YONO reduced model-switching latency by 93.3–94.5% and energy consumption by 93.9–95.0%.
  • Generalizability: The framework demonstrated robust performance on "unseen" datasets and architectures (such as DS-CNN) without requiring retraining of the core codebooks, suggesting that the learned weight vocabulary is somewhat universal across different sensing tasks.

Discussion and Limitations

While YONO significantly optimizes memory usage, it is still bound by SRAM limits. Reconstructed weights must fit into the working memory, which may pose challenges for very large models on MCUs with extremely limited SRAM (e.g., 128KB). Furthermore, the current implementation is optimized for 8-bit quantization; future work may explore sub-byte quantization (4-bit or 2-bit) and the application of YONO to Recurrent Neural Networks (LSTMs) or Transformer-based architectures.

Conclusion

YONO demonstrates that multiple heterogeneous neural networks can be efficiently managed on resource-constrained microcontrollers. By sharing a universal "vocabulary" of weights, YONO enables tiny devices to perform complex, multi-modal tasks with high efficiency and minimal latency, bridging the gap between sophisticated deep learning and the constraints of the IoT.

Summary updated

BibTeX
@inproceedings{kwon2022yono,
  author = {Young D. Kwon and Jagmohan Chauhan and Cecilia Mascolo},
  title = {{YONO: Modeling Multiple Heterogeneous Neural Networks on Microcontrollers}},
  booktitle = {IPSN},
  year = {2022},
  url = {https://openreview.net/forum?id=GD6J2spbG_},
}
Figure