All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Deep Neural Networks in Kaldi


Deep Neural Networks (DNNs) are the latest hot topic in speech recognition. Since around 2010 many papers have been published in this area, and some of the largest companies (e.g. Google, Microsoft) are starting to use DNNs in their production systems.

An active area of research like this is difficult for a toolkit like Kaldi to support well, because the state of the art changes constantly which means code changes are required to keep up, and architectural decisions may need to be rethought.

We currently have two separate codebases for deep neural nets in Kaldi. One is located in code subdirectories nnet/ and nnetbin/, and is primiarly maintained by Karel Vesely. The other is located in code subdirectories nnet2/ and nnet2bin/, and is primarily maintained by Daniel Povey (this code was originally based on an earlier version of Karel's code, but it has been extensively rewritten). Neither codebase is more ``official'' than the other. Both are still being developed in parallel.

In the example directories such as egs/wsj/s5/, egs/rm/s5, egs/swbd/s5 and egs/hkust/s5b, neural net example scripts can be found. Karel's example scripts can be found in local/nnet/, and Dan's example scripts can be found in local/ Before running those scripts, the first stages of ``'' in those directories must be run in order to build the systems used for alignment.

Regarding which of the two setups you should use:

  • Karel's setup (nnet1) supports training on a single GPU card, which allows the implementation to be simpler and relatively easy to modify.
  • Dan's setup (nnet2) is more flexible in how you can train: it supports using multiple GPUs, or multiple CPU's each with multiple threads. Multiple GPU's is the recommended setup. They don't have to all be on the same machine. Both setups give commensurate results.

Between the two setups there are many differences in the recipes. For example, Karel's setup uses pre-training but Dan's setup does not; Karel's setup uses early stopping using a validation set but Dan's setup uses a fixed number of epochs and averages the parameters over the last few epochs of training. Most other details of the training (nonlinearity types, learning rate schedules, network topology, input features etc.) also differ.

The best published descriptions of the DNN setups are:

The setups use incompatible DNN formats, while there is a converter of Karel's network into Dan's format Conversion of a DNN model between nnet1 -> nnet2.

Documentation for Karel's version is available at Karel's DNN implementation and documentation for Dan's version is available at Dan's DNN implementation.