# flashlight/wav2letter architecture

> Architecture diagram of the GitHub repository flashlight/wav2letter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/flashlight/wav2letter
- Repository: https://github.com/flashlight/wav2letter

## Overview

wav2letter++ is a research-oriented speech-recognition repository: dataset preparation supports recipes for training and evaluating ASR systems, with recipe-specific language-model, semi-supervised, and decoding work. The README identifies several paper-reproduction recipes; the tree also contains CPC, local-prior-matching, and slimIPL implementations. The map emphasizes those documented capabilities and sampled runtime modules. Some recipe internals are unsampled, so their connections are omitted rather than inferred.

Main entry points: [`recipes/joint_training_vox_populi/cpc/Train.cpp`](https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/Train.cpp) (CPC training), [`data`](https://github.com/flashlight/wav2letter/tree/main/data) (Dataset preparation), [`recipes/streaming_convnets/inference/inference/module/InferenceModule.h`](https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/module/InferenceModule.h) (Inference modules), [`data/ami/prepare.py`](https://github.com/flashlight/wav2letter/blob/main/data/ami/prepare.py) (AMI preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_data_prep["Dataset preparation"]
  node_ami["AMI preparation<br/>[prepare.py]"]
  node_ami_utils["Audio segmentation<br/>[utils.py]"]
  node_librispeech["LibriSpeech preparation<br/>[prepare.py]"]
  node_wsj["WSJ preparation<br/>[prepare.py]"]
  node_common_voice["Common Voice conversion"]
end

subgraph group_recipes["ASR recipes"]
  node_seq2seq_tds["TDS seq2seq"]
  node_lexicon_free["Lexicon-free ASR"]
  node_lm_utilities["LM utilities<br/>[convlm_utils.py]"]
  node_self_training["Self-training"]
  node_pseudo_label["Pseudo-label data"]
  node_sota["SOTA recipes"]
end

subgraph group_research["Training research"]
  node_cpc_train["CPC training<br/>[Train.cpp]"]
  node_cpc_criterion["CPC criterion<br/>[CPCCriterion.h]"]
  node_cpc_augment["CPC augmentation<br/>[CPCSpecAugment.h]"]
  node_cpc_mtl["Multi-task loss<br/>[MTLLoss.h]"]
  node_cpc_builder["Network builder"]
  node_local_prior["Local prior matching<br/>[Train_lpm.cpp]"]
  node_local_runtime["LPM runtime<br/>[runtime.h]"]
  node_slimipl["SlimIPL training<br/>[Train.cpp]"]
  node_slim_logger["Training logger<br/>[MyLogger.h]"]
end

subgraph group_streaming["Streaming inference"]
  node_streaming_recipe["Streaming ConvNets"]
  node_decoder["Streaming decoder<br/>[Decoder.cpp]"]
  node_inference_module["Inference modules<br/>[InferenceModule.h]"]
  node_processing_state["Processing state"]
  node_memory_manager["Memory manager<br/>[MemoryManager.h]"]
  node_default_manager["Default allocator"]
  node_io_buffer["I/O buffers<br/>[IOBuffer.h]"]
end

node_user(("ASR practitioner"))

node_user -->|"prepares data"| node_data_prep
node_data_prep -->|"includes"| node_ami
node_data_prep -->|"includes"| node_librispeech
node_data_prep -->|"includes"| node_wsj
node_ami -->|"uses helpers"| node_ami_utils
node_user -->|"reproduces research"| node_seq2seq_tds
node_user -->|"reproduces research"| node_lexicon_free
node_user -->|"reproduces research"| node_self_training
node_user -->|"reproduces research"| node_sota
node_user -->|"reproduces research"| node_streaming_recipe
node_user -.->|"trains model"| node_cpc_train
node_user -.->|"trains model"| node_local_prior
node_user -.->|"trains model"| node_slimipl
node_lexicon_free -.->|"includes utilities"| node_lm_utilities
node_self_training -.->|"includes"| node_pseudo_label
node_cpc_train -->|"uses criterion"| node_cpc_criterion
node_cpc_train -->|"uses augmentation"| node_cpc_augment
node_cpc_train -->|"uses loss"| node_cpc_mtl
node_cpc_train -->|"uses builder"| node_cpc_builder
node_local_prior -->|"uses runtime"| node_local_runtime
node_slimipl -->|"uses logger"| node_slim_logger
node_streaming_recipe -.->|"provides decoder"| node_decoder
node_inference_module -->|"allocates through"| node_memory_manager
node_inference_module -->|"passes state"| node_processing_state
node_default_manager -->|"implements"| node_memory_manager
node_processing_state -->|"uses buffers"| node_io_buffer

click node_data_prep "https://github.com/flashlight/wav2letter/tree/main/data"
click node_ami "https://github.com/flashlight/wav2letter/blob/main/data/ami/prepare.py"
click node_ami_utils "https://github.com/flashlight/wav2letter/blob/main/data/ami/utils.py"
click node_librispeech "https://github.com/flashlight/wav2letter/blob/main/data/librispeech/prepare.py"
click node_wsj "https://github.com/flashlight/wav2letter/blob/main/data/wsj/prepare.py"
click node_common_voice "https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/prepare_data/common_voice_to_wav2letter.py"
click node_seq2seq_tds "https://github.com/flashlight/wav2letter/tree/main/recipes/seq2seq_tds"
click node_lexicon_free "https://github.com/flashlight/wav2letter/tree/main/recipes/lexicon_free"
click node_lm_utilities "https://github.com/flashlight/wav2letter/blob/main/recipes/lexicon_free/utilities/convlm_utils.py"
click node_self_training "https://github.com/flashlight/wav2letter/tree/main/recipes/self_training"
click node_pseudo_label "https://github.com/flashlight/wav2letter/blob/main/recipes/self_training/pseudo_labeling/generate_synthetic_data.py"
click node_sota "https://github.com/flashlight/wav2letter/tree/main/recipes/sota/2019"
click node_streaming_recipe "https://github.com/flashlight/wav2letter/tree/main/recipes/streaming_convnets"
click node_decoder "https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/decoder/Decoder.cpp"
click node_inference_module "https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/module/InferenceModule.h"
click node_processing_state "https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/module/ModuleProcessingState.h"
click node_memory_manager "https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/common/MemoryManager.h"
click node_default_manager "https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/common/DefaultMemoryManager.cpp"
click node_io_buffer "https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/common/IOBuffer.h"
click node_cpc_train "https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/Train.cpp"
click node_cpc_criterion "https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/CPCCriterion.h"
click node_cpc_augment "https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/CPCSpecAugment.h"
click node_cpc_mtl "https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/MTLLoss.h"
click node_cpc_builder "https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/SequentialBuilder.h"
click node_local_prior "https://github.com/flashlight/wav2letter/blob/main/recipes/local_prior_match/Train_lpm.cpp"
click node_local_runtime "https://github.com/flashlight/wav2letter/blob/main/recipes/local_prior_match/src/runtime/runtime.h"
click node_slimipl "https://github.com/flashlight/wav2letter/blob/main/recipes/slimIPL/src/Train.cpp"
click node_slim_logger "https://github.com/flashlight/wav2letter/blob/main/recipes/slimIPL/src/MyLogger.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_data_prep,node_ami,node_ami_utils,node_librispeech,node_wsj,node_common_voice toneBlue
class node_seq2seq_tds,node_lexicon_free,node_lm_utilities,node_self_training,node_pseudo_label,node_sota toneAmber
class node_cpc_train,node_cpc_criterion,node_cpc_augment,node_cpc_mtl,node_cpc_builder,node_local_prior,node_local_runtime,node_slimipl,node_slim_logger toneMint
class node_streaming_recipe,node_decoder,node_inference_module,node_processing_state,node_memory_manager,node_default_manager,node_io_buffer toneRose
class node_user toneIndigo
```

## Components

### Data preparation

- [Dataset preparation](https://github.com/flashlight/wav2letter/tree/main/data): `data`
- [AMI preparation](https://github.com/flashlight/wav2letter/blob/main/data/ami/prepare.py): `data/ami/prepare.py`
- [Audio segmentation](https://github.com/flashlight/wav2letter/blob/main/data/ami/utils.py): `data/ami/utils.py`
- [LibriSpeech preparation](https://github.com/flashlight/wav2letter/blob/main/data/librispeech/prepare.py): `data/librispeech/prepare.py`
- [WSJ preparation](https://github.com/flashlight/wav2letter/blob/main/data/wsj/prepare.py): `data/wsj/prepare.py`
- [Common Voice conversion](https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/prepare_data/common_voice_to_wav2letter.py): `recipes/joint_training_vox_populi/prepare_data/common_voice_to_wav2letter.py`

### ASR recipes

- [TDS seq2seq](https://github.com/flashlight/wav2letter/tree/main/recipes/seq2seq_tds): `recipes/seq2seq_tds`
- [Lexicon-free ASR](https://github.com/flashlight/wav2letter/tree/main/recipes/lexicon_free): `recipes/lexicon_free`
- [LM utilities](https://github.com/flashlight/wav2letter/blob/main/recipes/lexicon_free/utilities/convlm_utils.py): `recipes/lexicon_free/utilities/convlm_utils.py`
- [Self-training](https://github.com/flashlight/wav2letter/tree/main/recipes/self_training): `recipes/self_training`
- [Pseudo-label data](https://github.com/flashlight/wav2letter/blob/main/recipes/self_training/pseudo_labeling/generate_synthetic_data.py): `recipes/self_training/pseudo_labeling/generate_synthetic_data.py`
- [SOTA recipes](https://github.com/flashlight/wav2letter/tree/main/recipes/sota/2019): `recipes/sota/2019`

### Training research

- [CPC training](https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/Train.cpp): `recipes/joint_training_vox_populi/cpc/Train.cpp`
- [CPC criterion](https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/CPCCriterion.h): `recipes/joint_training_vox_populi/cpc/CPCCriterion.h`
- [CPC augmentation](https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/CPCSpecAugment.h): `recipes/joint_training_vox_populi/cpc/CPCSpecAugment.h`
- [Multi-task loss](https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/MTLLoss.h): `recipes/joint_training_vox_populi/cpc/MTLLoss.h`
- [Network builder](https://github.com/flashlight/wav2letter/blob/main/recipes/joint_training_vox_populi/cpc/SequentialBuilder.h): `recipes/joint_training_vox_populi/cpc/SequentialBuilder.h`
- [Local prior matching](https://github.com/flashlight/wav2letter/blob/main/recipes/local_prior_match/Train_lpm.cpp): `recipes/local_prior_match/Train_lpm.cpp`
- [LPM runtime](https://github.com/flashlight/wav2letter/blob/main/recipes/local_prior_match/src/runtime/runtime.h): `recipes/local_prior_match/src/runtime/runtime.h`
- [SlimIPL training](https://github.com/flashlight/wav2letter/blob/main/recipes/slimIPL/src/Train.cpp): `recipes/slimIPL/src/Train.cpp`
- [Training logger](https://github.com/flashlight/wav2letter/blob/main/recipes/slimIPL/src/MyLogger.h): `recipes/slimIPL/src/MyLogger.h`

### Streaming inference

- [Streaming ConvNets](https://github.com/flashlight/wav2letter/tree/main/recipes/streaming_convnets): `recipes/streaming_convnets`
- [Streaming decoder](https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/decoder/Decoder.cpp): `recipes/streaming_convnets/inference/inference/decoder/Decoder.cpp`
- [Inference modules](https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/module/InferenceModule.h): `recipes/streaming_convnets/inference/inference/module/InferenceModule.h`
- [Processing state](https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/module/ModuleProcessingState.h): `recipes/streaming_convnets/inference/inference/module/ModuleProcessingState.h`
- [Memory manager](https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/common/MemoryManager.h): `recipes/streaming_convnets/inference/inference/common/MemoryManager.h`
- [Default allocator](https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/common/DefaultMemoryManager.cpp): `recipes/streaming_convnets/inference/inference/common/DefaultMemoryManager.cpp`
- [I/O buffers](https://github.com/flashlight/wav2letter/blob/main/recipes/streaming_convnets/inference/inference/common/IOBuffer.h): `recipes/streaming_convnets/inference/inference/common/IOBuffer.h`

### Other components

- **ASR practitioner**

## Connections

- ASR practitioner → Dataset preparation: prepares data
- Dataset preparation → AMI preparation: includes (evidence: `data/ami/prepare.py`)
- Dataset preparation → LibriSpeech preparation: includes (evidence: `data/librispeech/prepare.py`)
- Dataset preparation → WSJ preparation: includes (evidence: `data/wsj/prepare.py`)
- AMI preparation → Audio segmentation: uses helpers (evidence: `data/ami/prepare.py`)
- ASR practitioner → TDS seq2seq: reproduces research
- ASR practitioner → Lexicon-free ASR: reproduces research
- ASR practitioner → Self-training: reproduces research
- ASR practitioner → SOTA recipes: reproduces research
- ASR practitioner → Streaming ConvNets: reproduces research
- ASR practitioner → CPC training: trains model
- ASR practitioner → Local prior matching: trains model
- ASR practitioner → SlimIPL training: trains model
- Lexicon-free ASR → LM utilities: includes utilities (evidence: `recipes/lexicon_free/utilities/compute_lower_ppl_convlm.py`)
- Self-training → Pseudo-label data: includes (evidence: `recipes/self_training/pseudo_labeling/generate_synthetic_data.py`)
- CPC training → CPC criterion: uses criterion (evidence: `recipes/joint_training_vox_populi/cpc/Train.cpp`)
- CPC training → CPC augmentation: uses augmentation (evidence: `recipes/joint_training_vox_populi/cpc/Train.cpp`)
- CPC training → Multi-task loss: uses loss (evidence: `recipes/joint_training_vox_populi/cpc/Train.cpp`)
- CPC training → Network builder: uses builder (evidence: `recipes/joint_training_vox_populi/cpc/Train.cpp`)
- Local prior matching → LPM runtime: uses runtime (evidence: `recipes/local_prior_match/Train_lpm.cpp`)
- SlimIPL training → Training logger: uses logger (evidence: `recipes/slimIPL/src/Train.cpp`)
- Streaming ConvNets → Streaming decoder: provides decoder
- Inference modules → Memory manager: allocates through (evidence: `recipes/streaming_convnets/inference/inference/module/InferenceModule.h`)
- Inference modules → Processing state: passes state (evidence: `recipes/streaming_convnets/inference/inference/module/InferenceModule.h`)
- Default allocator → Memory manager: implements
- Processing state → I/O buffers: uses buffers (evidence: `recipes/streaming_convnets/inference/inference/module/ModuleProcessingState.h`)
