On-Device Customization of Tiny Deep Learning Models for Keyword Spotting With Few Examples

Manuele Rusci, Tinne TuytelaarsIEEE Micro 2023 · DOI

Introduction

Standard Keyword Spotting (KWS) systems, which power wake-word detection in modern smartphones and smart speakers, typically rely on rigid, pre-trained models. Adding a new custom command usually requires collecting thousands of audio samples and performing intensive retraining on cloud servers. For "TinyML" devices—low-power microcontrollers with limited memory and processing capabilities—this lack of flexibility is a significant bottleneck.

This research presents a framework for customizing KWS models directly on-device using just a few recorded examples. By leveraging a deep neural network (DNN) trained to generate "voice fingerprints," the system can recognize new user-defined commands with up to 80% accuracy without requiring backpropagation or cloud connectivity.

System Architecture

The proposed methodology employs a two-stage approach to enable on-device learning within a tiny power budget.

  1. Offline Feature Extraction: A DNN is pre-trained on a large, general dataset (the Multilingual Spoken Words Corpus) using Triplet Loss. This training objective forces the network to map audio into an "embedding space" where similar sounds are clustered together and distinct words are pushed apart. This feature extractor is then frozen and quantized to 8-bit integers (INT8) for deployment.
  2. On-Device Registration: To add a new keyword, a user provides a few samples (e.g., 5 or 10 "shots"). The device processes these through the frozen extractor to obtain embedding vectors and calculates their geometric average to create a prototype vector representing that keyword.
  3. Streaming Inference: During operation, incoming audio is converted into a vector. The system calculates the distance between this vector and the stored prototypes; if the distance is below a certain threshold, the keyword is identified.
Figure 1: Overview of the offline training, on-device registration, and streaming inference workflow.

Hardware and Model Selection

The researchers evaluated several architectures, including Depthwise Separable CNNs (DS-CNN) and ResNet15, on the GAP9 MCU—a high-efficiency microcontroller featuring nine RISC-V cores.

A key finding was the "Architecture Paradox": while DS-CNNs typically have fewer operations (MACs), ResNet15 proved to be 2.25x faster on the GAP9 hardware. This is due to the hardware accelerators being optimized for standard 2D convolutions rather than the pointwise layers prevalent in DS-CNNs. Furthermore, quantization to INT8 resulted in negligible accuracy loss, making it ideal for memory-constrained environments.

Experimental Results

The system was evaluated using the Google Speech Command (GSC) dataset, focusing on keywords not seen during the initial training phase.

Performance scales significantly with the number of user-provided examples. As shown in Figure 4, increasing the number of training "shots" improves accuracy across all model variants. The ResNet15 model achieved a peak accuracy of 80% at a 5% False Acceptance Rate (FAR) when provided with 10 examples.

Figure 4: Accuracy vs. False Acceptance Rate (FAR) across different architectures and number of training shots.

In terms of efficiency, the ResNet15 model processes one second of audio in just 9.7 milliseconds while operating within a 25 mW power envelope. Each inference consumes approximately 247 microjoules ($\mu J$), allowing for long-term operation on small batteries.

Conclusion

This work demonstrates that high-quality keyword customization is possible on microcontrollers without complex on-device training. While the few-shot accuracy (80%) currently trails behind massive end-to-end models (>94%), the ability to learn new commands locally and efficiently opens new possibilities for personalized user interfaces in smart home and industrial IoT applications. Future research will explore on-device adaptation strategies to further bridge the accuracy gap in noisy, real-world environments.

Summary updated

BibTeX
@article{rusci2023device,
  author = {Manuele Rusci and Tinne Tuytelaars},
  title = {{On-Device Customization of Tiny Deep Learning Models for Keyword Spotting With Few Examples}},
  journal = {IEEE Micro},
  year = {2023},
  doi = {10.1109/mm.2023.3311826},
}
Figure