TL;DR
Deep Speech 2 is a single neural network that takes a spectrogram of speech and outputs text, with no hand-built acoustic pipeline. The same design works for English and Mandarin, and it is trained with a loss that lets the network learn the alignment between audio and characters itself. The authors trained it on 11,940 hours of English and 9,400 hours of Mandarin speech, combined it with an n-gram language model, and reported accuracy that approached or exceeded human transcribers on several benchmarks.
Builds on: CTC, recurrent networks, Batch Normalization · Leads to: Automatic Speech Recognition systems built end to end, and the batch-dispatch approach to serving large models
Why it mattered
Deep Speech 2 showed that end-to-end speech recognition could work at production scale and in more than one language. Before it, a speech recogniser was a chain of separately tuned parts: feature extraction, an acoustic model, a pronunciation model and a language model. The paper replaced most of that chain with one network trained on a very large labelled dataset, and the same recipe then applied to Mandarin with only small changes.
The paper also made a practical point that shaped later work. Its authors described how to make training fast enough that an experiment which had taken weeks could run in days, and how to serve the network with low latency. Those systems details, from data-parallel training on GPUs to batch dispatch at serving time, were as much a contribution as the architecture.
The problem
Speech varies a great deal: accents, background noise, far-field microphones, spontaneous speech. The previous system from the same group, Deep Speech 1, was already end to end, but its error rates were high in many conditions and it was trained on less data. The authors wanted a model that could approach or exceed human transcription on standard test sets, work in a second language with little change, and still be fast enough to deploy.
The main difficulty is alignment. Audio arrives as a long sequence of frames, many per second, while the text has far fewer characters, and nobody labels which frame corresponds to which letter. The network needs a loss function that accepts a transcript without an alignment, and an output scheme that can handle the many frames that correspond to silence or to the middle of a letter.
How it works
The system takes four stages, shown below. The walkthrough follows one short utterance through them. The example is illustrative, not from the paper.
- Input: a spectrogram. The audio is cut into short overlapping frames, and each frame is turned into a vector of power values across frequency bins, a spectrogram. The power is normalised over the clip. A two-second clip becomes a sequence of frame vectors, one per time step. Check: the network sees a sequence of vectors, not a waveform and not characters.
- Convolution and striding. One to three convolutional layers slide filters over the frames. A stride of 3 in the first layer keeps only every third output, which shortens the sequence the recurrent layers have to process. The best English model uses three 2D convolution layers. Check: a sequence of 300 frames with stride 3 becomes about 100 steps, so later layers do a third of the work.
- Recurrent layers. Between one and seven bidirectional recurrent layers read the sequence forward and backward and pass context along. The best English model uses seven. Each layer is followed by Batch Normalization, which the paper found helped deep recurrent stacks reach better final error. Check: after this stage, each time step carries information from both earlier and later audio.
- Output and decoding. A softmax layer gives, at each time step, a probability over the characters of the language plus a special blank symbol. A CTC rule reads the most likely path and collapses it: repeated characters merge, and blanks separate real repeats. Then a beam search keeps the best candidate transcripts and adds a score from a language model. Check: with the path "h h blank i", collapsing gives "hi". With "h blank h i", it gives "hhi", because the blank keeps the two h's apart.
flowchart LR A[Spectrogram frames] --> B[1 to 3 convolution layers] B --> C[1 to 7 bidirectional RNN layers] C --> D[Softmax over characters and blank] D --> E[CTC collapse plus language model beam search] E --> F[Transcript]
The math
The notation follows the paper. An utterance is a sequence of frames for , and is the power in frequency bin at time .
Step 2 in symbols: the convolution
Let be activation of layer at time . For a context window of size on the previous layer's output, the convolution computes
where is filter , is the element-wise product summed over the window, and is the nonlinearity. The paper uses a clipped ReLU, , which is the ReLU with a ceiling of 20. Striding by means the window moves frames at a time.
Step 3 in symbols: the recurrent layer
A bidirectional layer computes a forward state and a backward state , and adds them. The simplest recurrence is
where maps the input, carries the state from the previous step, and is a bias. The paper also compares GRU cells with this simple recurrence. LSTM cells are another option it mentions.
Step 4 in symbols: the output and the loss
After the recurrent layers, one or more fully connected layers feed a softmax. The probability of symbol at time is
The CTC loss sums the probability of every alignment that collapses to the correct transcript . For an utterance and transcript , the paper writes
where is the set of all frame-level paths that collapse to , and are the network weights. Training follows the gradient of this loss with Backpropagation through time.
Step 4 again: decoding with a language model
At inference, the system looks for the transcript that maximises a score combining the network and a language model:
The weight sets how much the language model counts, and rewards more words. Both are tuned on a development set.
Batch normalisation in symbols
For a layer with an affine map , the paper inserts before the nonlinearity:
The mean and variance are taken over a minibatch and over the time steps of each sequence in it (the paper calls this sequence-wise normalisation). and are learned, and is a small constant for stability. The bias is dropped because mean removal cancels it.
Worked examples
Word error rate (WER) counts the mistakes a transcript makes against a reference. It is the number of substitutions, deletions and insertions, divided by the number of words in the reference. Take the reference "the cat sat on the mat" and the hypothesis "the cat sat on mat".
- The reference has 6 words.
- Align the two sentences. The only difference is that the hypothesis is missing the word "the" before "mat". That is one deletion.
- Count the errors: 0 substitutions, 1 deletion and 0 insertions, so 1 error in total.
- Divide: WER , which is 16.7%.
Interpretation: one dropped word in six gives a WER of about 17%. A WER can exceed 100% when the hypothesis contains many insertions.
The decoder scores two candidate transcripts with . The values below are illustrative, not the paper's tuned settings. Use and .
- Candidate A: the network gives , the language model gives , and the word count is 3.
- Score A: .
- Candidate B: the network gives , the language model gives , and the word count is 2.
- Score B: .
- Compare: is larger than , so the decoder keeps A.
Interpretation: B is slightly more likely under the acoustic network, but the language model finds it unlikely, and the word bonus does not make up the difference. This is the trade-off the language model weight controls.
The paper's CHiME "real" test set was recorded in actual noisy places: a bus, a cafe, a street. Table 15 reports the following WER values (single channel).
| Test set | DS1 | DS2 | Human |
|---|---|---|---|
| CHiME eval clean | 6.30 | 3.34 | 3.46 |
| CHiME eval real | 67.94 | 21.79 | 11.84 |
| CHiME eval sim | 80.27 | 45.05 | 31.33 |
- On the real noisy set, DS1 has 67.94% WER and DS2 has 21.79%. The drop is points.
- The relative reduction is , so DS2 makes about 68% fewer errors than DS1 on this set.
- Human transcribers reach 11.84% on the same audio, so DS2 is still points behind them.
- On the simulated set, where noise was added synthetically to clean speech, DS2 is at 45.05% against 31.33% for humans, a gap of 13.72 points.
Interpretation: the model improved a great deal on real noise, but the gap to humans is larger on real noise than on synthetic noise. The paper says this directly, and it is the main limit of the result.
Try it: using the same table, what is the gap between DS2 and humans on the clean set, in points?
Answer: , so DS2 is 0.12 points better than the human transcribers on clean speech.
Results
Scale and accuracy. The English system was trained on 11,940 hours of speech and the Mandarin system on 9,400 hours. The paper reports that its system reduced English error rates by up to 43% relative to Deep Speech 1, and that it is competitive with human transcription on several benchmarks.
Language model. Table 6 compares word error rate (WER, explained in the first worked example) for English and character error rate (CER) for Mandarin, with and without the language model. The English 9-layer, 7-recurrent-layer model goes from 14.93 to 9.52 WER, and the Mandarin version from 7.55 to 5.81 CER. The relative gain from the language model is smaller for deeper models: 48% falls to 36% in English, and 27% falls to 23% in Mandarin. The authors suggest that deeper recurrent models learn more of a language model themselves.
Model size. Table 11 varies the layer width on the regular and noisy development sets. The 100 million parameter RNN model gives the lowest errors, at 7.73 regular and 13.06 noisy. The paper uses this model for all further English results. The authors also note that at this size the simple RNN slightly beats the GRU, and that it trains faster.
Benchmarks against Deep Speech 1 and humans. On read speech (Table 13), DS2 beats the human baseline on three of four sets. On LibriSpeech test-other it is at 13.25, against 12.69 for humans, so it is competitive rather than better there. On accented speech (Table 14), DS2 improves on DS1 for every accent, but human performance is still better in all four groups. Table 14 shows humans with the lower error in all four groups, though the text says this holds for all groups but the Indian one. The gap is smallest for the Indian group, where humans have 22.15 and DS2 has 22.44, a difference of 0.29 points. On noisy speech (Table 15), the gaps are shown above.
Internal test sets. On a Baidu internal set of 3,300 utterances (Table 12), DS2 has 13.59% WER against 24.01% for DS1, a relative improvement of 43.4%.
Mandarin. Table 16 shows the effect of each architectural change on a Mandarin development and test set. The 5-layer, 1-RNN model has 7.13 and 15.41. The 9-layer, 7-RNN model with BatchNorm and 2D convolution has 5.81 and 7.93. On a 100-utterance test, a group of five humans had a 4.0% error rate against 3.7% for the system, while a single human transcriber on 250 utterances had 9.7% against 5.7% for the model.
Limits. Many results are on internal Baidu data that outside readers cannot inspect. The human baselines come from paid transcription workers, and the paper's own noisy-speech results show the largest human gap on real noise. The Mandarin human comparison uses small samples. The paper is a systems report, so its claims are about these benchmarks and this system, not about all speech recognition.
Reading guide
The paper is long, and its sections map onto the prerequisites as follows.
- Section 1 (Introduction). The end-to-end argument and the data sizes. Needs Automatic Speech Recognition for the task.
- Section 2 (Related work) and Section 3.1 (Preliminaries). The spectrogram input, the convolution and recurrent equations, and the softmax over characters. Needs Time-Frequency Representation, convolution, Recurrent Neural Network and Softmax.
- Section 3.2 (Batch normalisation for deep RNNs). Needs Batch Normalization. The paper's main claim here is about generalisation, not only speed.
- Section 3.3 (SortaGrad). A curriculum that orders training examples by length early on, because the CTC loss depends on utterance length. Needs Curriculum Learning and Connectionist Temporal Classification (CTC).
- Sections 3.4 to 3.7. Comparisons of GRU and simple RNN cells, frequency convolutions, striding and row convolution for unidirectional models. Needs Gated Recurrent Unit and Long Short-Term Memory.
- Section 3.8 (Language model). Needs Language Model, N-gram Language Model and Beam Search, and the decoding score .
- Section 4 (System optimisations). Needs Data Parallelism and Stochastic Gradient Descent. The GPU CTC implementation assumes the loss from Section 3.
- Section 5 (Training data). Data collection, augmentation and scaling. Needs Data Augmentation.
- Section 6 (Results). The benchmark tables, read against the definitions above.
- Section 7 (Deployment). Batch dispatch and low-latency serving. Needs Beam Search and the cost of memory-bound computation.
Check yourself
QuestionIn one sentence, what does the network output at each time step, and what does the CTC rule do with those outputs?Show answer
At each time step the network outputs a probability over the characters and a blank symbol. The CTC rule reads the most likely path, merges repeated characters and removes blanks, which gives the transcript.
QuestionThe reference transcript has 8 words. A hypothesis has 2 substitutions, 1 deletion and 1 insertion. What is the word error rate?Show answer
The total number of errors is . The WER is , which is 50%.
QuestionWhy does the paper use a language model in decoding, and why does the benefit shrink for deeper models?Show answer
The paper uses an n-gram language model because such models scale to large amounts of unlabelled text, so they can add knowledge about word and character sequences that the acoustic training data does not provide. The benefit shrinks with depth because the authors hypothesise that deeper recurrent networks learn more of the language structure themselves, so the external model adds less.
QuestionA team wants to use the paper's approach for a voice assistant that runs in busy kitchens. Their test set is recorded in real kitchens. Using the paper's own results, what should they expect, and what should they check?Show answer
They should expect the model to be much better than older systems on real noise, but still behind human transcribers, and the paper shows the gap is largest on real noisy audio. They should check their own real-noise test set rather than clean benchmarks, measure WER against human transcripts, and treat the paper's numbers as a guide to the kind of result, not a guarantee for their device.
Sources
- Amodei et al., "Deep Speech 2: End-to-End Speech Recognition in English and Mandarin" (2015), https://arxiv.org/abs/1512.02595
- Hannun et al., "Deep Speech: Scaling up end-to-end speech recognition" (2014), https://arxiv.org/abs/1412.5567