<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>RUSSIAN-LANGUAGE SPEECH RECOGNITION SYSTEM BASED ON DEEPSPEECH</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>O.O. Iakushkin</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>G.A. Fedoseev</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>A.S. Shaleva</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>A.B. Degtyarev</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>O.S. Sedova</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Saint Petersburg State University</institution>
          ,
          <addr-line>7/9 Universitetskaya nab., St. Petersburg, 199034</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2018</year>
      </pub-date>
      <fpage>470</fpage>
      <lpage>474</lpage>
      <abstract>
        <p>The paper examines the practical issues in developing a speech-to-text system using deep neural networks. The development of a Russian-language speech recognition system based on DeepSpeech architecture is described. The Mozilla company's open source implementation of DeepSpeech for the English language was used as a starting point. The system was trained in a containerized environment using the Docker technology. It allowed to describe the entire process of component assembly from the source code, including a number of optimization techniques for CPU and GPU. Docker also allows to easily reproduce computation optimization tests on alternative infrastructures. We examined the use of TensorFlow XLA technology that optimizes linear algebra computations in the course of neural network training. The number of nodes in the internal layers of neural network was optimized based on the word error rate (WER) obtained on a test data set, having regard to GPU memory limitations. We studied the use of probabilistic language models with various maximum lengths of word sequences and selected the model that shows the best WER. Our study resulted in a Russian-language acoustic model having been trained based on a data set comprising audio and subtitles from YouTube video clips. The language model was built based on the texts of subtitles and publicly available Russian-language corpus of Wikipedia's popular articles. The resulting system was tested on a data set consisting of audio recordings of Russian literature available on voxforge.com-the best WER demonstrated by the system was 18%.</p>
      </abstract>
      <kwd-group>
        <kwd>Deep Neural Network</kwd>
        <kwd>Speech</kwd>
        <kwd>Neural Network Training</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Currently there are few open source speech recognition systems with close-to-human quality
of performance. It is especially true for the Russian language. This paper describes the use of deep
neural networks to build an open source speech recognition system. The system is designed to
recognize Russian-language speech segments with the average duration of 5-15 seconds in a cleaned
dataset. The system is intended to deliver the average WER (Word Error Rate) under 30%.</p>
      <p>
        Mozilla DeepSpeech, an open source end-to-end DNN architecture, was chosen as the starting
