TL;DR
Researchers have successfully squeezed a 65.7-million parameter speech recognition model onto an ESP32-P4 microcontroller, achieving faster-than-real-time streaming transcription. By combining aggressive 2/4-bit quantization with hand-optimized RISC-V SIMD kernels, they maintained high accuracy (4.34% WER on LibriSpeech) without needing a dedicated neural accelerator.
What Problem Does This Paper Address?
Automatic Speech Recognition (ASR) on microcontrollers is typically limited to "keyword spotting"—recognizing a handful of pre-defined commands like "Hey Siri." Transcribing arbitrary, open-vocabulary speech usually requires models with tens of millions of parameters, which far exceed the memory and computational budgets of standard low-power chips.
The challenge is two-fold:
- Memory: How do you fit a ~70MB model into a device where every megabyte of RAM is precious?
- Compute: How do you run complex transformer-like architectures (specifically Zipformer2 transducers) on a 400 MHz processor without an NPU (Neural Processing Unit)?
Methods
The authors ported Kroko, a streaming Zipformer2 transducer, to the ESP32-P4. Their approach relies on three main pillars:
1. Extreme Weight Quantization
Instead of standard 8-bit integers, the authors used a mix of 2-bit and 4-bit weights. They employed the "Cactus Quants" layout, which uses Hadamard rotations to spread out weight outliers, making them easier to quantize using Lloyd-Max levels.
To minimize accuracy loss, they didn't just round the numbers. They used GPTQ (a layer-wise second-order error compensation technique) and a sensitivity-based bit plan. By measuring which layers were most sensitive to noise, they allocated 4 bits to critical matrices and 2 bits to the rest, fitting the entire model into a 26.65 MB file.
2. Integer-Only Pipeline
To avoid the slow performance of floating-point math, the authors converted the entire activation pipeline to int16 and int8. They used a GPU-based simulator to determine exactly where tensors could be downsampled to 8-bit without destroying the signal-to-noise ratio.
3. Hand-Optimized SIMD Kernels
The ESP32-P4 features a 128-bit SIMD extension called PIE (Processor Instruction Extensions). The authors wrote custom assembly kernels to handle the heavy lifting of matrix multiplications and Hadamard transforms. These kernels were designed to be bit-exact with a PC-based reference, allowing them to validate accuracy on large datasets using a laptop before ever flashing the chip.
Datasets
The model was evaluated on several standard ASR benchmarks:
- LibriSpeech: The primary benchmark for clean and "other" (noisy/challenging) speech.
- FLEURS (English): Used for both calibration and testing real-world prompted speech.
- Common Voice 17.0: A dataset of crowdsourced speech used to test robustness across different speakers.
Calibration for the quantization process was performed using 512 clips from the FLEURS training set.
Key Insights and Ideas
- Sensitivity is Non-Uniform: The authors found that stacks nearest to the output are the most sensitive to quantization. As shown in Figure 2, Stack 3 (the largest) survived with only 13.8% of its parameters at 4 bits, while the final stacks (4 and 5) required 100% 4-bit storage to maintain accuracy.
- GPTQ is the "Secret Sauce": The ablation study (Figure 3) revealed that simple rounding to 2/4 bits resulted in a massive Word Error Rate (WER) of 8.83%. Adding GPTQ repair brought that down to 4.75%, proving that how you round is as important as the bit-depth.
- Integer Math is "Free": Surprisingly, moving from floating-point activations to a carefully designed integer pipeline resulted in virtually zero loss in accuracy (see Figure 5), while providing the speed necessary for real-time performance.
- Bit-Exactness Saves Time: By ensuring the C engine produced the exact same bits as the hardware, the researchers could run 15-minute evaluations on a laptop that would have taken 4 hours on the microcontroller.
Key Results
- Speed: The system processes audio at 0.7x real-time (using both cores). A 1.28-second chunk of audio is processed in just 0.90 seconds.
- Accuracy: On LibriSpeech test-clean, the quantized model achieved a 4.34% WER, only a slight degradation from the original int8 model's 3.94%.
- Efficiency: The encoder time per chunk was reduced from an initial 51.3 seconds (plain C) to just 0.62 seconds through successive optimizations.
- Memory Footprint: The weights were reduced from 71 MB (int8) to 26.65 MB, allowing them to fit within the 32 MB PSRAM alongside the engine state and display buffers.
Limitations and Future Work
- Quiet Audio Sensitivity: The model is notably more sensitive to very quiet inputs than the original version, often dropping the first few words of a sentence in low-volume recordings.
- Language Support: The current implementation is English-only. The authors plan to extend this to Modern Standard Arabic in the future.
- Hardware Specifics: The work is currently tied to the ESP32-P4 revision v3; earlier revisions had different PIE instruction encodings.
- Energy Consumption: The authors did not measure the power draw of the system, which is a critical metric for battery-powered microcontroller applications.
- Front-End Optimization: The convolutional front-end is still partly running in floating-point and remains a candidate for further optimization.
Summary updated