Complex Transformer: A Framework for Modeling Complex-Valued Sequence

Muqiao Yang, Martin Q. Ma, Dongyu Li, Yao-Hung Hubert Tsai, Ruslan Salakhutdinov

TL;DR

This paper introduces the "Complex Transformer," a novel deep learning architecture that leverages complex numbers within the Transformer framework to better model complex-valued sequential data like audio and radio signals. By adapting the attention mechanism and encoder-decoder structure to handle complex inputs, they achieve state-of-the-art results on music transcription and IQ signal classification tasks.

What Problem Does This Paper Address?

Many real-world signals, such as speech, audio, and radio frequencies, are inherently complex-valued, especially after undergoing a Fourier Transform. However, most current deep learning models, even advanced ones like Transformers, primarily operate on real-valued data. This means they are only utilizing half of the information present in these complex signals, potentially limiting their representational power and performance. The paper aims to bridge this gap by developing a deep learning architecture that can effectively process and model complex-valued sequences, unlocking richer representations and improved performance on tasks involving such data.

Methods

The core innovation is the "Complex Transformer," which adapts the standard Transformer architecture to handle complex-valued inputs. Key methodological contributions include:

  • Complex-Valued Input Representation: Raw real-valued signals are transformed into complex-valued sequences using the Discrete Fourier Transform (DFT). These complex sequences are then fed into the model.
  • Complex Encoder-Decoder Structure: The standard Transformer's encoder and decoder are modified to operate on complex numbers. This involves adapting the attention mechanism and feed-forward networks.
  • Complex Attention Mechanism: The paper proposes a novel complex attention mechanism. Instead of directly applying complex operations, they represent complex numbers as pairs of real and imaginary components. The attention calculation is then reformulated into separate real-valued operations on these components, which are then combined. This approach aims to capture interdependencies between the real and imaginary parts of the signal.
  • "Norm & Add" and Layer Normalization: Similar to standard Transformers, residual connections and layer normalization are employed. Specifically, layer normalization is applied before residual connections in the encoder, a technique referred to as "Norm & Add."
  • Min-Max Normalization: For attention scores, the authors opt for Min-Max normalization instead of the more common Softmax. They argue this helps prevent gradient explosion, particularly in their complex-valued setting.

Datasets

The proposed Complex Transformer was evaluated on two datasets:

  • MusicNet: A dataset for music transcription, containing classical music recordings with labels indicating musical notes at each time step. This is framed as a multi-label classification task.
  • In-phase Quadrature (IQ) Signal Dataset: A large, non-public dataset of wireless WI-FI signals. The task here is to classify the device ID based on the signal, treated as a multi-class classification problem.

Key Insights and Ideas

  • Complex Numbers Unlock Richer Representations: The fundamental insight is that complex numbers, by their nature, can encode more information than real numbers alone. By explicitly modeling both the real and imaginary parts of signals, the Complex Transformer can capture richer temporal dependencies and signal characteristics.
  • Transformer Architecture is Adaptable: The paper demonstrates that the powerful Transformer architecture, particularly its attention mechanism, can be effectively adapted to handle complex-valued data, overcoming the limitations of traditional real-valued models.
  • Complex Attention is Key: The novel complex attention mechanism is crucial for the model's success. By carefully reformulating complex operations into real-valued components, they enable the Transformer to learn complex relationships within the data.
  • Sequence Generation Benefits from Complex Modeling: Beyond classification, the Complex Transformer shows promise in sequence generation tasks, suggesting that complex-valued modeling can lead to more nuanced and accurate generated sequences.

Key Results

The Complex Transformer achieved state-of-the-art performance on both evaluated tasks:

  • Automatic Music Transcription (AMT): On the MusicNet dataset, the Complex Transformer achieved an Average Precision (APS) of 74.22%, outperforming other models like Deep Real Network (69.8%), Deep Complex Network (72.9%), and Concatenated Transformer (71.30%), while using a comparable number of parameters to some.
  • In-phase Quadrature (IQ) Data Classification: For IQ signal classification, the Complex Transformer achieved an accuracy of 59.94%, surpassing the Feed-forward neural network (47.12%), Gated Recurrent Unit (50.38%), and Concatenated Transformer (57.57%).
  • Conditional Generation: In sequence generation tasks on both MusicNet and the IQ dataset, the Complex Transformer achieved lower loss values compared to LSTM encoder-decoder and a vanilla Transformer, indicating better generation quality.

Limitations and Future Work

  • Computational Cost: While achieving better performance, complex-valued operations can inherently be more computationally intensive than their real-valued counterparts. The paper doesn't explicitly detail the computational overhead compared to real-valued models of similar performance.
  • Generalizability: The paper focuses on specific signal processing and audio tasks. Further research could explore the applicability of the Complex Transformer to other domains where complex-valued data is prevalent, such as quantum computing or advanced signal processing applications.
  • Exploration of Complex Operations: The paper uses a specific method for handling complex attention. Future work could explore alternative ways to integrate complex numbers into various components of the Transformer architecture and investigate their impact.
  • Dataset Specifics: The IQ dataset is described as non-public. Future work could involve releasing such datasets or testing on other publicly available complex-valued datasets to further validate the model's robustness.

Summary updated

BibTeX
@inproceedings{yang2020complex,
  author = {Muqiao Yang and Martin Q. Ma and Dongyu Li and Yao-Hung Hubert Tsai and Ruslan Salakhutdinov},
  title = {{Complex Transformer: A Framework for Modeling Complex-Valued Sequence}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2020},
  url = {https://openreview.net/forum?id=Eo33zcz1HmH},
}
Figure