mlsanityData to 7 Oct 2026

ZETA: Leveraging Z-order Curves for Efficient Top-k Attention

arXiv 2501.14577 ↗First posted 24 Jan 2025cs.LG cs.AIcited by 9

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

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
  5. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
  6. 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,616
  7. 2020Training data-efficient image transformers & distillation through attentioncited by 4,560
  8. 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
  9. 2021Zero-Shot Text-to-Image Generationcited by 4,276
  10. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
  11. 2020Longformer: The Long-Document Transformercited by 3,362
  12. 2016Pointer Sentinel Mixture Modelscited by 2,992
28 more
  1. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
  2. 2024Mixtral of Expertscited by 1,785
  3. 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
  4. 2020Reformer: The Efficient Transformercited by 1,658
  5. 2020Rethinking Attention with Performerscited by 1,584
  6. 2019Generating Long Sequences with Sparse Transformerscited by 1,523
  7. 2020Linformer: Self-Attention with Linear Complexitycited by 1,462
  8. 2020Efficient Transformers: A Surveycited by 784
  9. 2020Long Range Arena: A Benchmark for Efficient Transformerscited by 696
  10. 2021Nystr"omformer: A Nystr"om-Based Algorithm for Approximating Self-Attentioncited by 468
  11. 2018Efficient Attention: Attention with Linear Complexitiescited by 366
  12. 2019Axial Attention in Multidimensional Transformerscited by 350
  13. 2020Sparse Sinkhorn Attentioncited by 250
  14. 2022cosFormer: Rethinking Softmax in Attentioncited by 212
  15. 2018Scaling Neural Machine Translationcited by 204
  16. 2024Simple linear attention language models balance the recall-throughput tradeoffcited by 197
  17. 2023Zoology: Measuring and Improving Recall in Efficient Language Modelscited by 188
  18. 2023Stabilizing Transformer Training by Preventing Attention Entropy Collapsecited by 154
  19. 2023Unlimiformer: Long-Range Transformers with Unlimited Length Inputcited by 127
  20. 2024The Hedgehog & the Porcupine: Expressive Linear Attentions with Softmax Mimicrycited by 119
  21. 2022The Devil in Linear Transformercited by 98
  22. 2021Skyformer: Remodel Self-Attention with Gaussian Kernel and Nystr"om Methodcited by 61
  23. 2021Memory-efficient Transformers via Top-k Attentioncited by 59
  24. 2023A Study on ReLU and Softmax in Transformercited by 53
  25. 2021H-Transformer-1D: Fast One-Dimensional Hierarchical Attention for Sequencescited by 47
  26. 2022Structure-Preserving Graph Representation Learningcited by 17
  27. 2023Foresee What You Will Learn: Data Augmentation for Domain Generalization in Non-stationary Environmentcited by 11
  28. 2024IceFormer: Accelerated Inference with Long-Sequence Transformers on CPUscited by 8

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 4; 2026: 5.

9 papers.