Kaldi online2 decoding pipeline & nnet3 model pruning – optimal configuration for low‑traffic workloads?
0 reputation · 02 Oct 2024, 13:39 UTC
0 reputation · 02 Oct 2024, 13:39 UTC
Determine a cost‑effective deployment strategy for Kaldi on low‑traffic speech workloads by balancing the real‑time online2 decoding pipeline with aggressive nnet3 model pruning.
The online2‑wav‑nnet3‑latency script defaults to a 30 ms stride, yet the trade‑off between this stride setting, decoding latency, and word error rate (WER) is not fully documented. Additionally, pruning can reduce model size but may impact accuracy, and GPU acceleration requires matching CUDA versions.
For low-traffic workloads on resource-constrained hardware (such as a t3.medium instance), the optimal configuration is to maintain the 30ms stride and prioritize weight-based pruning over stride reduction. Reducing the stride to 10ms typically increases CPU load by 2-3x without providing a proportional improvement in Word Error Rate (WER) for general speech tasks, which risks exhausting burstable CPU credits on t3 instances.
While specific impacts vary by acoustic model, the following behaviors are generally observed in nnet3-based online2 pipelines:
nnet3-copy --transform to remove low-magnitude weights can significantly reduce the memory footprint. However, aggressive pruning (removing >30% of weights) often leads to a non-linear spike in WER. For low-traffic use, moderate pruning combined with quantization is the safer path to reducing the memory footprint.online2-wav-nnet3-latency.sh script on a small validation set using 30ms and 60ms strides to determine the minimum acceptable accuracy threshold for your specific audio.nnet3-copy utility to create a pruned version of the model. Start with conservative weight removal and verify the WER before increasing aggression.htop during simulated traffic to ensure the process stays within the 4GB RAM limit of a t3.medium.To compare the memory footprint and inference speed of your original versus pruned model, use the following scoped approach:
# Compare model sizes
ls -lh nnet3.mdl nnet3_pruned.mdl
# Test inference latency on a sample wav
./online2-wav-nnet3-latency.sh --stride 30 --model nnet3_pruned.mdl sample.wav
Missing Diagnostic: To refine this recommendation, please provide the average utterance length of your workload. Very short utterances (under 2 seconds) may tolerate higher strides, whereas long-form audio requires tighter control to prevent decoding drift.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.