少六层:面向Whisper的编码器剪枝与无标签恢复
研究论文 · 2026/09/24
剪枝基于Transformer的大型预训练ASR模型(如OpenAI的Whisper)已被广泛采用,因为剪枝解码器能显著加速端到端转录。例如,whisper-large-v3-turbo将解码器从32层减少到4层,而Distill-Whisper将解码器减少到仅2层。尽管已有一些工作致力于减小编码器规模,但尚无方法被广泛采用,这可能是因为需要自定义推理实现来利用压缩模型。我们提出一种方法,根据留一层的词错误率(WER)变化对编码器层进行排序,移除变化最小的六层,占编码器堆栈的18.5%。剪枝后的模型无需自定义推理代码,因为它只是一个层数更少的更浅编码器。我们进一步使用无标签单语语音数据进行蒸馏,以恢复零样本层剪枝导致的性能下降。蒸馏后,四种语言的平均WER从零样本的21.9%改善至20.1%,而基线为18.2%。我们发布了所有代码(https://github.com/rasgaard/whisper-encoder-layer-prune)和剪枝模型(https://huggingface.co/rasgaard/whisper-large-v3-turbo-encoder-pruned)。
该工作提供了一种简单有效的Whisper编码器剪枝方法,无需自定义推理代码,并通过无标签蒸馏恢复性能,具有实际部署价值。
Pruning large pre-trained transformer-based ASR models such as OpenAI's Whisper has seen great adoption, as pruning the decoder led to significant end-to-end transcription speedups. For instance, the {\tt whisper-large-v3-turbo} variant reduced the decoder from 32 to 4 layers, while Distill-Whisper similarly reduced the decoder to only 2 layers. Although some attention has been put towards reducing the size of the encoder, no approach has seen wide adoption. This could be due to the need for custom inference implementations to take advantage of the compressed model. We present an approach that ranks encoder layers by the leave-one-layer-out change in Word Error Rate (WER). The six layers that cause the least change are removed, corresponding to 18.5% of the encoder stack. The pruned model requires no custom inference code as it is simply a more shallow encoder with fewer layers. We further distill using unlabeled monolingual speech data to recover performance degradation caused by the zero-shot layer pruning. Mean WER across four languages increases to 20.1% after distillation, compared to 21.9% zero-shot, going from a baseline of 18.2%. We release all of our code (https://github.com/rasgaard/whisper-encoder-layer-prune) and the pruned model (https://huggingface.co/rasgaard/whisper-large-v3-turbo-encoder-pruned).