[Paper Review] Reinforced Self-Attention Network: a Hybrid of Hard and Soft Attention for Sequence Modeling
This paper proposes Reinforced Self-Attention Network (ReSAN), an RNN/CNN-free sentence encoding model that combines a novel parallelizable hard attention mechanism, Reinforced Sequence Sampling (RSS), with soft self-attention to efficiently model sparse dependencies in long sequences. By using RSS to select key tokens and soft attention to provide policy gradient rewards, ReSAN achieves state-of-the-art performance on SNLI and SICK benchmarks with fewer parameters and faster inference.
Many natural language processing tasks solely rely on sparse dependencies between a few tokens in a sentence. Soft attention mechanisms show promising performance in modeling local/global dependencies by soft probabilities between every two tokens, but they are not effective and efficient when applied to long sentences. By contrast, hard attention mechanisms directly select a subset of tokens but are difficult and inefficient to train due to their combinatorial nature. In this paper, we integrate both soft and hard attention into one context fusion model, "reinforced self-attention (ReSA)", for the mutual benefit of each other. In ReSA, a hard attention trims a sequence for a soft self-attention to process, while the soft attention feeds reward signals back to facilitate the training of the hard one. For this purpose, we develop a novel hard attention called "reinforced sequence sampling (RSS)", selecting tokens in parallel and trained via policy gradient. Using two RSS modules, ReSA efficiently extracts the sparse dependencies between each pair of selected tokens. We finally propose an RNN/CNN-free sentence-encoding model, "reinforced self-attention network (ReSAN)", solely based on ReSA. It achieves state-of-the-art performance on both Stanford Natural Language Inference (SNLI) and Sentences Involving Compositional Knowledge (SICK) datasets.
Motivation & Objective
- Address the inefficiency and poor generalization of soft attention in long sequences due to non-zero attention on trivial tokens.
- Overcome the non-differentiability and slow training of hard attention caused by its combinatorial selection process.
- Integrate hard and soft attention mechanisms to mutually improve training stability and modeling capability.
- Develop a lightweight, RNN/CNN-free architecture for sentence encoding that maintains high performance and efficiency.
- Achieve state-of-the-art results on natural language inference and semantic relatedness tasks without relying on recurrent or convolutional structures.
Proposed method
- Propose a novel hard attention mechanism called Reinforced Sequence Sampling (RSS), which selects tokens in parallel using a policy gradient approach, avoiding sequential sampling.
- Design a hybrid model, Reinforced Self-Attention (ReSA), where two RSS modules independently select head and dependent tokens from two copies of the input sequence.
- Use soft self-attention to compute attention scores between selected head and dependent tokens, focusing only on the sparse, meaningful dependencies.
- Train the RSS modules via policy gradient (e.g., REINFORCE) using the attention scores from soft self-attention as dense reward signals.
- Construct ReSAN as a complete sentence-encoding model based solely on ReSA, eliminating RNNs and CNNs entirely.
- Apply a source2token self-attention mechanism to allow direct prediction from the selected tokens without additional layers.
Experimental results
Research questions
- RQ1Can a hybrid attention mechanism combining hard and soft attention improve modeling efficiency and performance on long sequences?
- RQ2Can a parallelizable, non-recurrent hard attention mechanism like RSS be effectively trained via policy gradient while maintaining high performance?
- RQ3Does integrating soft attention as a reward signal improve the trainability and accuracy of hard attention in sequence modeling?
- RQ4Can a fully attention-based, RNN/CNN-free model like ReSAN outperform existing architectures on natural language inference and semantic relatedness tasks?
- RQ5To what extent does the model reduce parameter count and inference time while maintaining or improving accuracy compared to state-of-the-art models?
Key findings
- ReSAN achieves the highest test accuracy on the official SNLI leaderboard among all sentence-encoding models, setting a new state-of-the-art.
- On the SICK dataset, ReSAN achieves state-of-the-art performance in semantic relatedness tasks, outperforming existing models.
- ReSAN uses fewer parameters and achieves faster inference time compared to recurrent, convolutional, and even complex external memory-based models.
- The visualization shows that ReSA effectively selects semantically important words (e.g., verbs and nouns) as heads and dependents, while filtering out most stop words.
- The soft self-attention module assigns higher attention scores to meaningful word pairs that form sense-groups (e.g., 'sit' and 'talk'), confirming effective dependency modeling.
- The RSS mechanism enables parallel token selection, significantly improving training efficiency over sequential hard attention methods.
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.