Label-Looping: Highly Efficient Decoding for Transducers

Vladimir Bataev, Hainan Xu, Daniel Galvez, Vitaly Lavrukhin, Boris Ginsburg · DOI

Abstract

Transducer-based models like the RNN-Transducer (RNN-T) are widely used in speech recognition for their high accuracy, but they suffer from inefficient decoding on GPUs due to their frame-synchronous nature. We introduce "label-looping," a novel algorithm that restructures the decoding process by swapping the standard nested loops. By iterating over labels in the outer loop and frames in the inner loop, we minimize expensive prediction network calls. Our approach achieves up to a 2.0x speedup for RNN-T and 3.8x for Token-and-Duration Transducers (TDT) without any loss in accuracy.

The Bottleneck in Transducer Decoding

Automatic Speech Recognition (ASR) models based on Transducers are challenging to deploy efficiently in batches. The bottleneck lies in the frame-synchronous paradigm: for every audio frame, the model must decide whether to emit a text token or a "blank" symbol. If a token is emitted, the model's internal state must be updated before the next prediction. In a batch of varying audio clips, this asynchrony prevents the GPU from reaching its full parallel potential, as standard algorithms often process hypotheses sequentially.

The Label-Looping Method

The proposed Label-Looping algorithm fundamentally changes the decoding loop structure through several key innovations:

  1. Loop Swapping: Traditional decoding iterates over audio frames (outer loop) and then labels (inner loop). Label-looping flips this: the outer loop iterates over the labels (the actual text being generated), while the inner loop quickly scans through audio frames to find the next non-blank symbol.
  2. Maximizing Parallelism: The prediction network—the most computationally heavy part of the decoder—only needs to be updated when a non-blank token is emitted. By making the prediction network the outer loop, it is called the absolute minimum number of times.
  3. BatchedHyps Data Structure: A specialized data structure using 2D CUDA tensors allows for "masked" operations, enabling the GPU to update all hypotheses in a batch simultaneously.
  4. Precomputation: Linear projections from the encoder and predictor networks are precomputed to shave off redundant computation time during iterative decoding.
Visualization of the label-looping decoding structure where labels form the outer loop and frames are processed in the inner loop.

Key Results and Performance

The researchers evaluated the method on the LibriSpeech test-other dataset using models ranging from 114M (Large) to 1.1B (XXL) parameters. Because label-looping is an "exact" decoding algorithm, the Word Error Rate (WER) remains identical to standard greedy decoding.

Table showing RTFx and relative speedup for various RNN-T and TDT model configurations.

Key performance gains include:

  • RNN-Transducer: Up to 2.0x total speedup (and 2.7x for non-encoder parts) at a batch size of 32.
  • Token-and-Duration Transducer (TDT): Up to 2.1x total speedup (and a massive 3.8x speedup for non-encoder parts). The algorithm is the first to provide an efficient, exact batched implementation for the TDT architecture.
  • Combined Optimizations: When combined with TorchScript and CUDA Graphs, the total decoding speedup reached 3.2x compared to the baseline.

Conclusion and Future Work

Label-looping significantly accelerates Transducer decoding by optimizing the algorithmic structure for GPU parallelism. This efficiency allows for the use of larger, more sophisticated predictor networks (like Transformers) without compromising real-time performance. While currently focused on greedy decoding, the authors suggest that future work will extend these optimizations to beam search.

The implementation is open-sourced as part of the NVIDIA NeMo toolkit.

Summary updated

BibTeX
@inproceedings{bataev2024label,
  author = {Vladimir Bataev and Hainan Xu and Daniel Galvez and Vitaly Lavrukhin and Boris Ginsburg},
  title = {{Label-Looping: Highly Efficient Decoding for Transducers}},
  booktitle = {SLT},
  year = {2024},
  doi = {10.1109/slt61566.2024.10832333},
}
Figure