Efficient Content-Based Sparse Attention with Routing Transformers
Ashish Vaswani
Top #35 Global AI Researcher · Essential AI / Google Brain
Ashish Vaswani conducts research in attention is all you need, transformer networks & sequence modeling at Essential AI / Google Brain.
Self-attention has recently been adopted for a wide range of sequence modeling problems. Despite its effectiveness, self-attention suffers from quadratic computation and memory requirements with respect to sequence length. Successful approaches to reduce this complexity focused on attending to local sliding windows or a small set of locations independent of content. Our work proposes to learn dynamic sparse attention patterns that avoid allocating computation and memory to attend to content unrelated to the query of interest.
This work builds upon two lines of research: It combines the modeling flexibility of prior work on content-based sparse attention with the efficiency gains from approaches based on local, temporal sparse attention. Our model, the Routing Transformer, endows self-attention with a sparse routing module based on online k-means while reducing the overall complexity of attention to O( n 1.5 d) from O( n 2 d) for sequence length n and hidden dimension d.
We show that our model outperforms comparable sparse attention models on language modeling on Wikitext-103 (15.8 vs 18.3 perplexity), as well as on image generation on ImageNet-64 (3.43 vs 3.44 bits/dim) while using fewer self-attention layers. Additionally, we set a new state-of-the-art on the newly released PG-19 data-set, obtaining a test perplexity of 33.2 with a 22 layer Routing Transformer model trained on sequences of length 8192.
We open-source the code for Routing Transformer in Tensorflow. 1
Originally published at Transactions of the Association for Computational Linguistics
By Ashish Vaswani (Google DeepMind) · 2021-02-15 · Open Access / Academic Attribution.
Add a Worked Example, Practitioner Field Note, or Counter-Thesis
More from Google DeepMind & Related Topics
All 51 works from Google DeepMind →Discovering the systematic errors made by machine learning models
Discovering systematic errors with cross-modal embeddings In this blog post, we introduce Domino, a new approach for discovering systematic errors made by…
BAIR at CoRL 2026
The Conference on Robot Learning (CoRL) takes place November 9–12, 2026, in Austin, Texas. BAIR faculty, postdocs and students will be presenting research…
Assessment of Storage Insect Pests, Methods and Management Practices for Rice (Oryza sativa L.) in Fogera, Northwestern Ethiopia
Storage pests are a significant factor contributing to rice crop losses, adversely affecting both the quantity and quality of stored rice. This study was…
Population Dynamics, Yield Loss and Management of Major Insect Pests of Rice ( <i>Oryza sativa</i> L.) Crop: A Review
Rice insect pests are a major biological constraint in rice production. They affect every part of the rice plant throughout all growth stages, leading to…