Quantum-inspired Interpretable Deep Learning Architecture for Text Sentiment Analysis

Bingyu Li, Da Zhang, Zhiyuan Zhao, Junyu Gao, Yuan YuanarXiv 2024 · DOI

Abstract

Sentiment analysis remains a challenge for traditional deep learning due to difficulties in fusing diverse linguistic features and a lack of model interpretability. This paper presents QITSA (Quantum-inspired Interpretable Text Sentiment Analysis), a novel architecture that leverages quantum mechanical principles. By representing semantic meaning as amplitude and sentiment polarity as phase within a complex-valued embedding, QITSA effectively integrates contextual and emotional information. The model utilizes density matrices and a "Q-Attention" mechanism to achieve state-of-the-art performance across multiple benchmarks while providing visual interpretability of the decision-making process.

Introduction

Sentiment analysis is vital for deciphering public opinion and consumer trends. However, current models often struggle to explicitly fuse semantic context with emotional polarity and operate as "black boxes." QITSA addresses these issues by drawing an analogy between linguistic ambiguity and quantum superposition. Just as a quantum particle exists in multiple states simultaneously, a word carries multiple layers of meaning and sentiment that depend on context. This allows for a more nuanced representation than standard real-valued vectors.

Methodology

QITSA processes text using a classical neural network inspired by quantum mathematics. The architecture follows a multi-stage pipeline designed to maintain the relationship between semantics and sentiment:

  1. Quantum-Inspired Word Embedding: Words are mapped to complex numbers ($v = r \cdot e^{i\beta}$). The amplitude ($r$) captures semantic information from pre-trained models like BERT, while the phase ($\beta$) encodes sentiment polarity from lexicons like WordNet.
  2. Feature Extraction: Using Euler's formula, the complex embeddings are split into real and imaginary parts. These are processed through LSTMs and Self-Attention Mechanisms (SAMs) to capture sequential and global dependencies.
  3. Density Matrix Representation: The sentence is modeled as a mixed quantum system. Individual word matrices are fused into a sentence-level density matrix using a novel "Q-Attention" mechanism, which weights the importance of different words based on their emotional signals.
  4. Classification: A 2D-CNN treats the density matrix as a feature map, extracting local patterns to perform final sentiment classification.

Key Insights and Results

The use of complex numbers allows for an elegant fusion of rule-based lexicon knowledge and dense semantic embeddings. This approach ensures that sentiment and semantics are treated as intertwined properties rather than isolated features. Furthermore, the resulting density matrices provide a visual window into the model's logic, highlighting words with significant emotional weight and allowing researchers to see where the model focuses its attention.

Empirical evaluations on five benchmark datasets (MR, SST, SUBJ, CR, and MPQA) demonstrate QITSA's superiority. It achieved state-of-the-art accuracy on four out of five datasets, notably reaching 92.96% on SUBJ and 87.50% on MPQA. Ablation studies confirmed that the combination of BERT for amplitude and lexicon scores for phase is the optimal configuration, outperforming setups that relied on a single information source.

Conclusion

QITSA demonstrates that quantum-inspired mathematical frameworks can significantly enhance classical NLP models. By providing a structured way to fuse disparate information types and a visual means of interpretation, it offers a robust alternative to standard "black box" architectures. Future work will explore extending this framework to multimodal inputs—such as audio and visual features—and broader NLP tasks beyond sentiment classification.

Summary updated

BibTeX
@misc{li2024quantum,
  author = {Bingyu Li and Da Zhang and Zhiyuan Zhao and Junyu Gao and Yuan Yuan},
  title = {{Quantum-inspired Interpretable Deep Learning Architecture for Text Sentiment Analysis}},
  year = {2024},
  eprint = {2408.07891},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.07891},
}
Figure