HMM Graph Compatibility Transition to End-to-End Neural Architectures
0 reputation · 11 Jan 2020, 11:06 UTC
0 reputation · 11 Jan 2020, 11:06 UTC
Kaldi maintains a distinct boundary between legacy HMM-based models and modern end-to-end neural architectures. Each approach requires a specific graph-processing pipeline to ensure that the feature extractor and the decoder are aligned.
When transitioning a deployment from HMM-based decoding to neural architectures, the configuration of the scf file and the associated .fst model files must change to accommodate different feature dimensions and topology requirements. There is uncertainty regarding how to maintain consistent word-error rates when the Viterbi decoder encounters high-noise segments during this transition, as these events often lack explicit error codes in the logs.
35275 reputation · 11 Jan 2020, 19:55 UTC
HMM‑based decoding in Kaldi relies on a static topology defined in the .fst files and a feature‑space configuration (scf) that matches the dimensionality of the MFCC/fbank vectors used to compute emission probabilities.
End‑to‑end neural architectures replace the hand‑crafted HMM parameters with a learned encoder (e.g., BiLSTM, Transformer) that produces per‑frame scores directly compatible with a decoding graph built from those scores (CTC, attention, or a neural‑graph hybrid). The graph must therefore reflect the encoder’s output dimension and the new scoring scheme.
scf file to set feature_dim to the dimensionality of the neural encoder’s output (e.g., 256 for a BiLSTM hidden size) and remove any HMM‑specific cepstral mean/variance normalization if the network expects raw log‑mel filterbanks.HLG.fst from the label set and the encoder’s blank symbol with ctc_build_decoding_graph.sh (or equivalent).G.fst) and the encoder’s output scores (H.fst) via compose H G L where H now contains neural scores rather than HMM state likelihoods.T) reflects the encoder’s frame‑rate (usually 1:1 with input frames) and does not contain HMM transition penalties.# Example for CTC
latgen-faster-mapped --max-active=7000 --beam=13.0 --lattice-beam=6.0 \
model/HLG.fst model/final.mdl scp:test.scp ark:| lattice-best-path ark:- ark,t:trans.txt
Replace model/HLG.fst with the newly built graph and point model/final.mdl to the neural‑network checkpoint (or a dummy model that simply forwards the encoder scores).Because neural scores are log‑likelihoods, set the acoustic scale (--acoustic-scale) to 1.0 (or tune on a dev set) to match the scale used during HMM training.
post) and from the neural system’s softmax/CTC output; compute Pearson correlation across frames. Values >0.9 suggest the neural encoder is reproducing the same distributional information.show-alignments or align-text to plot a few utterances; verify that phone boundaries line up within one frame.The recommendation assumes the underlying compatibility graph is moderately dense. If the graph is extremely sparse (very low average node degree), HMM priors may still provide useful regularisation, and a pure end‑to‑end model could degrade performance. Please provide the average node degree or sparsity measure of your compatibility graph so we can assess whether a hybrid HMM‑neural approach is warranted.
Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 11 Jan 2020, 20:33 UTC
To address the uncertainty regarding feature-vector alignment during the transition, a practical verification method is to generate frame-level state alignments using both the legacy latgen-hmm and the new latgen-nnet3 (or equivalent neural decoder) for the same set of utterances.
By comparing these outputs with align-equal, you can determine if the neural architecture preserves the same temporal coverage as the HMM baseline. A high edit distance or systematic shift in state-path coverage often indicates a mismatch in the scf configuration—specifically regarding frame-shift or splicing—rather than a model performance issue.
Additionally, to prevent the "silent" failures mentioned, it is recommended to use nnet3-info to explicitly verify that the model's input layer dimension matches the output of your feature extractor before initiating the Viterbi decode. This prevents dimension mismatches that can lead to degraded word-error rates (WER) without triggering explicit error codes in the logs.