[Paper Review] Quantum Self-Attention Neural Networks for Text Classification
This paper proposes Quantum Self-Attention Neural Networks (QSANN), a novel quantum neural network architecture that integrates the self-attention mechanism with parameterized quantum circuits using Gaussian projected quantum self-attention. QSANN achieves superior text classification performance over both classical self-attention networks and existing syntax-based quantum NLP models, demonstrating scalability and noise resilience on near-term quantum devices.
An emerging direction of quantum computing is to establish meaningful quantum applications in various fields of artificial intelligence, including natural language processing (NLP). Although some efforts based on syntactic analysis have opened the door to research in Quantum NLP (QNLP), limitations such as heavy syntactic preprocessing and syntax-dependent network architecture make them impracticable on larger and real-world data sets. In this paper, we propose a new simple network architecture, called the quantum self-attention neural network (QSANN), which can compensate for these limitations. Specifically, we introduce the self-attention mechanism into quantum neural networks and then utilize a Gaussian projected quantum self-attention serving as a sensible quantum version of self-attention. As a result, QSANN is effective and scalable on larger data sets and has the desirable property of being implementable on near-term quantum devices. In particular, our QSANN outperforms the best existing QNLP model based on syntactic analysis as well as a simple classical self-attention neural network in numerical experiments of text classification tasks on public data sets. We further show that our method exhibits robustness to low-level quantum noises and showcases resilience to quantum neural network architectures.
Motivation & Objective
- To address the limitations of existing quantum natural language processing (QNLP) models that rely heavily on syntactic preprocessing and are not scalable to large datasets.
- To develop a quantum neural network architecture that is flexible, scalable, and implementable on near-term noisy intermediate-scale quantum (NISQ) devices.
- To explore the potential of self-attention mechanisms in quantum neural networks for capturing complex word correlations in text classification.
- To evaluate the robustness of the proposed model under realistic quantum noise and varying quantum circuit architectures.
- To demonstrate quantum advantage potential in NLP tasks using a practical, circuit-implementable quantum model.
Proposed method
- The model encodes input text sequences into high-dimensional quantum states using amplitude encoding.
- It employs parameterized quantum circuits (PQCs) structured according to the self-attention mechanism, with query, key, and value transformations performed via quantum gates.
- A Gaussian projected quantum self-attention (GPQSA) layer computes attention scores by measuring overlap between quantum states using Gaussian-projected measurements.
- The architecture uses shallow quantum circuits with Pauli-Z measurements to ensure compatibility with current NISQ hardware.
- Four distinct ansatzes (Ansatz-0 to Ansatz-3) are designed with varying entanglement patterns to evaluate circuit architecture robustness.
- Noise is simulated via a depolarizing channel with error rate $ p = 0.1 $ to test resilience under realistic hardware constraints.
Experimental results
Research questions
- RQ1Can a quantum neural network based on self-attention outperform existing syntax-dependent QNLP models in text classification tasks?
- RQ2How does the proposed QSANN model perform compared to a classical self-attention neural network on public text classification benchmarks?
- RQ3To what extent is QSANN robust to variations in quantum circuit architecture (ansatz design) and quantum noise?
- RQ4Can the Gaussian projected quantum self-attention mechanism effectively capture long-range dependencies and relevant word correlations in text?
- RQ5Is the QSANN architecture feasible and scalable on near-term quantum devices with limited qubit counts and noise?
Key findings
- QSANN achieves a test accuracy of 67.74% ± 0.00% on the MC dataset and 67.74% ± 0.00% on the RP dataset using Ansatz-0 and Ansatz-3, outperforming both the best existing QNLP model and a classical self-attention network.
- The model maintains consistent performance across all four ansatz types, with test accuracy ranging from 67.03% to 67.74%, indicating high resilience to circuit architecture variations.
- Even under a depolarizing noise channel with $ p = 0.1 $, QSANN maintains stable performance, demonstrating robustness to low-level quantum noise.
- Visualization of attention coefficients confirms that the model effectively focuses on the most relevant words in input sequences, validating the attention mechanism’s interpretability.
- QSANN achieves 100% training accuracy on both MC and RP datasets across all ansatzes, indicating strong model capacity and effective optimization.
- The use of shallow circuits and Pauli-Z measurements enables direct implementation on current NISQ devices, making the model practical for near-term quantum hardware.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.