point for our system. Mozilla DeepSpeech is based on the papers of Baidu Research team [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. It was
launched in May 2016 and reached the lowest WER of 6.5% on the LibriSpeech ‘test-clean’ dataset
for the English language in November 2017. The architecture of Mozilla DeepSpeech is not tied to any
particular language and employs the TensorFlow machine learning framework to describe the structure
of neural network and optimize computations.
      </p>
      <p>The Word Error Rate (WER) metric is used to evaluate the model’s quality at the word level.
The WER is a normalized Levenshtein distance between two word sequences that is averaged for all
samples. The WER is defined as follows: WER = (I + D + S) / N, where I is the number of insertions,
D is the number of deletions, S is the number of substitutions, and N is the number of words in the
reference.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Approach</title>
      <p>
        Many contemporary end-to-end speech recognition systems are based on the Connectionist
Temporal Classification (CTC)—an approach that has become a major breakthrough since it was
introduced by Alex Graves in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. It describes the output layer of the neural network and the loss
function computed based on its values. The CTC does not restrict the choice of network architecture
and eliminates the need for meticulous data annotation in sequence recognition tasks [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. In speech
recognition, the problem of data annotation lies in the need to align the sequences of audio frames and
sequences of letters in conditions where one character may correspond to many audio frames. The
CTC method also provides a differentiable function called the CTC loss function: it applies to machine
learning by the stochastic gradient descent method.
      </p>
      <sec id="sec-2-1">
        <title>2.1. Acoustic model</title>
        <p>Let us introduce a set of characters A (the alphabet) that has the length of [A] and consists of
lowercase letters of the language in question. Let us also consider the alphabet A' = A∪{blank
character} with the length of [A'] = n. The blank character here is required for the CTC method. Let us
then consider the input sequence of x feature vectors and of the length T. Each feature vector in the
sequence is the result of mel-frequency cepstral coefficients (MFCC) extraction from a short audio
signal that usually has the duration of 20 milliseconds. The extracted MFCC features provide a
quantitative description of the audio and will be further used for symbol prediction. The MFCC
extraction algorithm allows to define the number of features (let it be m).</p>
        <p>Let us also define a recurrent neural network with m inputs, n outputs, and the weight vector
ω. The weight vector determines the representation Nω that transforms the input sequence x to a
sequence of length vectors n: Nω : (Rm)T → (Rn)T.</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Neural network structure</title>
        <p>We use a neural network that consists of five hidden layers. The input layer has m inputs that
correspond to m MFCC features derived from a short audio signal. The second and third layers are
similar to the first one. As regards the first three layers, the nodes in the neighbouring layers are fully
connected and use the activation function called ReLU (Rectifier Linear Unit): ReLU(x) = max(0,x).
The forth layer is a bidirectional recurrent layer with LSTM units that uses the hyperbolic tangent as
the activation function. The result goes to the fifth layer having ReLU as the activation function.
Finally, there is the output layer sized n = [A'], where the output value of each node is proportional to
the probability of the respective character of the alphabet. Dropout is applied to all five layers with the
probability of 0.3 in order to prevent the neural network from overtraining.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Training Details</title>
      <p>The neural network is trained on aligned audio-transcript pairs. The training dataset is divided
into three subsets (train set, dev set and test set) with the proportion of 60:20:20 respectively.</p>
      <p>The following algorithm is used for training:
1. The MFCC feature vectors extracted from an audio signal are fed to the input layer of the
neural network.</p>
      <p>2. The data are transformed by weight values, which results in a prediction matrix of symbol s.
Each column in the matrix is a probability distribution of characters from the alphabet A' for the time t.</p>
      <p>
        3. The CTC loss function is computed for a particular sample based on the prediction matrix
and the expected (reference) transcript. The loss function’s value is used to adjust the weights ω in
neural network N. The adjustment employs the Adam algorithm, which is a modification of stochastic
gradient descent method [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>4. The described process is reiterated as long as the error value (obtained on a validation set)
continues to decrease—that is, the acoustic model is being enhanced in an iterative manner. The neural
network’s weights are updated based on the CTC loss function’s mean value obtained for a group of
samples.</p>
      <p>
        The DeepSpeech architecture employs a probabilistic language model to improve the accuracy
of speech recognition. This model is essentially a dataset that contains the estimate probabilities of
word sequences in a language. Each sequence ranges in length from 1 to N and has a number assigned
to it—this number corresponds to the probability of such sequence. Word sequences that consist of n
words are called n-grams. The maximum number N that corresponds to the length of a word sequence
defines the dimension of the model. If the length of a sequence exceeds the model’s dimension or the
sequence is not found in a dataset, the probability of such sequence is estimated by reference to the
probability of shorter sequences (down to a unigram) it consists of. Mozilla DeepSpeech uses KenLM
toolkit [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] to make queries to the language model. The principles of building a probabilistic language
model are described in [5; 6].
      </p>
      <p>The language model is used in the beam search algorithm to increase the probability of beams
that comprise word sequences used more frequently. It allows to reduce the probability of beams that
contain mistakes or unrealistic sequences.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Experiments</title>
      <p>We used a computer provided by the SPbU Computing Center to make computations required
by our task. The computer’s technical parameters are as follows:
- CPU: 2 x Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.60 GHz;
- RAM: 256 GB;
- GPUs: 2 x Nvidia Tesla P100, 16 GB each.</p>
      <sec id="sec-4-1">
        <title>4.1. Training hyperparameters</title>
        <p>
          The following hyperparameters allow to fine-tune the training process:
1. n_hidden. The number of nodes in the hidden layers of the neural network. It is
recommended that this parameter should be defined in accordance with the amount and variety of
training data [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]. In Mozilla DeepSpeech, the default value was set at 2048 for the English-language
training model. The maximum value is limited by the video memory available.
        </p>
        <p>2. learning_rate. The standard learning rate in Mozilla DeepSpeech is 0.0001.</p>
        <p>3. epoch. The number of epochs, where an epoch is one complete forward pass and one
complete backward pass of all the training samples in a dataset.
4. train_batch_size, dev_batch_size, test_batch_size – the number of samples in each of the
batches used respectively for training, validation and testing. This should be set at the maximum value
allowed by the video memory (usually from 8 to 64).</p>
        <p>
          5. dropout_rate – the probability of a node dropout during one training step. This papameter is
believed to prevent the network from overtraining [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. The default value is 0.3.
4.2. Data
        </p>
        <p>Deep neural networks require 500-2000 hours of recorded speech with corresponding
transcripts for speech recognition training. We studied several speech sources in Russian and various
methods of automatic dataset building. The resulting training dataset includes:
- ‘yt-vad-1k’, a corpus containing about 1000 hours of audio recordings extracted from videos
on YouTube that have been created by over 1000 people in a variety of recording conditions
and with varying degree of background noise. The corpus also contains both user-provided
and auto-generated subtitles (automatic captions) for the extracted audio;
- ‘voxforge-ru-clean’, a corpus containing 11.5 hours of audio from voxforge.org with
transcripts;
- ‘yt-vad-650-clean’, a corpus of cleaned audio samples that contains 650 hours of audio.</p>
        <p>The audio files are in the ‘wav’ format and have one audio channel (mono), the sample rate of
16,000 Hz, and the depth of 16 bit for each value. The ratio between the audio length and the number
of symbols in the transcript is subject to a restriction that follows from the CTC matrix’s decoding
algorithm—namely, the number of steps in the CTC matrix must exceed the number of symbols in the
transcript</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.3. Training</title>
        <p>We obtained the minimum WER of 27% as the result of training on the ‘yt-vad-1k-train’
dataset. The use of the language model allowed to reduce WER by 10% on ‘voxforge-ru-clean-test’
dataset.</p>
        <p>The model trained on the ‘yt-vad-650-clean’ corpus—which was cleaner than ‘yt-vad-1k’—
showed a slight increase in the minimum WER. It can be explained by a smaller amount of data—650
hours compared to 1000 hours in the first experiment. However, testing with the language model
delivers better WER in both experiments.</p>
        <p>We managed to reduce the minimum WER from 27% down to 22% by means of further
training the model already pre-trained on ‘yt-vad-1k’.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Acknowledgement</title>
      <p>This research was supported by SPbU (Saint Petersburg State University) grant no.
AAAAA18-118071790047-9 (id: 28612502). The authors would like to acknowledge the Reviewers for the
valuable recommendations that helped in the improvement of this paper.</p>
    </sec>
    <sec id="sec-6">
      <title>6. Conclusion References</title>
      <p>We have developed a Russian-language speech recognition system that delivers the WER of
22% on the ‘voxforge-ru-clean-test’ dataset. We have employed it to perform speech-based text search
in a large collection of video. This system can be useful in a variety of tasks involving speech-based
search, though a higher recognition accuracy is required in such tasks as speech recognition by voice
assistants. The improvement of speech recognition accuracy will be the goal of further research.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Hannun</surname>
            <given-names>A.</given-names>
          </string-name>
          , et. al
          <article-title>Deep speech: Scaling up end-to-end speech recognition /</article-title>
          / arXiv preprint arXiv:
          <volume>1412</volume>
          .
          <fpage>5567</fpage>
          . -
          <lpage>2014</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Graves</surname>
            <given-names>A.</given-names>
          </string-name>
          , et. al
          <article-title>Connectionist temporal classification: labelling unsegmented sequence data with recurrent neural networks //</article-title>
          <source>Proceedings of the 23rd international conference on Machine learning. ACM</source>
          .
          <year>2006</year>
          , pp.
          <fpage>369</fpage>
          -
          <lpage>376</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Graves</surname>
            <given-names>A.</given-names>
          </string-name>
          <article-title>Supervised sequence labelling // Supervised sequence labelling with recurrent neural networks</article-title>
          . Springer,
          <year>2012</year>
          , pp.
          <fpage>52</fpage>
          -
          <lpage>73</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Kingma</surname>
            <given-names>D. P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ba</surname>
            <given-names>J</given-names>
          </string-name>
          .
          <string-name>
            <surname>Adam</surname>
          </string-name>
          :
          <article-title>A method for stochastic optimization</article-title>
          // arXiv preprint arXiv:
          <volume>1412</volume>
          .
          <fpage>6980</fpage>
          . -
          <lpage>2014</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Heafield</surname>
            <given-names>K.</given-names>
          </string-name>
          <article-title>KenLM: Faster and smaller language model queries //</article-title>
          <source>Proceedings of the Sixth Workshop on Statistical Machine Translation. - Association for Computational Linguistics</source>
          .
          <year>2011</year>
          ., pp.
          <fpage>187</fpage>
          -
          <lpage>197</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Heafield</surname>
            <given-names>K.</given-names>
          </string-name>
          , et al.
          <article-title>Scalable modified Kneser-Ney language model estimation // Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics</article-title>
          (Volume
          <volume>2</volume>
          :
          <string-name>
            <surname>Short</surname>
            <given-names>Papers)</given-names>
          </string-name>
          , Vol.
          <volume>2</volume>
          ,
          <year>2013</year>
          ., pp.
          <fpage>690</fpage>
          -
          <lpage>696</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Weigend</surname>
            <given-names>A.</given-names>
          </string-name>
          <article-title>On overfitting and the effective number of hidden units // Proceedings of the 1993 connectionist models summer school</article-title>
          , Vol.
          <volume>1</volume>
          ,
          <issue>1994</issue>
          , pp.
          <fpage>335</fpage>
          -
          <lpage>342</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Srivastava</surname>
            <given-names>N.</given-names>
          </string-name>
          , et al.
          <article-title>Dropout: A simple way to prevent neural networks from overfitting //</article-title>
          <source>The Journal of Machine Learning Research</source>
          <year>2014</year>
          , Vol.
          <volume>15</volume>
          , pp.
          <fpage>1929</fpage>
          -
          <lpage>1958</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>