Sliding Window Attention Training for Efficient Large Language Models

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Fu, Zichuan, Song, Wentao, Wang, Yejing, Wu, Xian, Zheng, Yefeng, Zhang, Yingying, Xu, Derong, Wei, Xuetao, Xu, Tong, Zhao, Xiangyu
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866912412493414400
author Fu, Zichuan
Song, Wentao
Wang, Yejing
Wu, Xian
Zheng, Yefeng
Zhang, Yingying
Xu, Derong
Wei, Xuetao
Xu, Tong
Zhao, Xiangyu
author_facet Fu, Zichuan
Song, Wentao
Wang, Yejing
Wu, Xian
Zheng, Yefeng
Zhang, Yingying
Xu, Derong
Wei, Xuetao
Xu, Tong
Zhao, Xiangyu
contents Recent advances in transformer-based Large Language Models (LLMs) have demonstrated remarkable capabilities across various tasks. However, their quadratic computational complexity concerning sequence length remains a significant bottleneck for processing long documents. As a result, many efforts like sparse attention and state space models have been proposed to improve the efficiency of LLMs over long sequences. Though effective, these approaches compromise the performance or introduce structural complexity. This calls for a simple yet efficient model that preserves the fundamental Transformer architecture. To this end, we introduce SWAT, which enables efficient long-context handling via Sliding Window Attention Training. This paper first attributes the inefficiency of Transformers to the attention sink phenomenon resulting from the high variance of softmax operation. Then, we replace softmax with the sigmoid function and utilize a balanced ALiBi and Rotary Position Embedding for efficient information compression and retention. Experiments demonstrate that SWAT achieves SOTA performance compared with state-of-the-art linear recurrent architectures on eight benchmarks. Code is available at https://github.com/Fzkuji/swat-attention.
format Preprint
id arxiv_https___arxiv_org_abs_2502_18845
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Sliding Window Attention Training for Efficient Large Language Models
Fu, Zichuan
Song, Wentao
Wang, Yejing
Wu, Xian
Zheng, Yefeng
Zhang, Yingying
Xu, Derong
Wei, Xuetao
Xu, Tong
Zhao, Xiangyu
Computation and Language
Artificial Intelligence
Machine Learning
Recent advances in transformer-based Large Language Models (LLMs) have demonstrated remarkable capabilities across various tasks. However, their quadratic computational complexity concerning sequence length remains a significant bottleneck for processing long documents. As a result, many efforts like sparse attention and state space models have been proposed to improve the efficiency of LLMs over long sequences. Though effective, these approaches compromise the performance or introduce structural complexity. This calls for a simple yet efficient model that preserves the fundamental Transformer architecture. To this end, we introduce SWAT, which enables efficient long-context handling via Sliding Window Attention Training. This paper first attributes the inefficiency of Transformers to the attention sink phenomenon resulting from the high variance of softmax operation. Then, we replace softmax with the sigmoid function and utilize a balanced ALiBi and Rotary Position Embedding for efficient information compression and retention. Experiments demonstrate that SWAT achieves SOTA performance compared with state-of-the-art linear recurrent architectures on eight benchmarks. Code is available at https://github.com/Fzkuji/swat-attention.
title Sliding Window Attention Training for Efficient Large Language Models
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2502.18845