Introduction
Standard Keyword Spotting (KWS) systems, such as those powering voice assistants, are generally "closed-set," meaning they are pre-trained to recognize a static set of commands. Personalizing these systems for a user's unique wake-word typically necessitates large datasets and computationally expensive cloud-based retraining. This paper addresses the challenges of on-device customization under two primary constraints: data scarcity, where users provide only 5-10 samples, and the "unknown" problem, requiring the system to distinguish between a few target keywords and an infinite "open-set" of non-target speech.
Proposed Framework
The authors introduce a two-stage pipeline designed for efficiency and robustness on mobile hardware.
1. Offline Feature Encoder Training
A Depthwise Separable Convolutional Neural Network (DSCNN) is trained on a large, diverse dataset (the Multilingual Spoken Words Corpus) to learn rich speech features. The researchers evaluated several training losses, including Prototypical Network (PN), Angular Prototypical (AP), and Triplet Loss (TL). A key finding was that L2 normalization of output features (embeddings) significantly improved class discrimination by focusing on the direction of embeddings rather than their magnitude.
2. On-Device Open-Set Classifier
Once deployed, the frozen encoder generates embeddings for the user's new keywords. The system then employs an open-set classifier to handle unknown words. Among the methods tested—openNCM (Open Nearest Class Mean), OpenMAX, and Dummy Proto (DProto)—the simplest approach, openNCM, proved highly effective. It utilizes a small set of random words to represent the "unknown" category, avoiding the need for complex statistical modeling which often fails with limited data.
Experimental Results
The system was evaluated using the Google Speech Command (GSC) dataset, with 10 target keywords for few-shot enrollment and 20 keywords serving as the "unknown" set.
Performance and Efficiency
In a 10-shot, 10-way scenario, the framework achieved 76% accuracy on target words while maintaining a False Acceptance Rate (FAR) of unknown words at just 5%. Notably, Triplet Loss (TL) outperformed the standard Prototypical Loss for few-shot learning, as it more explicitly optimizes the boundaries between classes, which is crucial for rejecting outliers.
As shown in the comparison below, the proposed Triplet Loss + openNCM approach matched the performance of state-of-the-art methods like PEELER. However, while PEELER requires an additional 6.3 million parameters to estimate class variance, the authors' method requires zero extra parameters, making it ideal for low-power microcontrollers.
Conclusion and Future Work
This research demonstrates that a combination of a DSCNN trained with Triplet Loss and a simple nearest-class-mean classifier provides a robust and efficient solution for on-device KWS customization. Future research directions include exploring cross-language transfer (e.g., training on English for use in other languages) and improving robustness in extremely noisy real-world environments.
Source Code: https://github.com/mrusci/ondevice-fewshot-kws
Summary updated