Linear Attention Sequence Parallelism

Sequence Parallel (SP) serves as a prevalent strategy to handle long sequences that exceed the memory limit of a single GPU. However, existing SP methods do not take advantage of linear attention features, resulting in sub-optimal parallelism efficiency and usability for linear attention-based langu...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Sun, Weigao, Qin, Zhen, Li, Dong, Shen, Xuyang, Qiao, Yu, Zhong, Yiran
Format: Artikel
Sprache:eng
Schlagworte:
Online-Zugang:Volltext bestellen
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
container_end_page
container_issue
container_start_page
container_title
container_volume
creator Sun, Weigao
Qin, Zhen
Li, Dong
Shen, Xuyang
Qiao, Yu
Zhong, Yiran
description Sequence Parallel (SP) serves as a prevalent strategy to handle long sequences that exceed the memory limit of a single GPU. However, existing SP methods do not take advantage of linear attention features, resulting in sub-optimal parallelism efficiency and usability for linear attention-based language models. In this paper, we introduce Linear Attention Sequence Parallel (LASP), an efficient SP method tailored to linear attention-based language models. Specifically, we design an efficient point-to-point communication mechanism to leverage the right-product kernel trick of linear attention, which sharply decreases the communication overhead of SP. We also enhance the practical efficiency of LASP by performing kernel fusion and intermediate state caching, making the implementation of LASP hardware-friendly on GPU clusters. Furthermore, we meticulously ensure the compatibility of sequence-level LASP with all types of batch-level data parallel methods, which is vital for distributed training on large clusters with long sequences and large batches. We conduct extensive experiments on two linear attention-based models with varying sequence lengths and GPU cluster sizes. LASP scales sequence length up to 4096K using 128 A100 80G GPUs on 1B models, which is 8 times longer than existing SP methods while being significantly faster. The code is available at https://github.com/OpenNLPLab/LASP.
doi_str_mv 10.48550/arxiv.2404.02882
format Article
fullrecord <record><control><sourceid>arxiv_GOX</sourceid><recordid>TN_cdi_arxiv_primary_2404_02882</recordid><sourceformat>XML</sourceformat><sourcesystem>PC</sourcesystem><sourcerecordid>2404_02882</sourcerecordid><originalsourceid>FETCH-LOGICAL-a672-7f71b6af77409a4199a88fe03520b2207b819735d0ff07f27af9ebdc76e9c8d63</originalsourceid><addsrcrecordid>eNotzrsKwjAUgOEsDqI-gJNdHFtP07QnGUW8QUFB93LankCgVo1V9O3Fy_RvP58Q4xgipdMUZuSf7hFJBSoCqbXsi2nuWiYfzLuO286d2-DA1zu3FQd78tQ03LjbaSh6lpobj_4diONqeVxswny33i7meUgZyhAtxmVGFlGBIRUbQ1pbhiSVUEoJWOrYYJLWYC2glUjWcFlXmLGpdJ0lAzH5bb_O4uLdifyr-HiLrzd5A_PGObU</addsrcrecordid><sourcetype>Open Access Repository</sourcetype><iscdi>true</iscdi><recordtype>article</recordtype></control><display><type>article</type><title>Linear Attention Sequence Parallelism</title><source>arXiv.org</source><creator>Sun, Weigao ; Qin, Zhen ; Li, Dong ; Shen, Xuyang ; Qiao, Yu ; Zhong, Yiran</creator><creatorcontrib>Sun, Weigao ; Qin, Zhen ; Li, Dong ; Shen, Xuyang ; Qiao, Yu ; Zhong, Yiran</creatorcontrib><description>Sequence Parallel (SP) serves as a prevalent strategy to handle long sequences that exceed the memory limit of a single GPU. However, existing SP methods do not take advantage of linear attention features, resulting in sub-optimal parallelism efficiency and usability for linear attention-based language models. In this paper, we introduce Linear Attention Sequence Parallel (LASP), an efficient SP method tailored to linear attention-based language models. Specifically, we design an efficient point-to-point communication mechanism to leverage the right-product kernel trick of linear attention, which sharply decreases the communication overhead of SP. We also enhance the practical efficiency of LASP by performing kernel fusion and intermediate state caching, making the implementation of LASP hardware-friendly on GPU clusters. Furthermore, we meticulously ensure the compatibility of sequence-level LASP with all types of batch-level data parallel methods, which is vital for distributed training on large clusters with long sequences and large batches. We conduct extensive experiments on two linear attention-based models with varying sequence lengths and GPU cluster sizes. LASP scales sequence length up to 4096K using 128 A100 80G GPUs on 1B models, which is 8 times longer than existing SP methods while being significantly faster. The code is available at https://github.com/OpenNLPLab/LASP.</description><identifier>DOI: 10.48550/arxiv.2404.02882</identifier><language>eng</language><subject>Computer Science - Computation and Language ; Computer Science - Learning</subject><creationdate>2024-04</creationdate><rights>http://arxiv.org/licenses/nonexclusive-distrib/1.0</rights><oa>free_for_read</oa><woscitedreferencessubscribed>false</woscitedreferencessubscribed></display><links><openurl>$$Topenurl_article</openurl><openurlfulltext>$$Topenurlfull_article</openurlfulltext><thumbnail>$$Tsyndetics_thumb_exl</thumbnail><link.rule.ids>228,230,780,885</link.rule.ids><linktorsrc>$$Uhttps://arxiv.org/abs/2404.02882$$EView_record_in_Cornell_University$$FView_record_in_$$GCornell_University$$Hfree_for_read</linktorsrc><backlink>$$Uhttps://doi.org/10.48550/arXiv.2404.02882$$DView paper in arXiv$$Hfree_for_read</backlink></links><search><creatorcontrib>Sun, Weigao</creatorcontrib><creatorcontrib>Qin, Zhen</creatorcontrib><creatorcontrib>Li, Dong</creatorcontrib><creatorcontrib>Shen, Xuyang</creatorcontrib><creatorcontrib>Qiao, Yu</creatorcontrib><creatorcontrib>Zhong, Yiran</creatorcontrib><title>Linear Attention Sequence Parallelism</title><description>Sequence Parallel (SP) serves as a prevalent strategy to handle long sequences that exceed the memory limit of a single GPU. However, existing SP methods do not take advantage of linear attention features, resulting in sub-optimal parallelism efficiency and usability for linear attention-based language models. In this paper, we introduce Linear Attention Sequence Parallel (LASP), an efficient SP method tailored to linear attention-based language models. Specifically, we design an efficient point-to-point communication mechanism to leverage the right-product kernel trick of linear attention, which sharply decreases the communication overhead of SP. We also enhance the practical efficiency of LASP by performing kernel fusion and intermediate state caching, making the implementation of LASP hardware-friendly on GPU clusters. Furthermore, we meticulously ensure the compatibility of sequence-level LASP with all types of batch-level data parallel methods, which is vital for distributed training on large clusters with long sequences and large batches. We conduct extensive experiments on two linear attention-based models with varying sequence lengths and GPU cluster sizes. LASP scales sequence length up to 4096K using 128 A100 80G GPUs on 1B models, which is 8 times longer than existing SP methods while being significantly faster. The code is available at https://github.com/OpenNLPLab/LASP.</description><subject>Computer Science - Computation and Language</subject><subject>Computer Science - Learning</subject><fulltext>true</fulltext><rsrctype>article</rsrctype><creationdate>2024</creationdate><recordtype>article</recordtype><sourceid>GOX</sourceid><recordid>eNotzrsKwjAUgOEsDqI-gJNdHFtP07QnGUW8QUFB93LankCgVo1V9O3Fy_RvP58Q4xgipdMUZuSf7hFJBSoCqbXsi2nuWiYfzLuO286d2-DA1zu3FQd78tQ03LjbaSh6lpobj_4diONqeVxswny33i7meUgZyhAtxmVGFlGBIRUbQ1pbhiSVUEoJWOrYYJLWYC2glUjWcFlXmLGpdJ0lAzH5bb_O4uLdifyr-HiLrzd5A_PGObU</recordid><startdate>20240403</startdate><enddate>20240403</enddate><creator>Sun, Weigao</creator><creator>Qin, Zhen</creator><creator>Li, Dong</creator><creator>Shen, Xuyang</creator><creator>Qiao, Yu</creator><creator>Zhong, Yiran</creator><scope>AKY</scope><scope>GOX</scope></search><sort><creationdate>20240403</creationdate><title>Linear Attention Sequence Parallelism</title><author>Sun, Weigao ; Qin, Zhen ; Li, Dong ; Shen, Xuyang ; Qiao, Yu ; Zhong, Yiran</author></sort><facets><frbrtype>5</frbrtype><frbrgroupid>cdi_FETCH-LOGICAL-a672-7f71b6af77409a4199a88fe03520b2207b819735d0ff07f27af9ebdc76e9c8d63</frbrgroupid><rsrctype>articles</rsrctype><prefilter>articles</prefilter><language>eng</language><creationdate>2024</creationdate><topic>Computer Science - Computation and Language</topic><topic>Computer Science - Learning</topic><toplevel>online_resources</toplevel><creatorcontrib>Sun, Weigao</creatorcontrib><creatorcontrib>Qin, Zhen</creatorcontrib><creatorcontrib>Li, Dong</creatorcontrib><creatorcontrib>Shen, Xuyang</creatorcontrib><creatorcontrib>Qiao, Yu</creatorcontrib><creatorcontrib>Zhong, Yiran</creatorcontrib><collection>arXiv Computer Science</collection><collection>arXiv.org</collection></facets><delivery><delcategory>Remote Search Resource</delcategory><fulltext>fulltext_linktorsrc</fulltext></delivery><addata><au>Sun, Weigao</au><au>Qin, Zhen</au><au>Li, Dong</au><au>Shen, Xuyang</au><au>Qiao, Yu</au><au>Zhong, Yiran</au><format>journal</format><genre>article</genre><ristype>JOUR</ristype><atitle>Linear Attention Sequence Parallelism</atitle><date>2024-04-03</date><risdate>2024</risdate><abstract>Sequence Parallel (SP) serves as a prevalent strategy to handle long sequences that exceed the memory limit of a single GPU. However, existing SP methods do not take advantage of linear attention features, resulting in sub-optimal parallelism efficiency and usability for linear attention-based language models. In this paper, we introduce Linear Attention Sequence Parallel (LASP), an efficient SP method tailored to linear attention-based language models. Specifically, we design an efficient point-to-point communication mechanism to leverage the right-product kernel trick of linear attention, which sharply decreases the communication overhead of SP. We also enhance the practical efficiency of LASP by performing kernel fusion and intermediate state caching, making the implementation of LASP hardware-friendly on GPU clusters. Furthermore, we meticulously ensure the compatibility of sequence-level LASP with all types of batch-level data parallel methods, which is vital for distributed training on large clusters with long sequences and large batches. We conduct extensive experiments on two linear attention-based models with varying sequence lengths and GPU cluster sizes. LASP scales sequence length up to 4096K using 128 A100 80G GPUs on 1B models, which is 8 times longer than existing SP methods while being significantly faster. The code is available at https://github.com/OpenNLPLab/LASP.</abstract><doi>10.48550/arxiv.2404.02882</doi><oa>free_for_read</oa></addata></record>
fulltext fulltext_linktorsrc
identifier DOI: 10.48550/arxiv.2404.02882
ispartof
issn
language eng
recordid cdi_arxiv_primary_2404_02882
source arXiv.org
subjects Computer Science - Computation and Language
Computer Science - Learning
title Linear Attention Sequence Parallelism
url https://sfx.bib-bvb.de/sfx_tum?ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&ctx_tim=2024-12-22T04%3A52%3A42IST&url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-Article-arxiv_GOX&rft_val_fmt=info:ofi/fmt:kev:mtx:journal&rft.genre=article&rft.atitle=Linear%20Attention%20Sequence%20Parallelism&rft.au=Sun,%20Weigao&rft.date=2024-04-03&rft_id=info:doi/10.48550/arxiv.2404.02882&rft_dat=%3Carxiv_GOX%3E2404_02882%3C/arxiv_GOX%3E%3Curl%3E%3C/url%3E&disable_directlink=true&sfx.directlink=off&sfx.report_link=0&rft_id=info:oai/&rft_id=info:pmid/&rfr_iscdi=true