Distil-Whisper is the knowledge-distilled version of OpenAI's Whisper-Large-v3, described in the paper Robust Knowledge Distillation via Large-Scale Pseudo Labelling. As the newest addition to the Distil-Whisper English family, Distil-Large-v3.5 maintains the high efficiency of its predecessors while delivering better performance.
Compared to earlier models, Distil-Large-v3.5 has been trained on over 4× more diverse public data (98k hours) and uses a "patient" teacher with an extended training schedule and aggressive data augmentation (SpecAugment) during distillation. This results in enhanced robustness and accuracy compared to previous Distil-Whisper models, making it suitable as a drop-in replacement.
Why consider Distil-Large-v3.5 when Whisper-Large-v3-Turbo already exists?
It offers a different balance between accuracy and efficiency, remains ~1.5x faster than Whisper-Large-v3-Turbo while performing slightly better on short-form transcription and falling ~1% behind on long-form transcription.
It works perfectly as a draft model for speculative decoding with Whisper-Large-v3. By keeping the encoder frozen during training, we need to load just two extra decoder layers and forward the encoder only once. This achieves ~2x faster inference compared to Whisper-Large-v3 while maintaining identical outputs.
The model was evaluated on both short and long-form transcriptions, using in-distribution (ID) and out-of-distribution (OOD) datasets to assess accuracy, generalizability, and robustness.
Note that Word Error Rate (WER) results shown here are post-normalization, which includes converting text to lowercase, removing symbols and punctuation, and more.
Short-Form Evaluation
We've evaluated the model on 5 in-distribution (ID) test sets and 2 out-of-distribution (OOD) test sets for short-form transcription, as done in 🤗 Open ASR Leaderboard.
Dataset
Size / h
large-v3
large-v3-turbo
distil-v3
distil-v3.5
AMI
8.68
15.95
16.13
15.16
14.63
Gigaspeech
35.36
10.02
10.14
10.08
9.84
LS Clean
5.40
2.01
2.10
2.54
2.37
LS Other
5.34
3.91
4.24
5.19
5.04
Tedlium
2.61
3.86
3.57
3.86
3.64
-----------
-----
-----
-----
-----
-----
Earnings22
5.43
11.29
11.63
11.79
11.29
SPGISpeech
100.00
2.94
2.97
3.27
2.87
-----------
-----
-----
-----
-----
-----
ID Average
7.15
7.24
7.37
7.10
OOD Average
7.12
7.30
7.53
7.08
Average
7.14
7.25
7.41
7.10
Note: ID/OOD classification is based on distil-v3 and distil-v3.5 training data. Large-v3 and large-v3-turbo training corpus details are unknown, so this categorization might not represent their true in-domain vs. out-of-domain performance.
Long-Form Evaluation
We've evaluated the model on 1 in-distribution (ID) test sets and 4 out-of-distribution (OOD) test sets for long-form transcription, using the sequential decoding algorithm (condition_on_prev_tokens=False, return_timestamps=True).
Dataset
Size / h
large-v3-turbo
distil-v2
distil-v3
distil-v3.5
tedlium-long-form
2.47
3.07
9.66
3.9
4.63
-----------------
-----
-----
-----
-----
-----
meanwhile
1.01
5.03
16.75
7.04
6.79
earnings21
39.26
9.84
15.09
10.54
10.6
earnings22
119.89
13.32
19.11
15.06
14.19
rev16
16.16
12.82
21.15
13.76
13.98
-----------------
-----
-----
-----
-----
-----
ID Average
3.07
9.66
3.9
4.63
OOD Average
10.25
18.03
11.6
11.39
Average
8.82
16.35
10.06
10.04
Note: ID/OOD classification is based on distil-v3 and distil-v3.5 training data. Large-v3 and large-v3-turbo training corpus details are unknown, so this categorization might not represent their true in-domain vs. out-of-domain performance.
Below are the Real Time Factor (RTFx) measurements showing that Distil-Large-v3.5 is approximately 1.5x faster than Whisper-Large-v3-Turbo on long-form transcription.
Dataset
large-v3-turbo
distil-v2
distil-v3
distil-v3.5
tedlium-long-form
34.33
27.96
44.95
45.19
meanwhile
26.55
28.01
40.84
42.48
earnings21
35.25
36.66
54.69
54.3
earnings22
39.08
42.09
57.28
58.8
rev16
33.86
23.87
45.43
45.91
-----------------
-----
-----
-----
-----
Average
33.81
31.72
48.64
49.34
Transformers Usage
Distil-Large-v3.5 is supported in the Hugging Face 🤗 Transformers library from version 4.39 onwards. To run the model, first
install the latest version of Transformers. For this example, we'll also install 🤗 Datasets to load a toy audio dataset
from the Hugging Face Hub:
For more control over the generation parameters, use the model + processor API directly:
Ad-hoc generation arguments can be passed to model.generate, including num_beams for beam-search, return_timestamps
for segment-level timestamps, and prompt_ids for prompting. See the docstrings
for more details.
Unlike previous Distil-Whisper releases, Distil-Large-v3 and Distil-Large-v3.5 is specifically designed to be compatible with OpenAI's sequential
long-form transcription algorithm. This algorithm uses a sliding window for buffered inference of long audio files (> 30-seconds),
and returns more accurate transcriptions compared to the chunked long-form algorithm.
The sequential long-form algorithm should be used in either of the following scenarios:
Transcription accuracy is the most important factor, and latency is less of a consideration
You are transcribing batches of long audio files, in which case the latency of sequential is comparable to chunked, while being up to 0.5% WER more accurate
If you are transcribing single long audio files and latency is the most important factor, you should use the chunked algorithm
described below. For a detailed explanation of the different algorithms, refer to Sections 5 of
the Distil-Whisper paper.
The pipeline
class can be used to transcribe long audio files with the sequential algorithm as follows:
Distil-Large-v3.5 remains compatible with the Transformers chunked long-form algorithm. This algorithm should be used when
a single large audio file is being transcribed and the fastest possible inference is required. In such circumstances,
the chunked algorithm is up to 9x faster than OpenAI's sequential long-form implementation (see Table 7 of the
Distil-Whisper paper).
To enable chunking, pass the chunk_length_s parameter to the pipeline. For Distil-Large-v3.5, a chunk length of 25-seconds
is optimal. To activate batching over long audio files, pass the argument batch_size:
Distil-Large-v3.5 can be used as an assistant to Whisper-Large-v3 for speculative decoding.
Speculative decoding mathematically ensures that exactly the same outputs as Whisper are obtained, while being 2 times faster.
This makes it the perfect drop-in replacement for existing Whisper pipelines, since the same outputs are guaranteed.
In the following code-snippet, we load the assistant Distil-Whisper model standalone to the main Whisper pipeline. We then
specify it as the "assistant model" for generation:
You can apply additional speed and memory improvements to Distil-Whisper to further reduce the inference speed and VRAM
requirements. These optimisations primarily target the attention kernel, swapping it from an eager implementation to a
more efficient flash attention version.
Then pass attn_implementation="flash_attention_2" to from_pretrained:
diff
1- model = AutoModelForSpeechSeq2Seq.from_pretrained(model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True)
2+ model = AutoModelForSpeechSeq2Seq.from_pretrained(model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True, attn_implementation="flash_attention_2")
Torch Scale-Product-Attention (SDPA)
If your GPU does not support Flash Attention, we recommend making use of PyTorch scaled dot-product attention (SDPA).
This attention implementation is activated by default for PyTorch versions 2.1.1 or greater. To check
whether you have a compatible PyTorch version, run the following Python code snippet:
If the above returns True, you have a valid version of PyTorch installed and SDPA is activated by default. If it
returns False, you need to upgrade your PyTorch version according to the official instructions
Once a valid PyTorch version is installed, SDPA is activated by default. It can also be set explicitly by specifying
attn_implementation="sdpa" as follows:
diff
1- model = AutoModelForSpeechSeq2Seq.from_pretrained(model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True)
2+ model = AutoModelForSpeechSeq2Seq.from_pretrained(model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True, attn_implementation="sdpa")
./main -m ./models/ggml-model.bin -l en -f /path/to/audio/file --print-colors
Faster-Whisper
Faster-Whisper is a reimplementation of Whisper using CTranslate2, a fast
inference engine for Transformer models.
First, install the Faster-Whisper package according to the official instructions.
For this example, we'll also install 🤗 Datasets to load a toy audio dataset from the Hugging Face Hub:
The following code snippet loads the Distil-Large-v3.5 model and runs inference on an example file from the LibriSpeech ASR
dataset:
python
1import torch
2from faster_whisper import WhisperModel
3from datasets import load_dataset
45# define our torch configuration6device ="cuda"if torch.cuda.is_available()else"cpu"7compute_type ="float16"if torch.cuda.is_available()else"float32"89# load model on GPU if available, else cpu10model = WhisperModel("distil-whisper/distil-large-v3.5-ct2", device=device, compute_type=compute_type)1112# load toy dataset for example13dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy","clean", split="validation")14sample = dataset[1]["audio"]["path"]1516segments, info = model.transcribe(sample, beam_size=5, language="en")1718for segment in segments:19print("[%.2fs -> %.2fs] %s"%(segment.start, segment.end, segment.text))
To transcribe a local audio file, simply pass the path to the audio file as the audio argument to transcribe:
segments, info = model.transcribe("audio.mp3", beam_size=5, language="en")
OpenAI Whisper
To use the model in the original Whisper format, first ensure you have the openai-whisper package installed.
For this example, we'll also install 🤗 Datasets to load a toy audio dataset from the Hugging Face Hub:
Note that the model weights will be downloaded and saved to your cache the first time you run the example. Subsequently,
you can re-use the same example, and the weights will be loaded directly from your cache without having to download them
again.
To transcribe a local audio file, simply pass the path to the audio file as the audio argument to transcribe:
Tip: for compiling using Apple Metal, specify the metal feature when you run the example:
cargo run --example whisper --release --features="symphonia,metal" -- --model distil-large-v3
Note that if you encounter the error:
error: target `whisper` in package `candle-examples` requires the features: `symphonia`
Consider enabling them by passing, e.g., `--features="symphonia"`
You should clean your cargo installation:
cargo clean
And subsequently recompile:
cargo run --example whisper --release --features symphonia -- --model distil-large-v3
Training
Training Details
Distil-Whisper inherits the encoder-decoder architecture from Whisper. The encoder maps a sequence of speech vector
inputs to a sequence of hidden-state vectors. The decoder auto-regressively predicts text tokens, conditional on all
previous tokens and the encoder hidden-states. Consequently, the encoder is only run forward once, whereas the decoder
is run as many times as the number of tokens generated. In practice, this means the decoder accounts for over 90% of
total inference time. Thus, to optimise for latency, the focus is on minimising the inference time of the decoder.
Distil-Large-v3.5 builds on techniques from previous Distil-Whisper models, particularly the training procedure introduced in Distil-Large-v2 for teacher model distillation and the sample packing method from Distil-Large-v3 that improves long-form transcription with sequential decoding. Beyond these established approaches, we've made several significant enhancements:
Significantly expanded training data: We've increased our training dataset from 22,000 hours in the previous version to over 98,000 hours of high-quality public data, largely thanks to the Yodas dataset which provides diverse content from YouTube.
Implemented a "patient" teacher with aggressive data augmentation (SpecAugment): This allowed us to extend the training schedule substantially to 80 epochs compared to just 11 in the previous version. The model continues to show improvement, with evaluation loss still slightly decreasing even at this extended duration.
Reduced the probability of appending previous prompt in training data: We initially set this at 50%, but discovered the model struggled with transcribing text that included previous context, possibly due to decoder size limitations. We subsequently reduced this to 20%, which improved the overall performance while still serving as a form of data augmentation.
Increased batch size and learning rate: We implemented a much larger batch size of 4,096 packed segments, substantially bigger than the 256 used in the previous version. We also tested alternative learning rate schedulers including cosine, wsd, and scheduler-free optimizers, but found the linear approach still performed best.
We also revised the segment packing order to create more logically structured packed segments and adopted BPE dropout as regularization, which we found slightly degraded performance on short-form transcription but improved results for long-form content.
The model was trained using 64 H100 GPUs on the Jean Zay cluster, with the entire training process taking three days.
We initially gathered over 196,000 hours of public data from sources like Common Voice, LibriSpeech , VoxPopuli , TED-LIUM , People's Speech, GigaSpeech , AMI , and notably, Yodas. This diverse dataset is essential for ensuring our distilled model remains robust across various audio distributions and noise conditions.
We packed the collected examples into roughly 30-second segments, with each segment containing only one speaker. To maintain high quality and consistent formatting across datasets, we pseudo-labelled these training segments using Whisper-Large-v3. We then normalized both the Whisper pseudo-labels and the ground truth labels provided by each dataset, and calculated the WER between them. We discarded any examples with a WER exceeding 10%, resulting in approximately 98,000 hours of high-quality training data.
The filtered data can be found in this multilingual dataset for reproduction and further filtering.
Reproducing Distil-Whisper
Training and evaluation code to reproduce Distil-Whisper is available under the Distil-Whisper repository.
License
Distil-Whisper inherits the MIT license from OpenAI's Whisper model.
@misc{gandhi2023distilwhisper,
title={Distil-Whisper: Robust Knowledge Distillation via Large-Scale Pseudo Labelling},
author={Sanchit Gandhi and Patrick von Platen and Alexander M. Rush},
year={2023},
eprint={2311.00430},
archivePrefix={arXiv},
primaryClass={cs.CL}
}