Paper commentary
Deep Speech 2: End-to-End Speech Recognition in English and Mandarin
Deep Speech 2 recognizes English and Mandarin speech with one neural network
- Problem Conventional speech recognizers chain hand-built stages that must be re-tuned whenever the language or acoustic conditions change. A single trainable network has been hard to build that works across very different languages.
- Method Deep Speech 2 trains one network of convolutions, bidirectional recurrent layers and fully connected layers under the CTC loss. It maps audio directly to characters, with only the output character set changing between languages.
- Results On noisy English development data, three 2D convolution layers reach 14.74 WER, against 19.36 for one 1D layer.
Why replace the recognition pipeline with one network
Conventional recognizers chain several hand-built stages, such as feature extraction, acoustic and pronunciation models and a language model, and each stage has to be tuned again when the language or the acoustic conditions change. This study asks whether one trainable network can replace that chain and still work across languages that differ greatly in writing and sound.
English and Mandarin are the two test languages, and the same overall architecture is used for both, with only the output character set changing.
The system is trained end to end with the CTC loss, so it maps audio directly to character probabilities and needs no frame-level alignments for pretraining. The main levers are the model architecture, large labeled training sets and computational scale, and the study examines all three. Results are compared with human workers on public benchmarks and, for Mandarin, on internal product-style datasets.
How the network maps spectrograms to characters
The input is a time series. Each utterance x^(i) has length T^(i), and every time slice is a vector of power-normalized spectrogram values. At each output step the network predicts a probability for every character in the language and for a blank symbol. In English the set includes the letters, a space and an apostrophe, while the Mandarin system outputs simplified Chinese characters.
The layers run in three groups: one or more convolutions over time, then one or more recurrent layers, then fully connected layers. Each convolution applies a clipped ReLU, sigma(x) = min{max{x,0},20}, and a stride in some layers shortens the sequence before the recurrent layers. Each bidirectional recurrent layer runs a forward pass and a backward pass over time, and the two activation sets are added to form the layer output.
The output layer is a softmax over the output labels, p(l_t = k | x) = exp(w^L_k . h^(L-1)_t) / sum_j exp(w^L_j . h^(L-1)_t). Training back-propagates the gradient of the CTC loss through time, and once trained the same weights are used for every utterance. The language model is not part of the network. It enters only during beam search decoding.
Adapting Batch Normalization to recurrent layers
Depth is the way to add capacity, but deep recurrent stacks are hard to optimize, so the authors normalize the layers with BatchNorm. In a feed-forward layer the affine term is replaced by the normalized term, and the bias is dropped because mean removal cancels it.
The transform is B(x) = gamma (x - E[x]) / (Var[x] + epsilon)^(1/2) + beta, with the mean and variance taken over the minibatch. The result is the input minus its minibatch mean, divided by the square root of the variance plus a small epsilon, then multiplied by gamma and shifted by beta. In convolutional layers the statistics pool all temporal outputs of one filter.
Applying normalization to the recurrent term at each time step did not improve optimization, and averaging statistics over earlier time steps was also ineffective and complicated backpropagation. Sequence-wise normalization instead normalizes only the feed-forward input term, using each hidden unit's mean and variance over all minibatch items across the sequence, and the recurrent term is added afterwards: h_t = f(B(W h_{t-1}^{l-1}) + U h_{t-1}).
Deployment evaluates one utterance at a time, so batch statistics are replaced by a running average collected during training. The authors report that normalizing each neuron over just the sequence degraded performance, while the running-average approach gave better results than evaluating with a large batch.
Depth results with and without BatchNorm
Table 1 varies the number of recurrent layers while holding the parameter count near 38 million, so hidden size per layer shrinks as depth increases. Each depth is compared with and without BatchNorm. The comparison is made on a training set and on a development set, using WER.
With a single recurrent layer, BatchNorm raises development WER from 13.55 to 14.40.
At 3, 5 and 7 recurrent layers, development WER with BatchNorm is 10.56, 9.78 and 9.52, against 11.61, 10.77 and 10.83 without it. The authors report that sequence-wise normalization gives a 12% performance difference for the deepest network, and that the training curves converge faster with it.
Ordering the first epoch by utterance length
The CTC cost for an utterance is a negative log of a sum over alignments of a product over time steps: L(x,y;theta) = -log sum over l in Align(x,y) of the product over t of p_ctc(l_t | x; theta). Because the product shrinks with the length of the sequence, the cost of long utterances is higher than that of short ones, and this motivates SortaGrad.
SortaGrad uses utterance length as a difficulty heuristic. In the first epoch minibatches are visited in increasing order of their longest utterance, and afterwards the order is random. Table 2 compares the 9-layer model with 7 recurrent layers with and without sorting, and with and without BatchNorm.
Without BatchNorm, development WER drops from 11.96 to 10.83 when the first epoch is sorted. With BatchNorm it drops from 9.78 to 9.52. The training WER without BatchNorm falls from 10.71 to 8.76 under sorting.
The authors say the effect is most visible without BatchNorm, since those networks are numerically less stable, and that sorting still adds gains when combined with BatchNorm. They suspect the benefit comes mainly from long utterances having larger gradients while the learning rate is fixed, and from long utterances pushing the RNN state toward explosion early in training.
This is offered as a suspicion.
Simple RNN layers versus GRU layers
The GRU variant here multiplies the previous hidden state by the recurrent matrix before the reset gate, so that all operations on that state form one matrix multiplication. Its gates are computed as z_t = sigma(W_z x_t + U_z h_{t-1} + b_z), r_t = sigma(W_r x_t + U_r h_{t-1} + b_r), and h_t = (1 - z_t) h_{t-1} + z_t tilde h_t, with a clipped ReLU in place of tanh because the two perform similarly.
At about 38 million parameters, GRU layers give lower development WER than simple RNN layers at every depth in Table 3: 10.53 against 14.40 at 5 layers with 1 recurrent layer, and 8.00 against 10.56 at 5 layers with 3 recurrent layers. The same holds at 7 layers with 5 recurrent layers (7.79 against 9.78) and at 9 layers with 7 recurrent layers (8.19 against 9.52).
For GRUs with 5 or more recurrent layers the gains flatten, which the authors attribute to thinner layers, going from 1728 hidden units per layer with one recurrent layer to 768 with seven. When the model is scaled up later, simple RNNs perform slightly better than GRUs for a fixed computational budget, so most later experiments use simple RNN layers.
The authors also find that excellent models exist with only unidirectional recurrent layers, which they note makes such models easier to deploy.
Frequency convolution in front of the recurrent stack
A 1D-invariant convolution slides only over time, while a 2D-invariant convolution spans frequency and time. Frequency convolution is placed first because later fully connected and recurrent layers remove the spectral ordering of the features. Table 4 keeps 7 recurrent layers and one fully connected layer and varies only the convolution, with about 35 million parameters and with BatchNorm and SortaGrad.
On the regular development set, one 1D layer gives 9.52 and three 2D layers give 8.61. On the noisy development set the values are 19.36 and 14.74. Multiple 1D layers give a very small benefit on the regular set, while 2D layers improve results substantially on noisy data. Moving from one 1D layer to three 2D layers improves noisy WER by 23.9%.
The regular set is 2048 utterances of primarily read speech, and the noisy set is 2048 utterances sampled from the CHiME 2015 development data.
Striding and bigram outputs for English
Striding reduces the number of time steps seen by the recurrent layers, which saves computation but can cost accuracy. In English each output step must carry at least one character, and the English character rate per step is high enough that a stride of 2 already causes trouble.
Non-overlapping bigrams pack two graphemes into one label, which shortens the output transcription and makes larger strides usable. They are chosen because they are simple to build and few in number compared with whole words.
Without a language model, unigram output at stride 2 gives 14.93 development WER and at stride 4 gives 18.86. Bigram output at stride 4 gives 14.84, close to 14.56 at stride 2, but bigram output at stride 3 gives 15.60, which is worse than both, so the trend over stride is not monotone.
For Mandarin the authors apply striding in the straightforward way, since the character output does not have the same per-step constraint.
Language model gains and the Mandarin output set
An external language model lowers English development WER from 27.79 to 14.39 for the 5-layer model with 1 recurrent layer, and from 14.93 to 9.52 for the 9-layer model with 7 recurrent layers. For Mandarin, development CER falls from 9.80 to 7.13 and from 7.55 to 5.81 for the same two models.
The relative gain from the language model drops from 48% to 36% in English and from 27% to 23% in Mandarin as the model moves from 5 layers with 1 recurrent layer to 9 layers with 7. The authors hypothesize that the deeper network builds a stronger implicit language model.
The relative gain is larger in English, which the authors attribute to a Chinese character carrying more information than an English character.
For Mandarin the output layer covers about 6000 characters, including the Roman alphabet, since mixed Chinese-English transcripts are common. Out-of-vocabulary characters count as errors at evaluation, and the Mandarin test set has 0.74% of them. A character-level language model is used, and a beam size of 200 gives negligible CER degradation because beam search levels off at smaller beams.
Mandarin tones are not modeled explicitly and no pronunciation model is built, because the network outputs characters directly.
Synchronous data parallelism and GPU-side loss
Each GPU runs its own process, the gradients are summed with all-reduce, and the update is synchronous SGD, which the authors choose because it is reproducible and deterministic. The authors report that non-determinism in the system usually signals a serious bug, which makes reproducibility a debugging aid. On one node with 8 Titan X GPUs the system sustains 24 single-precision teraFLOP/second, about 45% of the theoretical peak, and on 16 GPUs about 50 teraFLOP/second overall.
The custom all-reduce is a ring algorithm built from MPI send and receive with CUDA kernels for the element-wise operations. Table 7 compares it with OpenMPI 1.8.5 for a full one-epoch English run, where the time ratio is 21.4 at 4 GPUs and 19.8 at 8 GPUs. For the 8 or 16 GPU runs used in practice the authors report 2.5× faster full training runs than with OpenMPI directly.
Originally the CTC loss ran on the CPU, which required transferring large activation matrices and consumed interconnect bandwidth that gradient exchange needed. Table 8 gives 5888.12 seconds of CPU CTC time per English epoch against 203.56 seconds on the GPU, a speedup of 28.9, and 1688.01 against 135.05 for Mandarin, a speedup of 12.5. The authors state that the GPU version saves 95 minutes per epoch in English and 25 minutes in Mandarin, a 10-20% cut in overall training time.
A custom allocator carves allocations from contiguous blocks with the buddy algorithm, preallocates all GPU memory at the start of training, and sets the CPU block size to 12GB. Activation memory dominates training memory: a 70M parameter, 9-layer network needs about 280 MB for its weights, while a batch of 64 seven-second utterances needs 1.5 GB for activations.
Training data, scaling and the human reference
English training uses 11,940 hours, made up of WSJ 80 hours, Switchboard 300, Fisher 2000, LibriSpeech 960, Baidu read 5000 and Baidu mixed 3600. The Mandarin system is trained on 9,400 hours.
Using 1% to 100% of the English data, regular development WER falls from 29.23 to 8.46 and noisy development WER from 50.97 to 13.59, for a 9-layer model with 2 layers of 2D convolution and 7 recurrent layers. Those models are trained for 20 epochs with Nesterov momentum SGD and a minibatch of 512 utterances, and the best development checkpoint is kept.
The human reference comes from two Amazon Mechanical Turk workers who transcribe each clip, typically about 5 seconds long, and the better of the two transcriptions is used. Existing ground truth is rarely more than 1% wrong, so the authors take disagreement between ground truth and human transcripts as a good heuristic for human-level performance.
Batched serving, the matrix kernel and beam pruning
Larger batches are more efficient but make users wait, so the system uses Batch Dispatch to assemble user streams into batches before forward propagation. The scheduler is eager: it starts the next batch as soon as the previous one completes, which the authors found reduces end-user latency best despite lower computational efficiency. On a single NVIDIA Quadro K1200 GPU with 10 to 30 concurrent requests, batching works best under heavy load, and even with 10 concurrent requests more than half the work runs in batches of at least 2 samples.
At 10 concurrent streams the system reaches a median latency of 44 ms and a 98th percentile of 70 ms. The introduction gives 67 ms for the 98th percentile compute latency at 10 simultaneous streams, so the two reports of the same load differ.
Deployment uses half-precision arithmetic, which the authors report does not measurably change recognition accuracy, since deployment makes no weight updates. The custom half-precision kernel stores A transposed and assigns four output rows to each warp. For N up to 4, B fits in L1 cache, and for 10 simultaneous streams over 90 percent of batches have N up to 4.
The kernel is reported to sustain higher throughput than the Nervana kernels and than NVIDIA CUBLAS version 7.0 across the batch sizes used in deployment.
Pruning to the fewest characters whose cumulative probability reaches 0.99, with at most 40 characters, speeds up the Mandarin language model lookup by a factor of 150x, with a negligible 0.1-0.3% relative CER effect.
On 2000 held-out utterances the research system reaches 5.81 CER and the deployed system 6.10, a 5% relative degradation.
Limitations
The development sets are an internal read-speech set and a sample of the CHiME 2015 development data, and the human references depend on a crowd platform and a 1% label-error heuristic. Accuracy at deployment is checked only on 2000 held-out utterances.
The GRU advantage appears to diminish when models grow to as many as 100 million parameters. The sorting benefit is shown for one 9-layer configuration in Table 2, and the cause the authors give is a suspicion they do not separately test.
The English stride trend is not monotone, since bigram output at stride 3 is worse than at stride 2 and stride 4. Batch Dispatch is described for 10 to 30 concurrent requests, and its eager scheme trades computational efficiency for latency.
Paper info
- Authors
- Dario Amodei, Rishita Anubhai, Eric Battenberg, Carl Case, Jared Casper, Bryan Catanzaro, Jingdong Chen, Mike Chrzanowski, Adam Coates, Greg Diamos, Erich Elsen, Jesse Engel, Linxi Fan, Christopher Fougner, Tony Han, Awni Hannun, Billy Jun, Patrick LeGresley, Libby Lin, Sharan Narang, Andrew Ng, Sherjil Ozair, Ryan Prenger, Jonathan Raiman, Sanjeev Satheesh, David Seetapun, Shubho Sengupta, Yi Wang, Zhiqian Wang, Chong Wang, Bo Xiao, Dani Yogatama, Jun Zhan, Zhenyao Zhu
- Venue
- arXiv · Preprint
- First published
- 2015-12-8
- Added
- 2026-11-12
- Updated
- 2015-12-8
- Version
- v1
- arXiv
- 1512.02595
- Category
- cs.CL
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Dario Amodei, Rishita Anubhai, Eric Battenberg, Carl Case, Jared Casper, Bryan Catanzaro, Jingdong Chen, Mike Chrzanowski, Adam Coates, Greg Diamos, Erich Elsen, Jesse Engel, Linxi Fan, Christopher Fougner, Tony Han, Awni Hannun, Billy Jun, Patrick LeGresley, Libby Lin, Sharan Narang et al. (2015). Deep Speech 2: End-to-End Speech Recognition in English and Mandarin. arXiv:1512.02595v1. https://arxiv.org/abs/1512.02595v1
BibTeX
@misc{amodei2015deep,
title = {{Deep Speech 2: End-to-End Speech Recognition in English and Mandarin}},
author = {Dario Amodei and Rishita Anubhai and Eric Battenberg and Carl Case and Jared Casper and Bryan Catanzaro and Jingdong Chen and Mike Chrzanowski and Adam Coates and Greg Diamos and Erich Elsen and Jesse Engel and Linxi Fan and Christopher Fougner and Tony Han and Awni Hannun and Billy Jun and Patrick LeGresley and Libby Lin and Sharan Narang and Andrew Ng and Sherjil Ozair and Ryan Prenger and Jonathan Raiman and Sanjeev Satheesh and David Seetapun and Shubho Sengupta and Yi Wang and Zhiqian Wang and Chong Wang and Bo Xiao and Dani Yogatama and Jun Zhan and Zhenyao Zhu},
year = {2015},
eprint = {1512.02595},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1512.02595v1}
}