Abstract
Traditional text classification models often face a trade-off between the sequential dependency modeling of Recurrent Neural Networks (RNNs) and the local feature extraction efficiency of Convolutional Neural Networks (CNNs). This paper introduces the Multi-granularity Attention-based Hybrid Neural Network (MahNN), a novel architecture that bridges these two paradigms. MahNN employs a dual-layer attention mechanism—syntactical and semantical—to capture both word-level importance and dimension-level feature relevance within embeddings. Experimental results across five standard benchmarks demonstrate that MahNN achieves state-of-the-art performance by effectively integrating sequential context with multi-channel convolutional feature extraction.
Introduction
In Natural Language Processing (NLP), the choice of architecture typically involves a compromise. Recurrent Neural Networks (RNNs), particularly LSTMs, are adept at capturing long-term dependencies and word order but suffer from sequential processing bottlenecks and difficulties with very long sequences. Conversely, Convolutional Neural Networks (CNNs) are highly parallelizable and efficient at identifying local n-gram patterns but lack a global "memory" of the sequence, often treating text as a collection of relatively unordered features.
Hybrid models attempt to combine these strengths, yet they often struggle with seamless integration. Simple attention mechanisms over RNN hidden states can lose vital structural information. The authors of this work propose MahNN to address these limitations by using a sophisticated multi-granularity attention mechanism as an "adhesive" between a Bi-LSTM layer and a multichannel CNN.
Methodology: The MahNN Architecture
The MahNN framework consists of three primary stages designed to preserve both sequence order and semantic nuance.
1. Bi-LSTM Layer
The input text is first processed by a Bidirectional Long Short-Term Memory (Bi-LSTM) network. This layer captures the contextual representation of each word by considering both preceding and succeeding tokens, ensuring that the initial features are informed by the entire sentence structure.
2. Multi-granularity Attention
The core innovation of MahNN is its dual-level attention mechanism, which operates at two distinct granularities:
- Syntactical Attention: This level identifies the relative importance of specific words or symbols. By utilizing an association matrix and "channel masks," the model generates multiple versions (channels) of the input, each emphasizing different key terms.
- Semantical Attention: Unlike standard attention that weights entire vectors, this mechanism looks into the individual dimensions of word embeddings. It recognizes that different latent semantic factors (dimensions) carry varying levels of importance for a given task, allowing for fine-grained feature selection.
3. Multichannel ConvNet
The output of the attention layer is a set of weighted matrices, or channels. These are fed into a CNN that employs sliding filters to extract local n-gram features across the different "views" provided by the attention channels. A max-pooling layer followed by a softmax classifier produces the final category label.
Experimental Setup
The model was evaluated on five diverse NLP benchmarks:
- MR: Movie reviews for binary sentiment classification.
- Subj: Subjectivity dataset (subjective vs. objective).
- MPQA: Opinion polarity detection.
- SST-1: Stanford Sentiment Treebank (5-class sentiment).
- SST-2: Binary version of SST.
Key Results and Insights
MahNN demonstrated superior performance compared to strong baselines, including pure CNNs and other hybrid architectures.
- State-of-the-Art Performance: The 3-channel variant (MahNN-3) achieved peak accuracy on the MR (82.57%), Subj (93.75%), and MPQA (89.75%) datasets.
- Robustness through Semantical Attention: The dimension-level attention was found to effectively filter "noise" within the RNN hidden states, leading to more robust classifications.
- Multi-View Learning: Visualizations confirmed that different attention channels successfully learned to highlight distinct informative words within the same sentence, justifying the multichannel approach.
- Optimal Complexity: Researchers noted that while multiple channels improve performance, excessive complexity can lead to overfitting; a 3-channel setup emerged as the optimal balance for most tasks.
Conclusion and Future Work
MahNN successfully bridges the gap between RNNs and CNNs by using multi-granularity attention as a sophisticated integration layer. While the model achieves impressive results, it currently faces constraints common to CNN-based methods, such as fixed-length input requirements. Additionally, the dual-attention mechanism adds computational overhead compared to simpler architectures. Future research directions include exploring generative models for richer multichannel representations and utilizing reinforcement learning to dynamically optimize attention weights.
Summary updated