All models

Complex-Valued Transformer

A transformer with complex-valued attention and layer normalization for complex-valued signals.

Audio and speech · 2,637 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

This diagram has 2,637 operations (28 KB) and is drawn when you ask.

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
14.4M
Operations
2,637
Framework
PyTorch
Recurrent
No
Published
ICASSP 2023
Cited by
19 (as of 24 October 2026)
Authors
Florian Eilers, Xiaoyi Jiang
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m15398
Graph hash
b642eb8b8a3b61c1aa35a9cfa0141efd57948e740055ca82a4ec5ce9c1fa97a9
Skeleton hash
ba3a87209c8696dce7b8e37f1a8f1746113b8ec80a4a0c6353082bb2d9279ea2
Architecture hash
581f5c872aa879dfc56ad43dfa2b137424ecaf4367201d34cb97ec7a20439203
Diagram SHA-256
d3c007f5ce435246d0f5801232c185d4b248c448a140c23e583dbf4246526572
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

This is a transformer built to work directly on complex-valued signals, such as MRI, remote sensing data or the Fourier transform of a signal, without first projecting them to real numbers. The paper supplies the parts needed to move the transformer into the complex domain: several complex-valued versions of Scaled Dot-Product Attention and a complex-valued layer normalization.

The difficulty with attention is that the max operation and the softmax do not work on complex numbers. The proposed attention takes the real part of the complex dot product of query and key as the similarity, which is symmetric and unchanged when both are rotated by the same angle. For layer normalization, normalizing the real and imaginary parts independently is insufficient, so the paper uses the complex expected value and covariance matrix. In the official code, the module has the same modular structure and parameters as the real-valued transformer in PyTorch.

The experiments use the MusicNet dataset for two tasks: automatic music transcription with the transformer encoder and sequence generation with the full architecture. They use an embedding dimension of 320, 6 layers with 8 attention heads and a feed forward hidden dimension of 2048. The paper reports improved robustness to overfitting with on-par performance compared to the real-valued transformer.

Key idea. The paper derives complex-valued versions of Scaled Dot-Product Attention and layer normalization, which together let the transformer architecture operate directly on complex-valued signals.

  • complex-valued transformer
  • cv-transformer
  • c-transformer
  • complex-valued attention
  • complex-valued layer normalization
  • complex-valued neural network
  • musicnet
  • music transcription

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{eilers2023buildingblockscomplexvaluedtransformer,
      title={Building Blocks for a Complex-Valued Transformer Architecture}, 
      author={Florian Eilers and Xiaoyi Jiang},
      year={2023},
      eprint={2306.09827},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      doi={https://doi.org/10.1109/ICASSP49357.2023.10095349},
      url={https://arxiv.org/abs/2306.09827}, 
}