Abstract
Self-attention models like Transformers have achieved competitive results in Automatic Speech Recognition (ASR) due to their ability to capture long-range temporal relationships. However, acoustic events in speech are typically local and sequential. This study investigates whether the global view provided by self-attention is necessary for all layers of a Transformer encoder. By replacing upper self-attention layers with feed-forward blocks and introducing a "diagonality" metric, we demonstrate that upper layers naturally gravitate toward local processing. Experimental results on Wall Street Journal and Switchboard datasets show that hybrid architectures with feed-forward upper layers maintain or slightly improve performance, suggesting that global context is redundant in the upper echelons of the encoder.
Introduction
Transformers have largely superseded Recurrent Neural Networks (RNNs) in ASR tasks, primarily due to the self-attention mechanism's ability to model dependencies regardless of distance. Unlike text, however, speech signals are characterized by short-lived acoustic events (e.g., phonemes) that follow a strict temporal order. Paradoxically, while Transformers thrive on global context, previous RNN research suggested that localizing context can improve ASR performance. This paper explores this tension by examining if the upper layers of a Transformer encoder actually utilize their global receptive field.
Methodology
The researchers conducted a systematic investigation using two primary tools: layer replacement and a novel diagonality metric.
Layer Replacement
The standard 12-layer Transformer encoder was modified by replacing the top-most layers with Feed-Forward (FF) blocks. While Self-Attention (SA) layers allow each time step to attend to the entire sequence, FF layers process each time step independently. This effectively forces the model to treat the attention at those layers as a "diagonal" matrix with a window size of one.
Diagonality Metric
To quantify the locality of attention, the authors developed a mathematical metric for "diagonality." This metric measures the concentration of attention weights along the diagonal of the attention matrix. A high diagonality score indicates that the layer focuses primarily on the current time step, while a lower score suggests a broader, more global focus.
Experimental Setup
The study utilized two standard ASR benchmarks:
- Wall Street Journal (WSJ): 81 hours of read speech.
- Switchboard (SWBD): 260 hours of conversational telephone speech.
The baseline was a standard 12-layer Transformer. Hybrid models were tested by varying the number of SA and FF layers (e.g., 11 SA + 1 FF, 10 SA + 2 FF).
Results and Discussion
The experiments revealed several key insights into the internal dynamics of the Transformer encoder.
The Emergence of Locality
The diagonality metric confirmed that even when provided with a global view, upper layers naturally learn to ignore distant context. As information moves from the lower to the upper layers, the attention matrices become increasingly diagonal.
Performance Gains through Simplification
Replacing the redundant global attention in upper layers did not degrade performance. On the WSJ dataset, a "11 SA + 1 FF" configuration achieved a 3.4% Character Error Rate (CER), outperforming the 3.5% baseline. On Switchboard, the "10 SA + 2 FF" model reached an 8.9% Word Error Rate (WER), compared to the 9.0% baseline.
Context Saturation
The results suggest a "context saturation" point, typically around the 10th layer in a 12-layer model. Lower layers act as "context hunters," integrating long-range dependencies into the hidden representations. Once this context is sufficiently captured, the upper layers transition to local refinement and abstract feature extraction, making global self-attention unnecessary.
Conclusion
This research demonstrates that the global view of self-attention is not universally beneficial across all layers of a Transformer encoder for ASR. Upper layers naturally converge toward local processing, and explicitly enforcing this locality via feed-forward blocks can lead to minor performance gains and more efficient architectures. These findings provide a clear path for optimizing Transformer designs by focusing global computation where it matters most: the lower layers.
Summary updated