Complex-valued Phase-Coherent Transformers
Abstract
Complex-valued Transformers have inherited softmax attention over the raw complex inner product. Outside natively complex domains this standard form stays near chance, and no complex attention had been shown to correct it. We show that the match must be a scaled cosine score: L2-normalise queries and keys, so the score reads their cosine similarity and ignores their magnitudes, and hold that score at order-one scale. With this the same models train on four diagnostic tasks under two different gates; without the normalisation they stay at chance on ListOps and Needle under both gates and fall far below on the other two, and a normalised score placed at too small a scale fails as well. The resulting family of phase-coherent Transformers (\PCT) matches or exceeds the strongest real-valued baseline across long-range memory, positional retrieval, hierarchical reasoning, frequency-domain classification and physical complex signals; it shows no degradation up to depth 20; and its loss decreases log-linearly over a 61-fold range of parameters. A member of the family, complex screening combined with a phase-coherent recurrence, is the first genuinely complex-valued neural network to solve Path-X, with 91.6% of its trainable parameters complex-valued against 38.2% for S4. We record these as signs of generalisation not previously seen in complex-valued neural networks.
Figures & tables
| task (chance) | sigmoid gate | row-softmax gate |
|---|---|---|
| Copy Memory (0.10) | 1.000 0.000 / 0.151 0.017 | 1.000 0.000 / 0.820 0.183 |
| ListOps (0.10) | 0.498 0.016 / 0.134 0.006 | 0.526 0.007 / 0.134 0.006 |
| Needle (0.016) | 1.000 0.000 / 0.016 0.001 | 1.000 0.000 / 0.000 † |
| FFT-MNIST (0.10) | 0.498 0.003 / 0.381 0.018 | 0.507 0.026 / 0.384 0.013 |
| gate | Copy | ListOps | FFT-MNIST | Needle |
|---|---|---|---|---|
| sigmoid ( PCT ) | 1.000 0.000 | 0.498 0.016 | 0.498 0.003 | 1.000 0.000 |
| L2-softmax | 1.000 0.000 | 0.526 0.007 | 0.507 0.026 | 1.000 0.000 |
| screening | 1.000 0.000 | 0.506 0.011 | 0.693 0.060 | 1.000 ‡ |
| gate | Copy: | FFT-MNIST: |
|---|---|---|
| ReLU | 0.102 0.001 1.000 0.000 | 0.314 0.014 0.674 0.033 |
| clamped ReLU | 0.102 0.001 1.000 0.000 | 0.314 0.014 0.618 0.095 |
| squared ( ) | 0.998 0.003 1.000 0.000 | 0.219 0.010 0.589 0.074 |
| cubed ( ) | 1.000 0.000 1.000 0.000 | 0.228 0.015 0.485 0.094 |
| sigmoid (control) | 1.000 0.000 1.000 0.000 | 0.498 0.003 0.516 0.071 |
| variant | property changed | Copy | ListOps | FFT-MNIST |
|---|---|---|---|---|
| sigmoid ( PCT ) | — | 1.000 0.000 | 0.498 0.016 | 0.498 0.003 |
| L2-softmax | keys compete ( ) | 1.000 0.000 | 0.526 0.007 | 0.507 0.026 |
| screening | multiplicative screening | 1.000 0.000 | 0.506 0.011 | 0.693 0.060 |
| complex-valued gate a | gate rotates each contribution | 1.000 0.000 | 0.298 0.043 | 0.471 0.039 |
| complex-normalised softmax b | normaliser rotates tokens | 0.909 0.157 | 0.429 0.043 | 0.416 0.028 |
| Holographic-style c | phase-interference decay, value rotation | 1.000 0.000 | 0.483 0.016 | 0.536 0.073 |
| task | real sigmoid, normalised | real softmax, normalised | complex counterparts |
|---|---|---|---|
| Copy | 1.000 0.000 | 1.000 0.000 | 1.000 / 1.000 |
| Needle | 0.317 0.170 (max 0.50) | 0.259 0.133 (max 0.40) | 1.000 / 1.000 |
| task | evaluation | r_softmax | r_sigmoid | r_screen | c_softmax | PCT | c_screen |
|---|---|---|---|---|---|---|---|
| Copy (mid) | synthetic | 0.445 | 0.945 | 1.000 | 0.092 | 1.000 | 0.528 |
| Copy (mid) | synthetic | 0.100 | 0.083 | 1.000 | 0.100 | 1.000 | 0.683 |
| Needle (mid) | synthetic, | 0.000 | 0.000 | 1.000 | 0.000 | 1.000 | 1.000 |
| ListOps | synthetic | 0.146 | 0.177 | 0.698 | 0.104 | 0.854 | 0.833 |
| LRA-Text 4K | held-out | 0.627 | 0.627 | 0.632 | 0.628 | 0.665 | 0.635 |
| LRA-Image (CIFAR) | held-out | 0.222 | 0.224 | 0.318 | 0.232 | 0.372 | 0.341 |
| task | c_softmax (unnormalised) | PCT |
|---|---|---|
| Copy (mid) | 0.092 | 1.000 |
| Copy (mid) | 0.100 | 1.000 |
| Needle (mid) | 0.000 | 1.000 |
| ListOps | 0.104 | 0.854 |
| LRA-Text 4K | 0.628 | 0.665 |
| LRA-Image (CIFAR) | 0.232 | 0.372 |
| task | r_softmax | r_sigmoid | r_screen | PCT |
|---|---|---|---|---|
| Copy (mid) | 0.445 | 0.945 | 1.000 | 1.000 |
| Copy (mid) | 0.100 | 0.083 | 1.000 | 1.000 |
| Needle (mid) | 0.000 | 0.000 | 1.000 | 1.000 |
| ListOps | 0.146 | 0.177 | 0.698 | 0.854 |
| LRA-Text 4K | 0.627 | 0.627 | 0.632 | 0.665 |
| LRA-Image (CIFAR) | 0.222 | 0.224 | 0.318 | 0.372 |
| depth | params | 30K steps ( ) | 100K (seed 0) |
|---|---|---|---|
| 2 | 0.40M | 0.623 0.007 | 0.636 |
| 4 | 0.80M | 0.623 0.014 | — |
| 6 | 1.19M | 0.634 0.011 | 0.674 |
| 10 | 1.98M | 0.654 0.015 | 0.697 |
| 14 | 2.77M | 0.620 0.040 | — |
| 20 | 3.96M | 0.633 0.006 | 0.650 |
| model | Path-X |
|---|---|
| Transformer; Reformer, Performer, Linformer, BigBird, Luna-256 | chance ( 50) |
| S4-v1 | 88.10 |
| DSS | 89.72 |
| S4D-LegS | 91.95 |
| complex screening + phase-coherent recurrence (ours) | 92.71 0.89 |
| S4D-Inv | 92.80 |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
| cell | LR | LR | LR | , | , | , |
|---|---|---|---|---|---|---|
| real_softmax | 0.37 | 0.69 | 0.31 | 0.04 | 0.10 | 0.05 |
| real_sigmoid | 0.07 | 1.00 | 0.22 | 0.04 | 0.10 | 0.07 |
| real_screen | 0.55 | 0.70 | 1.00 | 0.69 | 1.00 | 0.79 |
| complex_softmax | 0.09 | 0.39 | 0.35 | 0.08 | 0.08 | 0.06 |
| PCT | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| complex_screen | 0.39 | 1.00 | 0.08 | 0.03 | 0.53 | 0.31 |
Transformer
Transformers are neural architectures that use attention to model relationships among sequence elements in language, vision, and scientific data.
See all 540 papers