Locality Matters: A Locality-Biased Linear Attention for Automatic Speech Recognition

Jingyu Sun, Guiping Zhong, Dinghao Zhou, Baoxiang Li, Yiran Zhong

Locality Matters: A Locality-Biased Linear Attention for Automatic Speech Recognition

Introduction

The Conformer architecture has become a cornerstone of modern speech recognition. However, its reliance on standard self-attention introduces a "quadratic bottleneck" ($O(T^2)$), where computational and memory requirements grow exponentially with input sequence length. While various "Linear Attention" methods have been proposed to achieve $O(T)$ complexity, they frequently underperform in speech recognition. This performance gap stems from the continuous nature of speech: acoustic features are highly correlated with their immediate neighbors. Standard linear attention often fails to capture this essential locality, leading to increased Word Error Rates (WER).

Proposed Method: Locality-Biased Linear Attention (LBLA)

To address these challenges, researchers have developed Locality-Biased Linear Attention (LBLA). This module serves as a drop-in replacement for standard self-attention within the Conformer block, solving both complexity and locality issues simultaneously through two primary innovations:

  1. Kernel-Based Linearization: Instead of the traditional Softmax-based attention, LBLA utilizes a kernel function—specifically a Sigmoid function—to approximate the attention matrix. This mathematical shift allows for changing the order of matrix multiplication, effectively reducing complexity from quadratic to linear ($O(T)$).
  2. Locality-Biased Re-weighting: To restore the critical local context, the authors introduce a weighting matrix based on cosine distance. By leveraging Ptolemy’s theorem, this cosine function is decomposed into a sum of products, allowing the locality bias to be integrated into the linear attention formula without sacrificing $O(T)$ efficiency.
The LBLA module integrated into the Conformer encoder architecture.

Experimental Results

The model was evaluated on the LibriSpeech corpus (960 hours), focusing on the test-clean (high-quality speech) and test-other (noisy/accented speech) benchmarks.

Key Insights

  • Sigmoid is the Superior Kernel: Testing revealed that Sigmoid performs best because it projects tokens into a non-negative space while effectively handling "weak attention" (filtering out irrelevant noise), which is vital for mapping continuous audio to discrete text.
  • Accuracy Gains: On the LibriSpeech test-clean set, the LBLA model (S2) achieved a Word Error Rate (WER) of 3.58%, outperforming the vanilla Conformer baseline (B0) of 3.71%.
  • Efficiency: The model showed a speedup of 6% to 22% depending on the length of the audio. The longer the audio sequence, the more the linear complexity of LBLA paid off compared to the quadratic baseline.
Comparison of different activation functions and attention head counts on LibriSpeech.

By resuming training with a halved learning rate (a technique called "F1"), the researchers pushed the WER down even further to 3.50% on test-clean and 9.43% on test-other.

Limitations and Future Work

While LBLA offers a scalable path forward for long-form ASR, it is sensitive to learning rate schedules and requires careful tuning to ensure training stability. Future work will explore custom CUDA kernels to unlock more dramatic GPU speedups and test the architecture's limits on extremely long-form audio, such as hour-long podcasts.

Summary updated

Abstract

Conformer has shown a great success in automatic speech recognition (ASR) on many public benchmarks. One of its crucial drawbacks is the quadratic time-space complexity with respect to the input sequence length, which prohibits the model to scale-up as well as process longer input audio sequences. To solve this issue, numerous linear attention methods have been proposed. However, these methods often have limited performance on ASR as they treat tokens equally in modeling, neglecting the fact that the neighbouring tokens are often more connected than the distanced tokens. In this paper, we take this fact into account and propose a new locality-biased linear attention for Conformer. It not only achieves higher accuracy than the vanilla Conformer, but also enjoys linear space-time computational complexity. To be specific, we replace the softmax attention with a locality-biased linear attention (LBLA) mechanism in Conformer blocks. The LBLA contains a kernel function to ensure the linear complexities and a cosine reweighing matrix to impose more weights on neighbouring tokens. Extensive experiments on the LibriSpeech corpus show that by introducing this locality bias to the Conformer, our method achieves a lower word error rate with more than 22% inference speed.
BibTeX
@misc{sun2022locality,
  author = {Jingyu Sun and Guiping Zhong and Dinghao Zhou and Baoxiang Li and Yiran Zhong},
  title = {{Locality Matters: A Locality-Biased Linear Attention for Automatic Speech Recognition}},
  year = {2022},
  eprint = {2203.15609},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.15609},
}
Figure