TL;DR
This paper tackles the challenge of making Transformer-based speech recognition models run in real-time without sacrificing accuracy. They achieve this by adapting the Transformer architecture for streaming with a novel chunk-wise attention mechanism and optimizations, demonstrating significant improvements in speed and latency over existing methods while maintaining high accuracy.
What Problem Does This Paper Address?
Automatic Speech Recognition (ASR) systems are increasingly moving towards end-to-end (E2E) deep learning models, which have shown great promise. Among these, Transformer-based models have achieved state-of-the-art accuracy. However, a major hurdle for deploying these powerful models in real-world applications is their high computational cost during inference, leading to significant latency. Traditional recurrent neural network (RNN) based transducer models (RNN-T) are more amenable to streaming, but Transformers offer superior performance. This paper aims to bridge this gap by developing a Transformer-based transducer (T-T) that is both accurate and efficient for real-time streaming scenarios.
Methods
The core of this work lies in adapting the Transformer architecture for streaming speech recognition within a transducer framework. The authors combine two key ideas:
- Transformer-XL and Chunk-wise Streaming: They leverage concepts from Transformer-XL to enable processing of sequences without recomputing everything from scratch. Crucially, they introduce a "chunk-wise streaming processing" approach. This involves segmenting the input audio into small chunks and processing them.
- Attention Masking Strategy: To manage the computational cost and latency, they design a specific attention mask. This mask controls the receptive field of the Transformer encoder. It allows frames within a chunk to attend to each other (including some future frames within the chunk) but strictly prevents frames in later chunks from attending to frames in earlier chunks. This ensures that the model doesn't need to process the entire utterance at once.
- Inference Optimizations: To further boost speed, they implement caching of intermediate computations (keys and values in the attention mechanism) and chunk-wise batching. This allows for more efficient matrix operations compared to frame-by-frame processing.
Datasets
- Training: 65 thousand hours of anonymized Microsoft speech data.
- Evaluation: A test set comprising 1.8 million words across 13 different application scenarios (e.g., Cortana, far-field speech, call center).
Key Insights and Ideas
- Transformer Transducer (T-T) is Viable for Streaming: The paper demonstrates that Transformers, despite their inherent non-streaming nature, can be effectively adapted for real-time ASR using transducer architectures and careful masking.
- Chunk-wise Attention is Key: The proposed attention masking strategy is crucial for balancing accuracy and latency. It allows for local context within chunks while preventing the global dependencies that cause high latency in standard Transformers.
- Latency vs. Accuracy Trade-off is Manageable: The authors show that by using a limited history and a small look-ahead (e.g., 360ms), T-T models can achieve performance very close to offline models, suggesting that the accuracy drop is not significant.
- Chunking for Speed: Grouping frames into batches for chunk-wise computation is a highly effective way to reduce runtime cost, especially for Transformer encoders, and can achieve real-time factors (RTF) below 1.
Key Results
- Accuracy: T-T and Conformer Transducer (C-T) models significantly outperform hybrid models and RNN-T by over 10% relative word error rate (WER) on streaming evaluation.
- Runtime Performance (Zero Look-ahead): With truncated history, T-T models achieve a significantly reduced RTF compared to full context, while maintaining accuracy.
- Runtime Performance (Small Look-ahead): With a small look-ahead (360ms), T-T achieves an RTF of 0.25 on CPU, meeting industry requirements.
- Batching: Using batching for chunk-wise computation allows T-T to achieve RTF below 1, with an RTF of 0.19 when encoding 15 frames (450ms latency).
- INT8 Optimization: INT8 quantization provides a ~2x speedup for T-T and C-T with minimal WER degradation.
Limitations and Future Work
- Latency vs. Computation Trade-off: While the paper achieves good results, there's still a trade-off. Allowing a small look-ahead or batching introduces latency. The authors suggest that further optimization of the encoder's computational efficiency is an ongoing area.
- Conformer vs. Transformer: The Conformer Transducer (C-T) slightly outperforms T-T in accuracy, suggesting that incorporating convolutional elements can be beneficial. Future work could explore more advanced hybrid architectures.
- Generalizability: While trained on a large dataset, the performance across diverse real-world scenarios would be a continued area of interest.
- Hardware Acceleration: The paper focuses on CPU performance. Exploring optimizations for GPU or specialized hardware could yield further speedups.
Summary updated