ZETA: Leveraging Z-order Curves for Efficient Top-k Attention
Not on the map. Why?
Abstract (arXiv)
Over recent years, the Transformer has become a fundamental building block for sequence modeling architectures. Yet at its core is the use of self-attention, whose memory and computational cost grow quadratically with the sequence length N, rendering it prohibitively expensive for long sequences. A promising approach is top-k attention, which selects only the k most relevant tokens and achieves performance comparable to vanilla self-attention while significantly reducing space and computational demands. However, causal masks require the current query token to only attend to past tokens, preventing the existing top-k attention method from efficiently searching for the most relevant tokens in parallel, thereby limiting training efficiency. In this work, we propose ZETA, leveraging Z-Order Curves for Efficient Top-k Attention, to enable parallel querying of past tokens for entire sequences. % in both space and time complexity of O(N log N). We first theoretically show that the choice of key and query dimensions involves a trade-off between the curse of dimensionality and the preservation of relative distances after projection. In light of this insight, we propose reducing the dimensionality of keys and queries in contrast to values and further leverage Z-order curves to map low-dimensional keys and queries into one-dimensional space, which permits parallel sorting, thereby largely improving the efficiency for top-k token selection. Experimental results demonstrate that ZETA matches the performance of standard attention on the synthetic textscMulti-Query Associative Recall task and outperforms attention and its variants on textscLong Range Arena and textscWikiText-103 language modeling.
Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Builds on 40 of its 53 references that are in the map. First posted on arXiv 24 Jan 2025.
Builds on
40 of 53 references.
References · 40
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,616
- 2020Training data-efficient image transformers & distillation through attentioncited by 4,560
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
- 2021Zero-Shot Text-to-Image Generationcited by 4,276
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2020Longformer: The Long-Document Transformercited by 3,362
- 2016Pointer Sentinel Mixture Modelscited by 2,992
28 more
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2024Mixtral of Expertscited by 1,785
- 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
- 2020Reformer: The Efficient Transformercited by 1,658
- 2020Rethinking Attention with Performerscited by 1,584
- 2019Generating Long Sequences with Sparse Transformerscited by 1,523
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,462
- 2020Efficient Transformers: A Surveycited by 784
- 2020Long Range Arena: A Benchmark for Efficient Transformerscited by 696
- 2021Nystr"omformer: A Nystr"om-Based Algorithm for Approximating Self-Attentioncited by 468
- 2018Efficient Attention: Attention with Linear Complexitiescited by 366
- 2019Axial Attention in Multidimensional Transformerscited by 350
- 2020Sparse Sinkhorn Attentioncited by 250
- 2022cosFormer: Rethinking Softmax in Attentioncited by 212
- 2018Scaling Neural Machine Translationcited by 204
- 2024Simple linear attention language models balance the recall-throughput tradeoffcited by 197
- 2023Zoology: Measuring and Improving Recall in Efficient Language Modelscited by 188
- 2023Stabilizing Transformer Training by Preventing Attention Entropy Collapsecited by 154
- 2023Unlimiformer: Long-Range Transformers with Unlimited Length Inputcited by 127
- 2024The Hedgehog & the Porcupine: Expressive Linear Attentions with Softmax Mimicrycited by 119
- 2022The Devil in Linear Transformercited by 98
- 2021Skyformer: Remodel Self-Attention with Gaussian Kernel and Nystr"om Methodcited by 61
- 2021Memory-efficient Transformers via Top-k Attentioncited by 59
- 2023A Study on ReLU and Softmax in Transformercited by 53
- 2021H-Transformer-1D: Fast One-Dimensional Hierarchical Attention for Sequencescited by 47
- 2022Structure-Preserving Graph Representation Learningcited by 17
- 2023Foresee What You Will Learn: Data Augmentation for Domain Generalization in Non-stationary Environmentcited by 11
- 2024IceFormer: Accelerated Inference with Long-Sequence Transformers on CPUscited by 8
Built on by
Citing papers per year: 2025: 4; 2026: 5.
9 papers.
- 2025Long-Context Generalization with Sparse Attentioncited by 18
- 2025Mamba Modulation: On the Length Generalization of Mambacited by 13
- 2025Homophily Enhanced Graph Domain Adaptationcited by 9
- 2026Full spectrum Unlearnable Examples via Spectral Equalizationcited by 3
- 2026Z-Order Transformer for Feed-Forward Gaussian Splattingcited by 1
- 2025Balancing Computation Load and Representation Expressivity in Parallel Hybrid Neural Networkscited by 0
- 2026k-Maximum Inner Product Attention for Graph Transformers and the Expressive Power of GraphGPScited by 0
- 2026ARM: Attention with Routed-Memory for Learnable Sparse Controlcited by 0
- 2026DimPO: Dimensionality Reduction for Attention using Preference Optimizationcited by 0
- 2026DimPO: Dimensionality Reduction for Attention using Preference Optimization26 Sep 2026
- 2026ARM: Attention with Routed-Memory for Learnable Sparse Control21 Sep 2026
- 2026Full spectrum Unlearnable Examples via Spectral Equalization25 Jun 2026
- 2026Z-Order Transformer for Feed-Forward Gaussian Splatting13 May 2026
- 2026k-Maximum Inner Product Attention for Graph Transformers and the Expressive Power of GraphGPS4 Apr 2026
- 2025Mamba Modulation: On the Length Generalization of Mamba23 Sep 2025
- 2025Long-Context Generalization with Sparse Attention19 Jun 2025
- 2025Homophily Enhanced Graph Domain Adaptation26 May 2025
- 2025Balancing Computation Load and Representation Expressivity in Parallel Hybrid Neural Networks26 May 2025