Abstract
While the Transformer architecture has set new benchmarks in Natural Language Processing, its quadratic computational complexity and high data requirements remain significant barriers. We present the Star-Transformer, a lightweight alternative that sparsifies the standard fully-connected attention mechanism into a star-shaped topology. By combining local ring connections with a global relay node, the Star-Transformer achieves linear complexity ($O(n)$) while maintaining the ability to capture long-range dependencies. Our evaluation across 22 datasets demonstrates that the Star-Transformer not only provides substantial speedups but also outperforms standard Transformers on modestly sized datasets and sequence labeling tasks.
Introduction
The standard Transformer has revolutionized NLP through its self-attention mechanism, which allows for parallelization and effective modeling of dependencies regardless of distance. However, this power comes at a cost. First, the computational tax is high: the $O(n^2)$ complexity relative to sequence length $n$ makes processing long documents memory-intensive and slow. Second, the data hunger of Transformers is significant; without the structural inductive biases found in CNNs or RNNs, they must learn basic linguistic patterns (like local context) from scratch, often requiring massive pre-training corpora.
The Star-Transformer addresses these issues by injecting a structural prior that mimics human text processing: focusing on immediate neighbors while maintaining a global overview.
The Star Topology
The core innovation of this architecture is the transition from a dense web of connections to a sparse Star Topology. This structure is defined by two primary link types:
- Ring Connections: Each token node is connected to its immediate left and right neighbors. This captures local compositionality, ensuring the model inherently understands that adjacent words are likely related.
- Radical Connections: Every token node is connected to a shared virtual relay node (s). This node acts as a global hub, allowing any two distant tokens to communicate in just two "hops" (Token A $\to$ Relay $\to$ Token B).
The update process alternates between updating satellite (token) nodes based on their neighbors and the relay node, and then updating the relay node by aggregating information from all satellites. This sparsification reduces the number of connections from $n^2$ to approximately $2n$, achieving linear complexity.
Experimental Evaluation
The authors evaluated the Star-Transformer across 22 datasets spanning four major categories:
- Synthetic Simulation: A "Masked Summation" task to test long-range dependency handling.
- Text Classification: The Stanford Sentiment Treebank (SST) and the MTL-16 suite (16 small-scale domain-specific datasets).
- Natural Language Inference (NLI): The Stanford Natural Language Inference (SNLI) dataset.
- Sequence Labeling: POS tagging (PTB) and Named Entity Recognition (CoNLL2003/OntoNotes).
Performance and Efficiency
The Star-Transformer demonstrates significant advantages in both speed and accuracy, particularly when training data is limited. On the MTL-16 datasets, which contain only 1,400 samples each, the Star-Transformer improved average accuracy by 4.2% over the standard Transformer, suggesting that its structural bias prevents the overfitting common in dense models on small data.
In terms of efficiency, the model was 10x faster than the standard Transformer on simulation tasks and 4.5x faster on real-world benchmarks. Furthermore, it achieved state-of-the-art (SOTA) or near-SOTA results on sequence labeling tasks like NER and POS tagging, proving that sparsification does not necessarily come at the expense of representational power.
Conclusion
The Star-Transformer successfully "lightens" the Transformer architecture by replacing dense attention with a linear-complexity star graph. By explicitly separating local context modeling from global information routing, it provides a robust and efficient alternative for NLP tasks, especially those involving modest datasets or long sequences. Future work may explore the scalability of this topology when combined with large-scale pre-training techniques like BERT.
Summary updated