SWAN-GPT: An Efficient and Scalable Approach for Long-Context Language Modeling

Krishna C. Puvvada, Faisal Ladhak, Santiago Akle Serrano, Cheng-Ping Hsieh, Shantanu Acharya +6 more
4/11/2025
cs.CL

No confident code implementation found for this paper.

Abstract

We present a decoder-only Transformer architecture that robustly generalizes to sequence lengths substantially longer than those seen during training. Our model, SWAN-GPT, interleaves layers without positional encodings (NoPE) and sliding-window attention layers equipped with rotary positional encodings (SWA-RoPE). Experiments demonstrate strong performance on sequence lengths significantly longer than the training length without the need for additional long-context training. This robust length extrapolation is achieved through our novel architecture, enhanced by a straightforward dynamic scaling of attention scores during inference. In addition, SWAN-GPT is more computationally efficient than standard GPT architectures, resulting in cheaper training and higher throughput. Further, we demonstrate that existing pre-trained decoder-only models can be efficiently converted to the SWAN architecture with minimal continued training, enabling longer contexts. Overall, our work presents an effective approach for scaling language models to longer contexts in a robust and efficient manner.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{puvvada2025swangpt,
  title  = {SWAN-GPT: An Efficient and Scalable Approach for Long-Context Language Modeling},
  author = {Krishna C. Puvvada and Faisal Ladhak and Santiago Akle Serrano and Cheng-Ping Hsieh and Shantanu Acharya and Somshubra Majumdar and Fei Jia and Samuel Kriman and Simeng Sun and Dima Rekesh and Boris Ginsburg},
  year   = {2025},
  eprint = {2504.08719},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2504.08719v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2504.08719.svg)](https://codeofpaper.com/paper/2504.08719)

Discussion