[Paper Review] Tensorized Self-Attention: Efficiently Modeling Pairwise and Global Dependencies Together
This paper proposes Multi-mask Tensorized Self-Attention (MTSA), a novel attention mechanism that efficiently models both pairwise (token-to-token) and global (source-to-token) dependencies by combining dot-product and additive attention in a tensorized, multi-head framework. MTSA achieves state-of-the-art or competitive performance on nine NLP benchmarks while maintaining CNN-like memory and computation efficiency, outperforming standard self-attention and multi-head attention in accuracy with no increase in model size.
Neural networks equipped with self-attention have parallelizable computation, light-weight structure, and the ability to capture both long-range and local dependencies. Further, their expressive power and performance can be boosted by using a vector to measure pairwise dependency, but this requires to expand the alignment matrix to a tensor, which results in memory and computation bottlenecks. In this paper, we propose a novel attention mechanism called "Multi-mask Tensorized Self-Attention" (MTSA), which is as fast and as memory-efficient as a CNN, but significantly outperforms previous CNN-/RNN-/attention-based models. MTSA 1) captures both pairwise (token2token) and global (source2token) dependencies by a novel compatibility function composed of dot-product and additive attentions, 2) uses a tensor to represent the feature-wise alignment scores for better expressive power but only requires parallelizable matrix multiplications, and 3) combines multi-head with multi-dimensional attentions, and applies a distinct positional mask to each head (subspace), so the memory and computation can be distributed to multiple heads, each with sequential information encoded independently. The experiments show that a CNN/RNN-free model based on MTSA achieves state-of-the-art or competitive performance on nine NLP benchmarks with compelling memory- and time-efficiency.
Motivation & Objective
- To address the inefficiency and high memory cost of multi-dimensional self-attention mechanisms that model global dependencies.
- To combine the strengths of token-to-token and source-to-token attention for richer contextual modeling without sacrificing computational efficiency.
- To enable scalable, parallelizable computation for long sequences by distributing tensorized attention across multiple heads with distinct positional masks.
- To achieve state-of-the-art performance in NLP tasks while maintaining low memory and time complexity, comparable to CNNs.
Proposed method
- MTSA uses a hybrid compatibility function that combines dot-product attention for pairwise token dependencies and additive attention for global feature-wise dependencies.
- It represents alignment scores as a tensor (3D) to enhance expressive power, but computes them via efficient matrix multiplications instead of expensive tensor operations.
- The method employs multi-head attention with independent positional masks per head, enabling parallel computation and better modeling of sequential structure.
- Each attention head processes a separate subspace of the feature space, distributing memory and computation load across heads.
- The model integrates multi-dimensional attention at the feature level, allowing each feature to have its own global importance score, enhancing representational capacity.
- The framework is designed to be plug-and-play, replacing standard multi-head self-attention in models like Transformer without architectural overhaul.
Experimental results
Research questions
- RQ1Can a self-attention mechanism efficiently model both pairwise and global dependencies without incurring quadratic memory and computation costs?
- RQ2How does combining tensorized, multi-dimensional attention with multi-head and positional masking affect model performance and efficiency?
- RQ3Can a CNN/RNN-free model based on MTSA achieve state-of-the-art results across diverse NLP tasks while maintaining low memory and time complexity?
- RQ4Does the use of distinct positional masks per head improve modeling of sequential and relative positional information?
Key findings
- MTSA achieved state-of-the-art accuracy on the SNLI natural language inference benchmark, with 95.3% test accuracy, outperforming all baselines including multi-head attention and CNNs.
- On five sentence classification tasks, MTSA achieved the highest accuracy on CR, MPQA, TREC, and SST-5, with improvements of up to 0.5% over the next best model.
- In machine translation on WMT 2014 English-German, MTSA significantly outperformed multi-head self-attention in both training setups, with p-values of 0.001 and 0.080, respectively.
- MTSA maintained memory and computation costs comparable to CNNs, with no significant increase in model size (61.58M parameters vs. 61.38M for Transformer).
- The model demonstrated consistent performance gains across diverse NLP tasks, including sentiment analysis, semantic role labeling, and question-type classification, with competitive inference speed and low memory load.
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.