Keyword Spotting System and Evaluation of Pruning and Quantization Methods on Low-power Edge Microcontrollers

Jingyi Wang, Shengchen LiarXiv 2022 · DOI

Introduction

Keyword Spotting (KWS) serves as the primary interface for "always-on" voice-activated systems. To ensure user privacy and minimize power consumption, these systems must operate locally on resource-constrained microcontrollers (MCUs). However, the limited memory and computational power of devices like the ARM Cortex-M series pose significant challenges for deploying modern neural networks. This study evaluates the real-world efficacy of pruning and quantization strategies on an STM32F7 platform, identifying specific optimizations that translate theoretical compression into tangible performance gains.

System Architecture and Methodology

The researchers developed a baseline KWS system utilizing a CNN-one-fstride4 architecture, optimized for minimal operations. The system was deployed on an Apollo STM32F767 development board (216MHz CPU, 512KB SRAM).

Overview of the KWS pipeline, from audio sampling to Mel spectrogram generation and CNN inference.

The processing pipeline involves:

  1. Feature Extraction: Audio is sampled at 16kHz. Using DMA buffers, the system performs windowing (Hanning), FFT (N=1024), and applies a 40-band Mel filter-bank to generate a circular queue of Mel spectrograms.
  2. Inference: The CNN processes these spectrograms to classify keywords like "Yes", "No", "Left", and "Right".

Optimization Strategies

The study investigated three primary optimization vectors to bridge the gap between theoretical model size and actual execution speed:

1. Pruning and Loop Reordering

While unstructured (fine-grained) pruning significantly reduces the number of non-zero weights, it often fails to improve speed on standard hardware due to the overhead of conditional checks. To address this, the authors introduced a "Weight Prioritized Loop." By reordering the nested loops of the convolution to prioritize weight iteration, the system can skip entire blocks of computation for zero-valued weights with a single "if" statement, minimizing pipeline stalls.

2. Quantization and SIMD Acceleration

The model was transitioned from 32-bit floating-point to 16-bit integer representation. This quantization not only reduces the memory footprint but also enables the use of SIMD (Single Instruction, Multiple Data) instructions. Specifically, the SMLAD instruction allows the MCU to perform two 16-bit multiply-accumulate operations in a single clock cycle, effectively doubling throughput.

Evaluation and Results

The system was tested using the Google Speech Commands Dataset, achieving a baseline validation accuracy of 90%.

Comparison of inference time and power consumption across different loop orders and pruning percentages.

Key performance metrics include:

  • Inference Latency: The baseline float32 inference took 30.8ms. Quantization to int16 reduced this to 21.4ms, and the addition of SIMD instructions further lowered it to 15.6ms—a total reduction of approximately 50%.
  • Pruning Efficacy: As shown in the performance analysis, the weight-prioritized loop allows unstructured pruning to become beneficial once the pruning rate exceeds 80%. At 90% pruning, the inference speed is nearly doubled compared to the unpruned version.
  • Real-time Performance: The total pipeline latency (feature extraction + inference) is approximately 37ms, well within the requirements for real-time interaction.

Conclusion

This research demonstrates that hardware-aware optimizations are critical for edge AI. While standard pruning techniques can be counterproductive on MCUs, combining weight-prioritized loop reordering with quantization and SIMD instructions enables significant speedups. Future work will explore lower-bit quantization and more complex temporal architectures to further push the boundaries of low-power keyword spotting.

Summary updated

BibTeX
@misc{wang2022keyword,
  author = {Jingyi Wang and Shengchen Li},
  title = {{Keyword Spotting System and Evaluation of Pruning and Quantization Methods on Low-power Edge Microcontrollers}},
  year = {2022},
  eprint = {2208.02765},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.02765},
}
Figure