QSAN: A Near-term Achievable Quantum Self-Attention Network

Self-attention mechanism, an important component of machine learning, has been relatively little investigated in the field of quantum machine learning. Inspired by the variational Quantum Algorithm (VQA) framework and classical selfattention mechanism, Quantum Self-Attention Network (QSAN) that can be implemented on a near-term quantum computer is proposed. Theoretically, Quantum Self-Attention Mechanism (QSAM) is defined, which is a new interpretation of the classical self-attention mechanism after linearization and logicalization. Quantum Logical Similarity (QLS) is one of the cores of QSAM, which replaces the similarity operation of inner product with logical operation, allowing a better execution of QSAM on quantum computers. Quantum Bit Self-Attention Score Matrix (QBSASM) is another centerpiece, which is a QLS-based density matrix used to represent the output distribution. In practice, QSAN is realized based on the QSAM framework, and the concept of quantum coordinates is introduced to simplify circuit design. Finally, QSAN is tested on a quantum computer with a small sample of data, laying the foundation for Quantum Natural Language Processing (QNLP).
View on arXiv