# Kaldi

> The C++ speech-recognition toolkit built on finite-state transducers

- Category: Multimodal Generation / Audio, Music & Voice
- Language: C++
- Licence: Apache-2.0
- Repository: https://github.com/kaldi-asr/kaldi
- Website: https://kaldi-asr.org
- Canonical page: https://ai-tldr.dev/tools/kaldi/

## In short

Kaldi is a speech-recognition toolkit written in C++, and for years it was the default starting point for building an automatic speech recognition system in research and industry. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in C++ and licensed Apache-2.0.

## Overview

Kaldi is a speech-recognition toolkit written in C++, and for years it was the default starting point for building an automatic speech recognition system in research and industry. It is a library plus a large set of command-line binaries: feature extraction, acoustic model training, lattice generation and decoding are each their own program, wired together by shell scripts rather than hidden behind one API call.

Its organising idea is the weighted finite-state transducer. Pronunciation lexicons, language models and acoustic model topologies are all compiled into transducers and composed into a single decoding graph, which is what the decoder searches. Kaldi builds on the OpenFst library for this, and that composition step is why the toolkit generalises across languages and tasks without special-casing each one.

The `egs/` directory is as important as the code: it holds example recipes that build an end-to-end system on a specific corpus, from data preparation through to scoring, and those recipes are the usual way people learn the toolkit and adapt it to their own audio. Kaldi predates the current end-to-end neural ASR tools and is the ancestor several of them acknowledge — its data formats, recipe layout and scoring conventions still show up across the speech ecosystem.

## What it does

- Finite-state-transducer decoding built on OpenFst, composing lexicon, language model and acoustic model into one graph
- Standard speech feature extraction — MFCC, filterbank and PLP front ends — as reusable command-line tools
- Acoustic model training covering GMM-HMM systems and neural network chains
- Lattice generation, rescoring and scoring utilities for measuring word error rate
- The egs/ recipe collection, which builds complete systems on public corpora end to end
- C++ library APIs with extensive Doxygen reference documentation on the project site

## Getting started

Kaldi is built from source in two stages: first the third-party tools it depends on, then the toolkit itself. The commands below follow the repository's tools/INSTALL and src/INSTALL files.

1. Clone the repository

   Kaldi is built in place — there is no package install.

```bash
git clone https://github.com/kaldi-asr/kaldi.git
cd kaldi
```

2. Check dependencies and build the tools directory

   check_dependencies.sh reports any system packages you still need. make then installs ATLAS headers, OpenFst, SCTK and sph2pipe; pass -j to build in parallel.

```bash
cd tools
extras/check_dependencies.sh
make -j 4
```

3. Configure and build the toolkit

   Then build src/. The make step takes a long time, so choose a -j value that matches your machine.

```bash
cd ../src
./configure --shared
make depend -j 8
make -j 8
```

4. Run an example recipe

   See egs/README.txt for the list of example system builds. Each recipe directory prepares its corpus, trains models and scores the result, and is the intended template for adapting Kaldi to your own data.

## When to use it

- Build a speech-recognition system for a language or domain where no off-the-shelf model performs well
- Force-align audio to a known transcript to get word- and phone-level timings
- Reproduce or extend a published ASR result using the matching recipe in egs/
- Study or teach the WFST approach to decoding with a reference implementation
