TokenSwift: Lossless Acceleration of Ultra Long Sequence Generation

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Wu, Tong, Shen, Junzhe, Jia, Zixia, Wang, Yuxuan, Zheng, Zilong
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866908441426001920
author Wu, Tong
Shen, Junzhe
Jia, Zixia
Wang, Yuxuan
Zheng, Zilong
author_facet Wu, Tong
Shen, Junzhe
Jia, Zixia
Wang, Yuxuan
Zheng, Zilong
contents Generating ultra-long sequences with large language models (LLMs) has become increasingly crucial but remains a highly time-intensive task, particularly for sequences up to 100K tokens. While traditional speculative decoding methods exist, simply extending their generation limits fails to accelerate the process and can be detrimental. Through an in-depth analysis, we identify three major challenges hindering efficient generation: frequent model reloading, dynamic key-value (KV) management and repetitive generation. To address these issues, we introduce TOKENSWIFT, a novel framework designed to substantially accelerate the generation process of ultra-long sequences while maintaining the target model's inherent quality. Experimental results demonstrate that TOKENSWIFT achieves over 3 times speedup across models of varying scales (1.5B, 7B, 8B, 14B) and architectures (MHA, GQA). This acceleration translates to hours of time savings for ultra-long sequence generation, establishing TOKENSWIFT as a scalable and effective solution at unprecedented lengths. Code can be found at https://github.com/bigai-nlco/TokenSwift.
format Preprint
id arxiv_https___arxiv_org_abs_2502_18890
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle TokenSwift: Lossless Acceleration of Ultra Long Sequence Generation
Wu, Tong
Shen, Junzhe
Jia, Zixia
Wang, Yuxuan
Zheng, Zilong
Computation and Language
Generating ultra-long sequences with large language models (LLMs) has become increasingly crucial but remains a highly time-intensive task, particularly for sequences up to 100K tokens. While traditional speculative decoding methods exist, simply extending their generation limits fails to accelerate the process and can be detrimental. Through an in-depth analysis, we identify three major challenges hindering efficient generation: frequent model reloading, dynamic key-value (KV) management and repetitive generation. To address these issues, we introduce TOKENSWIFT, a novel framework designed to substantially accelerate the generation process of ultra-long sequences while maintaining the target model's inherent quality. Experimental results demonstrate that TOKENSWIFT achieves over 3 times speedup across models of varying scales (1.5B, 7B, 8B, 14B) and architectures (MHA, GQA). This acceleration translates to hours of time savings for ultra-long sequence generation, establishing TOKENSWIFT as a scalable and effective solution at unprecedented lengths. Code can be found at https://github.com/bigai-nlco/TokenSwift.
title TokenSwift: Lossless Acceleration of Ultra Long Sequence Generation
topic Computation and Language
url https://arxiv.org/abs/2502.18890