Which Kaldi deployment boundary fits zero-downtime model migration for a small ASR service?
0 reputation · 26 Oct 2023, 11:39 UTC
0 reputation · 26 Oct 2023, 11:39 UTC
Goal: replace the acoustic model and decoding configuration of a small Kaldi ASR service without interrupting incoming transcription requests. The service uses Kaldi offline decoding or online2 streaming decoding with endpointing, and the exact Kaldi revision is pinned.
Kaldi does not define a built-in zero-downtime migration protocol, so the deployment boundary is unresolved. One option hot-swaps model artifacts inside a single process, which limits duplicated model memory but couples old and new versions in the same address space. The alternative runs separate old and new decoder pools and moves traffic between them, which isolates versions and simplifies rollback but can roughly double model memory. Thread-safety and graph compatibility are revision-sensitive, and a migration unit should include the feature configuration, acoustic model, decoding graph, and decoding or endpointing options rather than model files alone.
Should the service hot-swap artifacts in one process or use separate decoder pools with traffic shifting? Which artifacts must be versioned together to prevent silent accuracy regression? How should readiness and draining be decided when Kaldi itself provides no migration protocol?
35775 reputation · 26 Oct 2023, 18:15 UTC
Use separate old and new decoder pools with traffic shifting. Do not hot-swap model artifacts inside a single running Kaldi process. Kaldi has no built-in zero-downtime migration protocol, and replacing final.mdl, HCLG.fst, or feature configuration while decoders are active can race with in-flight decodes, crash the process, or emit silent wrong transcripts.
Kaldi provides no built-in zero-downtime migration protocol. Online2 endpointing state is per-decoder and does not migrate between processes. In-place artifact replacement inside a running process is not officially supported and can race with active decoding threads.
For a small service, separate pools are preferable because the roughly doubled model memory during cutover is usually acceptable, while isolation simplifies rollback and avoids coupling old and new versions in one address space. Hot-swap saves memory but couples versions in the same address space and risks corrupting in-flight decodes.
Changing any one piece alone can cause frame-rate or phone-set mismatches that produce plausible transcripts with regressed accuracy. Treat the bundle as one immutable migration unit tied to the pinned Kaldi revision.
Readiness is decided by the smoke decode and canary success rate, not by file timestamps. Draining is decided by in-flight utterance completion: Kaldi cannot transfer a partially decoded online2 session to a new process, so connections must complete or time out on the old pool.
One missing detail that can change the recommendation: the host's available RAM during cutover relative to peak concurrent sessions. Two pools can roughly double model memory; if that does not fit, resize the host or cut over during a low-traffic window instead of choosing in-process hot-swap.
Version assumption: this guidance assumes a pinned Kaldi revision whose decoder thread-safety and online2 endpointing semantics are fixed. Verify those properties in that revision's source or build configuration before production use.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.