An Empirical Study on the Impact of Positional Encoding in Transformer-based Monaural Speech Enhancement

Qiquan Zhang, Meng Ge, Hongxu Zhu, Eliathamby Ambikairajah, Qi Song, Zhaoheng Ni, Haizhou Li

TL;DR

This paper provides the first systematic study on how positional encoding (PE) impacts Transformer-based monaural speech enhancement. The core finding is a striking asymmetry: PE is virtually redundant in causal configurations because the causal attention mask implicitly injects order, but it is absolutely essential in noncausal configurations, where relative position embeddings consistently outperform absolute ones.

What Problem Does This Paper Address?

Transformers have become a dominant architecture in speech enhancement due to their ability to model long-range dependencies via multi-head self-attention. However, standard self-attention is permutation-invariant—it treats a sequence of speech frames like an unordered bag of words. To fix this, researchers typically inject positional encodings (PE).

Recently, a debate has emerged in the speech community: is PE actually necessary for speech enhancement? Some argue that the time-frequency structure of a spectrogram inherently contains enough implicit positional information to render explicit PE redundant. This paper addresses this ambiguity by conducting a comprehensive, rigorous empirical study to determine exactly when and how PE impacts performance across different causal and noncausal network setups.

Methods

The authors evaluated a standard 4-layer Transformer encoder across two primary dimensions:

  1. Causality: Causal configurations (where a frame only attends to past frames) vs. Noncausal configurations (where a frame attends to the entire utterance).
  2. Training Targets: Magnitude Spectrum (MS) mapping vs. Phase-Sensitive Masking (PSM).

They benchmarked five distinct positional encoding strategies:

  • No-Pos: No positional encoding at all.
  • Sinusoidal-APE: Fixed absolute position embeddings based on sine/cosine functions.
  • Learned-APE: Absolute position embeddings learned dynamically during training.
  • T5-RPE: A relative position embedding method that uses a log-binning strategy to bucket relative distances.
  • KERPLE: A kernelized relative position embedding method using logarithmic variants.
Fig. 1. Illustration of position-aware Transformer architecture for speech enhancement. ⊕denotes the element-wise summation.

Datasets

  • Clean Speech: Evaluated using the LibriSpeech corpus (train-100 for training, and test-clean-100 for evaluation).
  • Noise Datasets: A diverse mix of noise profiles compiled from MUSAN, RSG-10, Environmental Noise, UrbanSound, QUT-NOISE, and the Nonspeech dataset.
  • To test generalization, four specific noise types (street music, voice babble, factory welding, and F16 fighter jet noise) were strictly excluded from training and reserved exclusively for the evaluation set.

Key Insights and Ideas

  • The Causal Mask is an Implicit Position Encoder: In causal configurations, the model without any positional encoding (No-Pos) performed virtually identically to models with sophisticated PEs. Why? Because a causal mask restricts a frame at index $m$ to only attend to the previous $m$ frames. This asymmetry inherently breaks permutation invariance and implicitly teaches the network the passage of time.
  • Noncausal Models are Blind Without PE: In contrast, full (noncausal) self-attention treats the sequence symmetrically. Without PE, the training and validation losses are significantly higher, and speech separation quality degrades sharply.
  • Relative > Absolute: When PE is required (in noncausal systems), Relative Position Embeddings (RPE) like T5-RPE and KERPLE consistently deliver better objective speech quality metrics than Absolute Position Embeddings (APE).
Fig. 2. Illustration of (a) the causal self-attention and (b) the non- causal (full) self-attention (with sequence length L = 12).

Key Results

  • Causal Setup: The baseline No-Pos model achieved a PESQ score of 1.79 (using the PSM target at -5 dB SNR), matching or even slightly beating Sinusoidal-APE (1.78). The best RPE method only provided a negligible +0.02 PESQ improvement.
  • Noncausal Setup: The benefits of PE were massive. At 5 dB SNR using the MS target, switching from No-Pos to T5-RPE yielded a 0.26 absolute gain in PESQ and a 4.97% relative gain in ESTOI.
  • Overall, T5-RPE emerged as the top-performing method across composite metrics (CSIG, CBAK, COVL) in the noncausal regime.

Limitations and Future Work

Not discussed in the paper.

Summary updated

BibTeX
@inproceedings{zhang2024empirical,
  author = {Qiquan Zhang and Meng Ge and Hongxu Zhu and Eliathamby Ambikairajah and Qi Song and Zhaoheng Ni and Haizhou Li},
  title = {{An Empirical Study on the Impact of Positional Encoding in Transformer-based Monaural Speech Enhancement}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2024},
  doi = {10.1109/icassp48485.2024.10446337},
}
Figure