A Slice and Dice Approach to Accelerate Compound Sparse Attention on GPU
Abstract
Transformer-based models are vital to various research domains, including NLP, computer vision, and recommendation systems. However, because the attention mechanism with quadratic complexity limits computation and memory footprint in long sequences, numerous sparse attention-based transformer models are proposed to alleviate these problems. To efficiently infer these models on GPUs, prior solutions such as Triton and Sputnik have accelerated sparse attention in the sparse transformers, including optimizations for sampled dense-dense matrix multiplication (SDDMM), sparse softmax (SpSoftmax), and sparse matrix-matrix multiplication (SpMM). Although the existing optimizations have achieved impressive improvement, they have shortcomings, including low data reuse, unnecessary computation, and unnecessary memory accesses in the latest sparse transformer models based on compound sparse attention.We propose Multigrain to accelerate sparse attention by applying compound sparse GPU kernels with multi-stream for compound sparse patterns. First, we take sparse patterns with high spatial locality and execute them on our customized coarse-grained kernels, which exploit data reuse and high-performance tensor core units. Second, we execute the sparse patterns with low spatial locality on the fine-grained kernels to reduce unnecessary computation and memory accesses. Last, we process the coarse-grained and fine-grained kernels in parallel using multi-stream for the SDDMM and SpMM. In the latest sparse transformer models such as Longformer and QDS-transformer, Multigrain achieved 2.07× and 1.55× end-to-end speedup, respectively, over Triton, which only uses the coarse-grained method. We also achieved 2.08× and 1.08× end-to-end speedup, respectively, compared to Sputnik, which only uses the fine-grained kernel.
Integrity signals
Registry
Cites
Statistics
Claims the paper makes
Claims other papers make about this one
Each is checked against this paper’s own text: does it say what the citing paper says it does?
Previous works store sparse matrices using either coarse-grain format or fine-grain format, which is inefficient for all sparse patterns.
“Previous works store the sparse matrices using either coarsegrain format (e.g., block coordinate format) or fine-grain format, e.g., coordinate (COO) or compressed sparse row (CSR), which is inefficient for all sparse patterns.”
From A Survey of Techniques for Optimizing Transformer Inference (2023) · cites this paper as [120]
Li et al. achieve higher performance than techniques using either coarse- or fine-grain methods.
“They achieve higher performance than techniques using either coarse- or fine-grain methods.”
From A Survey of Techniques for Optimizing Transformer Inference (2023) · cites this paper as [120]
CUTLASS kernels are more efficient than Sputnik kernels.
“For fine-grain kernels, they adapt Sputnik kernels and use CUTLASS kernels, which are more efficient than Sputnik kernels.”
From A Survey of Techniques for Optimizing Transformer Inference (2023) · cites this paper as [120]
The presence of overlapped coarse/fine-grain patterns in the same row leads to inaccuracies in sparse softmax.
“Since softmax reads all the row elements, the presence of overlapped coarse/fine-grain patterns in the same row leads to inaccuracies.”
From A Survey of Techniques for Optimizing Transformer Inference (2023) · cites this paper as [120]
Transformers that use composite sparse attention, such as Longformer, are inefficient on GPUs since different sparse patterns have different locality patterns.
“Li et al. [120] note that transformers that use composite sparse attention, such as Longformer, are inefficient on GPUs since different sparse patterns have different locality patterns.”
From A Survey of Techniques for Optimizing Transformer Inference (2023) · cites this paper as [120]
Li et al.'s technique improves the performance of Longformer and QDSTransformer models on state-of-art GPUs.
“Their technique improves the performance of Longformer and QDSTransformer models on state-of-art GPUs.”
From A Survey of Techniques for Optimizing Transformer Inference (2023) · cites this paper as [120]
Composite sparse attention takes three-fourths of the execution time on Longformer.
“Hence, composite sparse attention takes three-fourths of the execution time on Longformer.”
From A Survey of Techniques for Optimizing Transformer Inference (2023) · cites this paper as [120]
Cites
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., & Polosukhin, I. (2017) · arXiv · doi:10.48550/arxiv.1706.03762 · Cited by 120,404 · see citing works
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019) · Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers) · doi:10.18653/v1/n19-1423 · Cited by 48,293 · see citing works
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., & Guo, B. (2021) · 2021 IEEE/CVF International Conference on Computer Vision (ICCV) · doi:10.1109/iccv48922.2021.00986 · Cited by 35,534 · see citing works
Language Models are Few-Shot Learners
Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. (2020) · arXiv · doi:10.48550/arxiv.2005.14165 · Cited by 23,372 · see citing works
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. (2020) · arXiv · doi:10.48550/arxiv.2010.11929 · Cited by 21,793 · see citing works
(2017) · Cited by 11,625 · see citing works
Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., & Liu, P. J. (2019) · arXiv · doi:10.48550/arxiv.1910.10683 · Cited by 10,929 · see citing works
Lewis, M., Liu, Y., Goyal, N., Ghazvininejad, M., Mohamed, A., Levy, O., Stoyanov, V., & Zettlemoyer, L. (2020) · Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics · doi:10.18653/v1/2020.acl-main.703 · Cited by 8,821 · see citing works
Transformers: State-of-the-Art Natural Language Processing
Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., et al. (2020) · Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations · doi:10.18653/v1/2020.emnlp-demos.6 · Cited by 8,741 · see citing works
Multi-scale context aggregation by dilated convolutions
Yu, F., & Koltun, V. (2015) · arXiv · doi:10.48550/arxiv.1511.07122 · Cited by 7,738 · see citing works
XLNet: Generalized Autoregressive Pretraining for Language Understanding
Yang, Z., Dai, Z., Yang, Y., Carbonell, J., Salakhutdinov, R., & Le, Q. V. (2019) · arXiv · doi:10.48550/arxiv.1906.08237 · Cited by 6,687 · see citing works
Transformer-XL: Attentive language models beyond a fixed-length context
Dai, Z., Yang, Z., Yang, Y., Carbonell, J., Le, Q., & Salakhutdinov, R. (2019) · Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics · doi:10.18653/v1/p19-1285 · Cited by 3,169 · see citing works
BERT4Rec: Sequential Recommendation with Bidirectional Encoder Representations from Transformer
Sun, F., Liu, J., Wu, J., Pei, C., Lin, X., Ou, W., & Jiang, P. (2019) · Proceedings of the 28th ACM International Conference on Information and Knowledge Management · doi:10.1145/3357384.3357895 · Cited by 2,558 · see citing works
wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations
Baevski, A., Zhou, H., Mohamed, A., & Auli, M. (2020) · arXiv · doi:10.48550/arxiv.2006.11477 · Cited by 2,369 · see citing works
Longformer: The Long-Document Transformer
Beltagy, I., Peters, M. E., & Cohan, A. (2020) · arXiv · doi:10.48550/arxiv.2004.05150 · Cited by 2,281 · see citing works
HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answering
Yang, Z., Qi, P., Zhang, S., Bengio, Y., Cohen, W., Salakhutdinov, R., & Manning, C. D. (2018) · Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing · doi:10.18653/v1/d18-1259 · Cited by 1,804 · see citing works
TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehension
Joshi, M., Choi, E., Weld, D., & Zettlemoyer, L. (2017) · Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · doi:10.18653/v1/p17-1147 · Cited by 1,690 · see citing works
Big Bird: Transformers for Longer Sequences
Zaheer, M., Guruganesh, G., Dubey, A., Ainslie, J., Alberti, C., Ontanon, S., Pham, P., Ravula, A., Wang, Q., Yang, L., et al. (2020) · arXiv · doi:10.48550/arxiv.2007.14062 · Cited by 1,349 · see citing works
Efficient transformers: A survey
Tay, Y., Dehghani, M., Bahri, D., & Metzler, D. (2023) · ACM Computing Surveys · doi:10.1145/3530811 · Cited by 1,267 · see citing works
MS MARCO: A Human Generated MAchine Reading COmprehension DatasetPreprint
Bajaj, P., Campos, D., Craswell, N., Deng, L., Gao, J., Liu, X., Majumder, R., McNamara, A., Mitra, B., Nguyen, T. G., et al. (2016) · arXiv (Cornell University) · doi:10.4230/lipics.giscience.2025.5 · Cited by 1,190 · see citing works
Rasley, J., Rajbhandari, S., Ruwase, O., & He, Y. (2020) · Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining · doi:10.1145/3394486.3406703 · Cited by 823 · see citing works
MS MARCO: A Human Generated MAchine Reading COmprehension Dataset.
Nguyen, T. G., Rosenberg, M., Xia, S., Gao, J., Tiwary, S., Majumder, R., & Deng, L. (2016) · neural information processing systems · Cited by 537 · see citing works
NVIDIA A100 Tensor Core GPU: Performance and Innovation
Choquette, J., Gandhi, W., Giroux, O., Stam, N., & Krashinsky, R. (2021) · IEEE Micro · doi:10.1109/mm.2021.3061394 · Cited by 410 · see citing works
Triton: an intermediate language and compiler for tiled neural network computations
Tillet, P., Kung, H. T., & Cox, D. (2019) · Proceedings of the 3rd ACM SIGPLAN International Workshop on Machine Learning and Programming Languages · doi:10.1145/3315508.3329973 · Cited by 318 · see citing works
Long Range Arena: A Benchmark for Efficient Transformers
Tay, Y., Dehghani, M., Abnar, S., Shen, Y., Bahri, D., Pham, P., Rao, J., Yang, L., Ruder, S., & Metzler, D. (2020) · arXiv · doi:10.48550/arxiv.2011.04006 · Cited by 241 · see citing works
Transformers4Rec: Bridging the Gap between NLP and Sequential / Session-Based Recommendation
Moreira, G. D. S. P., Rabhi, S., Lee, J. M., Ak, R., & Oldridge, E. (2021) · ACM Conference on Recommender Systems (RecSys) · doi:10.1145/3460231.3474255 · Cited by 189 · see citing works
Sparse GPU Kernels for Deep Learning
Gale, T., Zaharia, M., Young, C., & Elsen, E. (2020) · International Conference for High Performance Computing, Networking, Storage and Analysis (SC) · doi:10.1109/sc41405.2020.00021 · Cited by 183 · see citing works
Multi-hop Reading Comprehension across Multiple Documents by Reasoning over Heterogeneous Graphs
Tu, M., Wang, G., Huang, J., Tang, Y., He, X., & Zhou, B. (2019) · Proceedings of the conference - Association for Computational Linguistics. Meeting · doi:10.18653/v1/p19-1260 · Cited by 166 · see citing works
Volta: Performance and Programmability
Choquette, J., Giroux, O., & Foley, D. (2018) · IEEE Micro · doi:10.1109/mm.2018.022071134 · Cited by 125 · see citing works
Poolingformer: Long Document Modeling with Pooling AttentionPreprint
Zhang, H., Gong, Y., Shen, Y.-L., Li, W., Lv, J., Duan, N., & Chen, W.-Z. (2021) · International Conference on Machine Learning · doi:10.48550/arxiv.2105.04371 · Cited by 123 · see citing works
Design Principles for Sparse Matrix Multiplication on the GPU
Yang, C., Buluç, A., & Owens, J. D. (2018) · Lecture notes in computer science · doi:10.1007/978-3-319-96983-1_48 · Cited by 116 · see citing works
Burgess, J. (2020) · IEEE Micro · doi:10.1109/mm.2020.2971677 · Cited by 116 · see citing works
Accelerating Sparse Deep Neural Networks
Mishra, A., Latorre, J. A., Pool, J., Stosic, D., Stosic, D., Venkatesh, G., Yu, C., & Micikevicius, P. (2021) · arXiv · doi:10.48550/arxiv.2104.08378 · Cited by 97 · cited 1× · see citing works
“Starting from the Ampere and Hopper architecture GPUs, NVIDIA introduced sparse tensor cores [22] to accelerate the sparse operation of the 2:4 (50%) fine-grained structured patterns.”
MethodEfficient tensor core-based GPU kernels for structured sparsity under reduced precision
Chen, Z., Qu, Z., Liu, L., Ding, Y., & Xie, Y. (2021) · International Conference for High Performance Computing, Networking, Storage and Analysis (SC) · doi:10.1145/3458817.3476182 · Cited by 56 · see citing works
SCROLLS: Standardized CompaRison Over Long Language Sequences
Shaham, U., Segal, E., Ivgi, M., Efrat, A., Yoran, O., Haviv, A., Gupta, A., Xiong, W., Geva, M., Berant, J., et al. (2022) · Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing · doi:10.18653/v1/2022.emnlp-main.823 · Cited by 40 · see citing works
Transformer Acceleration with Dynamic Sparse AttentionPreprint
Liu, L., Qu, Z., Chen, Z., Ding, Y.-F., & Xie, Y. (2021) · arXiv.org · doi:10.48550/arxiv.2110.11299 · Cited by 35 · see citing works
Online normalizer calculation for softmax
Milakov, M., & Gimelshein, N. (2018) · arXiv · doi:10.48550/arxiv.1805.02867 · Cited by 27 · cited 1× · see citing works
“row [21]: First, the max-finding process searches for the maximum of non-zero elements.”
BackgroundLong Document Ranking with Query-Directed Sparse Transformer
Jiang, J., Xiong, C., Lee, C.-J., & Wang, W. W. (2020) · Findings of the Association for Computational Linguistics: EMNLP (Findings of EMNLP) · doi:10.18653/v1/2020.findings-emnlp.412 · Cited by 25 · see citing works
Beyond Paragraphs: NLP for Long Sequences
Beltagy, I., Cohan, A., Hajishirzi, H., Min, S., & Peters, M. E. (2021) · doi:10.18653/v1/2021.naacl-tutorials.5 · Cited by 7 · see citing works
PASH at TREC 2021 Deep Learning Track: Generative Enhanced Model for Multi-stage RankingPreprint
Qiao, Y., Zhao, S., Wang, J., Chen, H., Liu, T., Ye, X., Tang, X., Fang, R., Gao, P., Xie, W., et al. (2022) · arXiv (Cornell University) · doi:10.48550/arxiv.2205.11245 · Cited by 1 · see citing works
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2018) · arXiv · doi:10.48550/arxiv.1810.04805
Flagged first, then by citations
4 of the 45 references couldn’t be matched to a known paper.
Cited by
Sorted by citations
A Survey of Techniques for Optimizing Transformer Inference
Chitty-Venkata, K. T., Mittal, S., Emani, M., Vishwanath, V., & Somani, A. K. (2023) · Journal of Systems Architecture · doi:10.1016/j.sysarc.2023.102990 · Cited by 154 · see citing works
Accelerating Transformer Networks through Recomposing Softmax Layers
Choi, J., Li, H., Kim, B., Hwang, S., & Ahn, J. H. (2022) · IEEE International Symposium on Workload Characterization · doi:10.1109/iiswc55918.2022.00018 · Cited by 13 · see citing works
Self-citationHai-long, L., Choi, J., Kwon, Y., & Ahn, J. H. (2023) · IEEE Computer Architecture Letters · doi:10.1109/lca.2023.3323482 · Cited by 3 · see citing works
Self-citation
- Authors
- Li, H., Choi, J., & Ahn, J. H.
- Affiliations
- Seoul National University (KR)
- Venue
- 2022 IEEE International Symposium on Workload Characterization (IISWC)
- Publisher
- IEEE
- Published
- 2022-11
- Pages
- 104-116
- OpenAlex
- W4311263234
- Cited by
- 3
- References
- 45
- Citations by year
- 2023: 2 · 2022: 1
- FWCI
- 0.60
- Type
- conference paper
- Language
- en
- Open access
- closed
- Locations
- IEEE International Symposium on Workload Characterization (publishedVersion)
- Funders
- Samsung
- Topics
- Physical Sciences › Computer Science › Hardware and Architecture › Parallel Computing and Optimization Techniques
- Physical Sciences › Computer Science › Computer Vision and Pattern Recognition › Advanced Neural Network Applications
- Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
- Keywords
- sparse attention, sparse transformer, GPU kernel optimization, sparse matrix-matrix multiplication, tensor cores, Longformer, inference acceleration, data reuse
About these checks
Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.
Statistics and arithmetic are recomputed, not judged.
Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.
What counts as a claim ›How we measure confidence ›How we check this ›
Are you an author, or do you see a problem with this page? Request a review