nnet3 decode fails in production after moving a working Kaldi chain recipe: i-vector input mismatch
0 reputation · 26 Jan 2025, 13:44 UTC
0 reputation · 26 Jan 2025, 13:44 UTC
A Kaldi chain/TDNN acoustic model decodes correctly inside the original recipe directory, but the same model fails when deployed in a separate production pipeline. The nnet3 decoding binaries abort with low-level errors around the i-vector input — missing final.ie or a feature-dimension complaint from the nnet3 computation — rather than any explicit configuration diagnostic.
The production setup reuses the recipe's final.mdl and decoding graph, but the feature frontend and i-vector extraction were re-implemented outside the recipe scripts. Known constraints: the decode-time MFCC configuration, CMVN handling, and splice options must match training exactly; the ivector_extractor directory contents must be the ones the model was trained with; and the graph, model, and phone symbol table must come from the same training tree. The production path also needs to decide between offline per-utterance i-vector extraction and online estimation via the online2 binaries, since the recipe used offline extraction.
Which specific mismatch most commonly causes this class of failure when a recipe is moved to production: the MFCC/CMVN frontend config, the i-vector extractor splice options, or a graph/model provenance mismatch?
Does switching from offline to online i-vector extraction require any change on the model side, or only in the decoding pipeline configuration?
What is the most reliable way to verify configuration equivalence between the recipe and the production pipeline before decoding?
The most common cause of this failure is an i-vector extractor configuration mismatch. When an nnet3 model is moved to production, the binary expects a concatenated input vector consisting of the acoustic features and the i-vector. If the production pipeline uses a different ivector_extractor/ directory, different splice options, or a modified MFCC configuration, the resulting input dimension will not match the input layer of the final.mdl, leading to a low-level abort.
While a graph/model provenance mismatch usually triggers explicit symbol-table or topology errors, i-vector dimension complaints are almost always tied to the feature pipeline. The final.ie file is the core of the extractor, but it relies on the splice_opts and global_cmvn.stats to produce a vector of the correct size.
ivector_extractor/ directory from the recipe, not just the final.ie file. This includes splice_opts, global_cmvn.stats, and online_cmvn.conf.mfcc.conf) and the order of CMVN application (utterance-level followed by global) must be byte-for-byte identical to the training recipe.Switching from offline to online extraction does not require changes to the acoustic model (final.mdl). It only requires a change in the decoding pipeline configuration.
To implement this, use the online2 binaries (e.g., online2-wav-nnet3-latgen-faster) and provide an online_ivector_extraction_config that points to the original ivector_extractor/ directory. Note that this assumes the extractor was trained with the default chain recipe settings (--use-most-recent-ivector=false).
To verify configuration equivalence before full deployment, run these tests on a single short utterance in both the recipe environment and the production environment:
ivector-extract-online2 --config=ivector_extractor/online_ivector_extractor.conf ark:test.wav ark:- | head
nnet3-compute to ensure the model accepts the production features without crashing.
nnet3-compute --use-gpu=no --print-args=false final.mdl 'ark:feat-to-len scp:test.scp ark:- |' ark,t:- | head -5
final.mdl and HCLG.fst SHA256 hashes are identical across both environments.Missing Diagnostic: Does your production pipeline apply CMVN using a different binary or library than the original Kaldi recipe? If so, the normalization constants may differ slightly, causing a mismatch in the expected input distribution.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.