Quantum Complex-Valued Self-Attention Model
Fu Chen, Qinglin Zhao, Li Feng, Longfei Tang, Yangbin Lin, Haitao Huang
TL;DR
This paper addresses limitations of existing quantum self-attention by introducing Quantum Complex-Valued Self-Attention Model (QCSAM), which derives complex-valued attention weights from the complex inner product $\langle K|Q\rangle$ to capture amplitude and phase relationships. It extends Linear Combination of Unitaries to Complex LCUs (CLCUs) and enables quantum multi-head self-attention, embedding complex coefficients directly into circuit operations. The approach is validated on MNIST and Fashion-MNIST using 4-qubit implementations, achieving 100% and 99.2% test accuracies respectively, and demonstrates scalability to 3–8 qubits and 2–4 classes, with ablations showing advantages over real-valued weights. Overall, QCSAM advances quantum machine learning by enhancing the expressiveness and precision of quantum self-attention, aligning with the intrinsic complex nature of quantum mechanics and offering practical gains for quantum classifiers.
Abstract
Self-attention has revolutionized classical machine learning, yet existing quantum self-attention models underutilize quantum states' potential due to oversimplified or incomplete mechanisms. To address this limitation, we introduce the Quantum Complex-Valued Self-Attention Model (QCSAM), the first framework to leverage complex-valued similarities, which captures amplitude and phase relationships between quantum states more comprehensively. To achieve this, QCSAM extends the Linear Combination of Unitaries (LCUs) into the Complex LCUs (CLCUs) framework, enabling precise complex-valued weighting of quantum states and supporting quantum multi-head attention. Experiments on MNIST and Fashion-MNIST show that QCSAM outperforms recent quantum self-attention models, including QKSAN, QSAN, and GQHAN. With only 4 qubits, QCSAM achieves 100% and 99.2% test accuracies on MNIST and Fashion-MNIST, respectively. Furthermore, we evaluate scalability across 3-8 qubits and 2-4 class tasks, while ablation studies validate the advantages of complex-valued attention weights over real-valued alternatives. This work advances quantum machine learning by enhancing the expressiveness and precision of quantum self-attention in a way that aligns with the inherent complexity of quantum mechanics.
