Relative Positional Encoding for Speech Recognition and Direct Translation

Ngoc-Quan Pham, Thanh-Le Ha, Tuan-Nam Nguyen, Thai-Son Nguyen, Elizabeth Salesky, Sebastian Stüker, Jan Niehues, Alex Waibel

Abstract

Transformer models are powerful sequence-to-sequence architectures that are capable of directly mapping speech inputs to transcriptions or translations. However, the mechanism for modeling positions in this model was tailored for text modeling, and thus is less ideal for acoustic inputs. In this work, we adapt the relative position encoding scheme to the Speech Transformer, where the key addition is relative distance between input states in the self-attention network. As a result, the network can better adapt to the variable distributions present in speech data. Our experiments show that our resulting model achieves the best recognition result on the Switchboard benchmark in the non-augmentation condition, and the best published result in the MuST-C speech translation benchmark. We also show that this model is able to better utilize synthetic data than the Transformer, and adapts better to variable sentence segmentation quality for speech translation.

Introduction: The Mismatch Between Transformers and Speech

The original Transformer architecture was designed for Natural Language Processing (NLP), where absolute position often carries significant semantic weight (e.g., the first word of a sentence). However, speech signals present a different set of challenges. Acoustic signals are typically 10 to 60 times longer than their corresponding text transcripts and are inherently more "jittery."

A significant issue is that speech signals can be preceded by variable amounts of silence, noise, or applause. In a standard Transformer using absolute positional encodings, such a shift changes the index of every subsequent acoustic frame. This forces the model to relearn acoustic patterns at every possible absolute position. Ideally, a speech model should be time-shift invariant—it should focus on the distance between sounds (relative position) rather than their specific timestamp in the audio file.

Methodology: Adapting Relative Positional Encoding

To address this, the authors adapt Relative Positional Encoding (RPE) for the Speech Transformer. The core change involves modifying the self-attention mechanism to incorporate relative distances between input states rather than adding a fixed vector to the input embedding based on its absolute index $i$.

Key Technical Components

  1. Trigonometric Encodings: Unlike some RPE methods that use learnable embeddings (which are limited by a fixed maximum length), this work utilizes sinusoidal (trigonometric) encodings for relative distances. This allows the model to generalize to audio sequences significantly longer than those encountered during training.
  2. Bidirectional Adaptation: While RPE was initially developed for unidirectional language models, the authors adapted the logic for bidirectional encoders, ensuring the model understands distances in both "past" and "future" directions.
  3. Energy Decomposition: The attention score is decomposed into four distinct terms to better capture relationships:
  4. Content-Content: What is being said?
  5. Content-Relative Position: What is said relative to this distance?
  6. Global Bias: General positional preference.
  7. Relative Position Bias: How far apart are these frames?

Experimental Setup and Datasets

The researchers evaluated the Relative Transformer across two major tasks:

  • Automatic Speech Recognition (ASR): Evaluated using the Switchboard (300h) and Fisher (2000h) corpora, with testing on the Hub5’00 set.
  • Speech Translation (ST): Evaluated using MuST-C (English-German) and IWSLT 2019 data. The IWSLT task is particularly challenging as it requires handling unsegmented, long-form audio from TED talks.

Results and Performance Analysis

The experimental results demonstrate that the Relative Transformer significantly outperforms standard absolute-position baselines.

Automatic Speech Recognition

On the Switchboard-300h benchmark, the Deep Relative Transformer achieved a Word Error Rate (WER) of 10.2% in the non-augmentation condition. This result outperformed previous end-to-end models like LAS (11.2%) and rivaled complex hybrid systems that utilize external language models.

Table 1: ASR performance (WER) on Switchboard (SWB) and CallHome (CH) benchmarks.

Speech Translation

In the MuST-C speech translation task, the model achieved a massive 7.2 BLEU point increase over the standard ST-Transformer, reaching a score of 25.2. When augmented with additional synthetic data, the performance rose further to 30.6 BLEU.

Table 2: BLEU score comparison on the MuST-C speech translation task.

Discussion: Robustness and Inductive Bias

The success of the Relative Transformer can be attributed to several key factors:

  • Robustness to Segmentation: In speech translation, audio is often "chunked" into segments. The Relative Transformer proved much more resilient to variable segmentation quality than absolute Transformers, which struggle if a word is cut off or shifted.
  • Better Use of Synthetic Data: The model was more effective at extracting patterns from synthetic data, likely because it could ignore the positional "noise" inherent in generated samples.
  • Inductive Bias: By switching to RPE, the authors injected a useful inductive bias: the relationship between two sounds depends on their relative distance, not their absolute occurrence time in a recording.

Conclusion

By rethinking how models perceive position, the authors successfully adapted the Transformer architecture for the unique demands of acoustic data. While calculating relative distances adds some computational complexity—mitigated by an efficient "shifting trick"—the gains in performance and robustness are substantial. Future work will continue to explore architectures that can handle the challenges of audio segmentation entirely within the model framework.

Summary updated

BibTeX
@inproceedings{pham2020relative,
  author = {Ngoc-Quan Pham and Thanh-Le Ha and Tuan-Nam Nguyen and Thai-Son Nguyen and Elizabeth Salesky and Sebastian Stüker and Jan Niehues and Alex Waibel},
  title = {{Relative Positional Encoding for Speech Recognition and Direct Translation}},
  booktitle = {Interspeech},
  year = {2020},
  url = {https://openreview.net/forum?id=vW_7G6aIb7f},
}
Figure