TinyFedTL: Federated Transfer Learning on Tiny Devices

Kavya Kopparapu, Eric LinarXiv 2021

Abstract

TinyML has rose to popularity in an era where data is everywhere. However, the data that is in most demand is subject to strict privacy and security guarantees. In addition, the deployment of TinyML hardware in the real world has significant memory and communication constraints that traditional ML fails to address. In light of these challenges, we present TinyFedTL, the first implementation of federated transfer learning on a resource-constrained microcontroller.

Introduction

The field of TinyML—running machine learning on low-power microcontrollers—has expanded rapidly, yet it remains hindered by the "static model" problem. Current frameworks, such as TensorFlow Lite Micro, primarily support inference. Updating these models typically requires transmitting raw data to a central server, which compromises user privacy and consumes excessive bandwidth.

While some on-device learning attempts utilize simple algorithms like k-Nearest Neighbors (k-NN), these methods are memory-intensive; memory requirements scale linearly with the amount of data learned. On devices with extremely limited RAM (e.g., 256KB), this approach is unsustainable. TinyFedTL addresses these limitations by combining Transfer Learning with Federated Learning (FL) to enable privacy-preserving, memory-efficient updates on the edge.

System Architecture

TinyFedTL is built upon three core pillars:

  1. Transfer Learning: The system utilizes a pre-trained MobileNetV2 CNN as a feature extractor. The majority of the network remains frozen. The final dense layer is replaced with a custom-coded trainable layer.
  2. Custom C++ Training Engine: To overcome the lack of backpropagation support in standard TinyML libraries, a custom C++ engine was developed to handle inference and gradient descent updates for the fully connected layer.
  3. Federated Averaging (FedAvg): Collaborative learning is achieved via the FedAvg algorithm. Edge devices (Arduino Nano 33 BLE Sense) perform local training and transmit only weight updates to a central server for aggregation.

Experimental Results

The system was evaluated using CIFAR-10 data, adapted for binary classification tasks (e.g., "Dog vs. No-Dog" and "Cat vs. No-Cat").

Weight Initialization and Robustness

A key finding was the robustness of the feature extractor. Starting the final layer with random weights yielded performance comparable to starting with weights pre-trained on a different task. This suggests that generic feature extractors can effectively support diverse downstream tasks without specialized initialization.

Comparison of validation accuracy between random and pretrained weight initialization for the final classification layer.

The Federated Tax

Experiments revealed a "Federated Tax": as the number of participating devices increased, validation accuracy slightly decreased. This phenomenon likely stems from conflicting updates across different data distributions, which can partially cancel each other out during the averaging process.

Validation accuracy across different numbers of participating devices, illustrating the performance impact of scaling in a federated environment.

Efficiency and Bottlenecks

TinyFedTL demonstrates significant efficiency, with local training of 20 episodes taking only 214ms. The system uses approximately 80% of available RAM (210 KB) and 66% of Flash (657 KB). However, communication remains a major hurdle; transmitting the 6KB of weight updates over a serial port took over 30 seconds, highlighting that communication latency, rather than processing power, is the primary bottleneck in TinyML FL.

Conclusion

TinyFedTL successfully demonstrates the feasibility of federated transfer learning on microcontrollers. While challenges remain regarding optimizer sophistication and communication latency, this work provides a foundation for privacy-preserving, adaptive machine learning at the extreme edge.

Summary updated

BibTeX
@misc{kopparapu2021tinyfedtl,
  author = {Kavya Kopparapu and Eric Lin},
  title = {{TinyFedTL: Federated Transfer Learning on Tiny Devices}},
  year = {2021},
  eprint = {2110.01107},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2110.01107},
}
Figure