Longformer: The Long-Document Transformer
Open accessAbstract
Transformer-based models are unable to process long sequences due to their self-attention operation, which scales quadratically with the sequence length. To address this limitation, we introduce the Longformer with an attention mechanism that scales linearly with sequence length, making it easy to process documents of thousands of tokens or longer. Longformer's attention mechanism is a drop-in replacement for the standard self-attention and combines a local windowed attention with a task motivated global attention. Following prior work on long-sequence transformers, we evaluate Longformer on character-level language modeling and achieve state-of-the-art results on text8 and enwik8. In contrast to most prior work, we also pretrain Longformer and finetune it on a variety of downstream tasks. Our pretrained Longformer consistently outperforms RoBERTa on long document tasks and sets new state-of-the-art results on WikiHop and TriviaQA. We finally introduce the Longformer-Encoder-Decoder (LED), a Longformer variant for supporting long document generative sequence-to-sequence tasks, and demonstrate its effectiveness on the arXiv summarization dataset.
The claims and statistics of this paper haven’t been checked yet.
Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.
Integrity signals
Registry
Cites
Statistics
Claims the paper makes
The claims and statistics of this paper haven’t been checked yet.
Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.
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?
Local-window memory approaches (Alibi position encoding, sliding-window attention) also struggle on the multi-unrelated-documents question-answering task for the same reason.
“Similarly, local-window memory approaches, such as Alibi position encoding Press et al. [2021] and sliding-window attention Beltagy et al. [2020], also struggle for the same reason.”
From Memory Mosaics at scale (2025) · cites this paper as Beltagy et al., 2020
Section 3.1 (pp. 3–4) identifies sliding-window attention as a Longformer mechanism and says windowed attention alone is not flexible enough for task-specific representations, motivating global attention. The paper does not report that sliding-window attention struggles on the specific multi-unrelated-documents question-answering task or establish the cited sentence’s “same reason.” (LLM, conf=0.84)
Experimental — accuracy not yet measuredFive principal strategies have emerged to bridge the memory gap: in-context windowing, external key-value store, graph-based episodic memory, compression-based summarisation, and web-augmented memory.
“Five principal strategies have emerged to bridge this gap:”
From AgentMemBench: A Systematic Benchmark for Evaluating Long-Term Memory Management Strategies in Conversational AI Agents (2026) · cites this paper as [5]
Section 3.1 (p. 3) describes sliding-window attention, and Related Work (p. 3) mentions document retrieval as an approach to long-document tasks. But the paper does not present five principal memory strategies or describe external key-value stores, graph-based episodic memory, compression-based summarisation, and web-augmented memory as such a framework. (LLM, conf=0.85)
Experimental — accuracy not yet measuredSparse-attention and positional bias studies prove that models struggle to maintain strict instruction salience across multi-turn conversational updates.
“sparse-attention (Longformer, BigBird) [10, 11] and positional bias studies (ALiBi) [12] prove that while models can physically process long sequences, they struggle to maintain strict instruction salience across multi-turn conversational updates.”
From HierMem: Context Curation Over Context Scaling — Hierarchical Memory with Invariant Constraint Placement for Long-Horizon LLM Conversations (2026) · cites this paper as [10]
The Introduction (p. 2) describes Longformer as using sparse attention to process long sequences. The Attention Pattern section (p. 4) discusses local and global attention for document tasks, but does not test multi-turn conversation or show that models fail to maintain instruction salience. The claimed proof of that failure is unsupported by this source. (LLM, conf=0.88)
Experimental — accuracy not yet measuredLanguage models often exhibit a localized focus within their attention mechanisms, giving priority to nearby words and resulting in a notable deficit in context attention.
“However, as demonstrated in prior studies [19, 189, 307], language models often exhibit a localized focus within their attention mechanisms, giving priority to nearby words and resulting in a notable deficit in context attention [275].”
From A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questions (2025) · cites this paper as [19]
The Introduction (pp. 1–2) describes local-context attention and says that splitting long documents into shorter sequences can lose important cross-partition information. It does not demonstrate that language models often give nearby words priority in their attention, or that such a preference causes a general deficit in contextual attention; its stated limitation concerns processing long sequences. (LLM, conf=0.82)
Experimental — accuracy not yet measuredThe Longformer-based label prediction model's performance was not competitive with the pipeline setup, likely because the label predictor struggles to identify relevant information when given full abstracts.
“We experimented with a label prediction model which encodes entire abstracts via the Longformer (Beltagy et al., 2020), and makes predictions using the document-level CLS token. Performance was not competitive with our pipeline setup, likely because the label predictor struggles to identify relevant information when given full abstracts.”
From Fact or Fiction: Verifying Scientific Claims (2020) · cites this paper as Beltagy et al., 2020
Recent progress in long-context modeling largely targets static inputs and does not address multi-turn interaction with external environments.
“Recent progress in long-context modeling largely targets static inputs ( e.g., long documents) and does not address multi-turn interaction with external environments [6, 19].”
From MEM1: Learning to Synergize Memory and Reasoning for Efficient Long-Horizon Agents (2025) · cites this paper as [6]
LED extends the input length limit to 16,384 tokens.
“which extends the input length limit to 16,384 tokens.”
From MOPRD: A multidisciplinary open peer review dataset (2022) · cites this paper as Beltagy et al., 2020
Special attention mechanisms such as Big Bird, LED, and LongT5 are designed to ease input limits for long-text input.
“special attention mechanisms are designed to ease the input limits for the processing of long-text input. Some examples include Big Bird (Zaheer et al., 2020), Longformer-Encoder-Decoder (LED) (Beltagy et al., 2020), and LongT5 (Guo et al., 2022).”
From MOPRD: A multidisciplinary open peer review dataset (2022) · cites this paper as Beltagy et al., 2020
Directly extending the context length of transformers incurs a quadratic increase in computational time and memory cost due to the transformer architecture's self-attention mechanism.
“Directly extending the context length of transformers incurs a quadratic increase in computational time and memory cost due to the transformer architecture's self-attention mechanism, making the design of new long-context architectures a pressing research challenge (Dai et al., 2019; Kitaev et al., 2020; Beltagy et al., 2020).”
From MemGPT: Towards LLMs as Operating Systems (2023) · cites this paper as Beltagy et al., 2020
The modular KV cache construction in Prompt Cache bears resemblance to locally masked attention.
“The modular KV cache construction in Prompt Cache bears resemblance to the approximations observed in locally masked attention (Beltagy et al., 2020; Tay et al., 2023), which optimizes computations by setting a limited window for attention score calculations rather than spanning its attention across every token in its input sequence.”
From Prompt Cache: Modular Attention Reuse for Low-Latency Inference (2023) · cites this paper as Beltagy et al., 2020
LED overcomes the sentence length limit from BART.
“Because the transcript is long, LED overcomes the sentence length limit from BART.”
From Aci-bench: a Novel Ambient Clinical Intelligence Dataset for Benchmarking Automatic Visit Note Generation (2023) · cites this paper as [26]
Big Bird, Longformer, and LongNet help extend context length for Transformers by switching from full self-attention to sparse self-attention mechanisms with linear complexity.
“Big Bird (Zaheer et al., 2020), Longformer (Beltagy et al., 2020), LongNet (Ding et al., 2023) help extend context length for Transformers by switching from full self-attention to sparse self-attention mechanisms with linear complexity.”
From BABILong: Testing the Limits of LLMs with Long Context Reasoning-in-a-Haystack (2024) · cites this paper as Beltagy et al., 2020
For large sequence lengths N, s is often set to N^{-1/2} or N^{-1} log N, resulting in Θ(N sqrt N) or Θ(N log N) IO complexity.
“For large sequence lengths 𝑁 , 𝑠 is often set to 𝑁 1 2 [11] or 𝑁 1 log 𝑁 [3, 17, 92], resulting in Θ 𝑁 𝑁 or Θ 𝑁 log 𝑁 IO complexity.”
From FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness (2022) · cites this paper as [3]
Section 3.1 (p. 3) gives sliding-window attention a computation complexity of O(n × w) for a fixed window size. Our copy does not say that sparsity s is set to N⁻¹ log N or give a Θ(N log N) IO complexity; a search for those terms found no supporting passage. (LLM, conf=0.73)
Experimental — accuracy not yet measuredWhen encoders learn wrong correlations between different parts of the training data, it could result in erroneous generation that diverges from the input.
“When encoders learn wrong correlations between different parts of the training data, it could result in erroneous generation that diverges from the input [6, 71, 142, 251].”
From Survey of Hallucination in Natural Language Generation (2023) · cites this paper as [6]
The Longformer-Encoder-Decoder section (p. 9) describes an encoder that reads documents and a decoder that generates summaries, but does not discuss erroneous generation caused by learned correlations. Searches for wrong correlations, hallucination, and divergence from the input found no passage in our copy addressing that explanation. (LLM, conf=0.74)
Experimental — accuracy not yet measuredModels augmented with the Focus Attention Mechanism generate more faithful summaries on the BBC extreme summarization task.
“The results on the BBC extreme summarization task show that models augmented with the Focus Attention Mechanism generate more faithful summaries.”
From Survey of Hallucination in Natural Language Generation (2023) · cites this paper as [6]
Section 7 (p. 9) evaluates Longformer-Encoder-Decoder on the arXiv scientific-document summarization dataset and reports ROUGE results. Our copy does not address a Focus Attention Mechanism, the BBC extreme summarization task, or summary faithfulness (searched for those terms). (LLM, conf=0.77)
Experimental — accuracy not yet measuredKosmos-2 strengthens joint modeling of images and language through self-supervised learning, allowing it to handle more complex tasks such as deep reasoning and generation of image and text.
“Kosmos-2 [210] strengthens the joint modeling of images and language through self-supervised learning, allowing it to handle more complex tasks, such as deep reasoning and generation of image and text.”
From Multimodal fusion and vision–language models: A survey for robot vision (2026) · cites this paper as [210]
The Introduction (p. 1) describes Longformer as a model for processing long text sequences, and Related Work (p. 2) discusses long-document transformers. Searches for Kosmos-2, joint image–language modeling, and image-and-text generation found no passage addressing the attributed claim. (LLM, conf=0.77)
Experimental — accuracy not yet measured
Self-check
Percentages, sums and reported differences re-computed from the paper’s own numbers.
The self-check needs the paper’s full text.
The citation lists haven’t been fetched yet
References 53 · Cited by 2,281
Research works printed but not linked: 48
- Joshua Ainslie, Santiago Ontanon, Chris Alberti, Vaclav Cvicek, Zachary Fisher, Philip Pham, Anirudh Ravula, Sumit Sanghai, Qifan Wang, and Li Yang. 2020. ETC: Encoding long and structured inputs in transformers. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP) , pages 268-284, Online. Association for Computational Linguistics.
- Rami Al-Rfou, Dokook Choe, Noah Constant, Mandy Guo, and Llion Jones. 2018. Character-level language modeling with deeper self-attention. In AAAI .
- Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. 2017. Reading wikipedia to answer opendomain questions. In ACL .
- Jifan Chen, Shih-Ting Lin, and Greg Durrett. 2019. Multi-hop question answering via reasoning chains. arXiv preprint , abs/1910.02610. · arXiv
- Tianqi Chen, Thierry Moreau, Ziheng Jiang, Lianmin Zheng, Eddie Yan, Haichen Shen, Meghan Cowan, Leyuan Wang, Yuwei Hu, Luis Ceze, et al. 2018. TVM: An automated end-to-end optimizing compiler for deep learning. In OSDI .
- Tianqi Chen, Bing Xu, Chiyuan Zhang, and Carlos Guestrin. 2016. Training deep nets with sublinear memory cost. arXiv preprint , abs/1604.06174. · arXiv
- Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. 2019. Generating long sequences with sparse transformers. arXiv preprint , abs/1904.10509. · arXiv
- Christopher Clark and Matt Gardner. 2017. Simple and effective multi-paragraph reading comprehension. In ACL .
- Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D. Manning. 2019. What does bert look at? an analysis of bert's attention. arXiv preprint , abs/1906.04341. · arXiv
- Arman Cohan, Franck Dernoncourt, Doo Soon Kim, Trung Bui, Seokhwan Kim, Walter Chang, and Nazli Goharian. 2018. A discourse-aware attention model for abstractive summarization of long documents. In NAACL-HLT 2018 .
- Andrew M Dai and Quoc V Le. 2015. Semi-supervised sequence learning. In NeurIPS .
- Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G. Carbonell, Quoc V. Le, and Ruslan Salakhutdinov. 2019. Transformer-XL: Attentive language models beyond a fixed-length context. In ACL .
- Yuwei Fang, Siqi Sun, Zhe Gan, Rohit Pillai, Shuohang Wang, and Jingjing Liu. 2020. Hierarchical graph network for multi-hop question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP) , pages 8823-8838, Online. Association for Computational Linguistics.
- Adam Fisch, Alon Talmor, Robin Jia, Minjoon Seo, Eunsol Choi, and Danqi Chen. 2019. MRQA 2019 shared task: Evaluating generalization in reading comprehension. In MRQA workshop at EMNLP .
- Alexios Gidiotis and Grigorios Tsoumakas. 2020. A divide-and-conquer approach to the summarization of academic articles. ArXiv , abs/2004.06190. · arXiv
- Michael Glaß, Alfio Massimiliano Gliozzo, Rishav Chakravarti, Anthony Ferritto, Lin Pan, Gaudani Bhargav, Dinesh Garg, and Avirup Sil. 2019. Span selection pre-training for question answering. arXiv preprint , abs/1909.04120. · arXiv
- Dirk Groeneveld, Tushar Khot, Mausam, and Ashish Sabhwaral. 2020. A simple yet strong pipeline for HotpotQA. arXiv preprint , abs/2004.06753. · arXiv
- Ankit Gupta and Jonathan Berant. 2020. Gmat: Global memory augmentation for transformers. ArXiv , abs/2006.03274. · arXiv
- Jeremy Howard and Sebastian Ruder. 2018. Universal language model fine-tuning for text classification. In ACL .
- Mandar Joshi, Omer Levy, Luke Zettlemoyer, and Daniel Weld. 2019. BERT for coreference resolution: Baselines and analysis. In EMNLP-IJCNLP .
- Johannes Kiesel, Maria Mestre, Rishabh Shukla, Emmanuel Vincent, Payam Adineh, David Corney, Benno Stein, and Martin Potthast. 2019. SemEval2019 task 4: Hyperpartisan news detection. In Proceedings of the 13th International Workshop on Semantic Evaluation , pages 829-839, Minneapolis, Minnesota, USA. Association for Computational Linguistics.
- Thomas N Kipf and Max Welling. 2017. Semisupervised classification with graph convolutional networks. ICLR .
- Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. 2020. Reformer: The efficient transformer. In ICLR .
- Olga V. Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. 2019. Revealing the dark secrets of bert. In EMNLP/IJCNLP .
- Kenton Lee, Luheng He, and Luke Zettlemoyer. 2018. Higher-order coreference resolution with coarse-tofine inference. In NAACL .
- Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. 2011. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies , pages 142-150, Portland, Oregon, USA. Association for Computational Linguistics.
- Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. 2019. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of NAACL-HLT 2019: Demonstrations .
- Sameer Pradhan, Alessandro Moschitti, Nianwen Xue, Olga Uryupina, and Yuchen Zhang. 2012. CoNLL2012 shared task: Modeling multilingual unrestricted coreference in OntoNotes. In Joint Conference on EMNLP and CoNLL - Shared Task , pages 1-40, Jeju Island, Korea. Association for Computational Linguistics.
- Jiezhong Qiu, Hao Ma, Omer Levy, Scott Yih, Sinong Wang, and Jie Tang. 2019. Blockwise self-attention for long document understanding. arXiv preprint , abs/1911.02972. · arXiv
- Jack W. Rae, Anna Potapenko, Siddhant M. Jayakumar, and Timothy P. Lillicrap. 2020. Compressive transformers for long-range sequence modelling. In ICLR .
- Aurko Roy, Mohammad Saffar, Ashish Vaswani, and David Grangier. 2020. Efficient content-based sparse attention with routing transformers. arXiv preprint , abs/2003.05997. · arXiv
- Nan Shao, Yiming Cui, Ting Liu, Shijin Wang, and Guoping Hu. 2020. Is graph structure necessary for multi-hop reasoning? arXiv preprint , abs/2004.03096. · arXiv
- Sandeep Subramanian, Raymond Li, Jonathan Pilault, and C. Pal. 2020. On extractive and abstractive neural document summarization with transformer language models. In EMNLP .
- Sainbayar Sukhbaatar, Edouard Grave, Piotr Bojanowski, and Armand Joulin. 2019. Adaptive attention span in transformers. In ACL .
- Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. 2014. Sequence to sequence learning with neural networks. In NIPS .
- Trieu H. Trinh and Quoc V. Le. 2018. A simple method for commonsense reasoning. arXiv preprint , abs/1806.02847. · arXiv
- Ming Tu, Jinke Huang, Xiaodong He, and Bowen Zhou. 2020. Graph sequential network for reasoning over sequences. In NeurIPS Graph Representation Learning workshop .
- Ming Tu, Kevin Huang, Guangtao Wang, Jing Huang, Xiaodong He, and Bufang Zhou. 2019. Select, answer and explain: Interpretable multi-hop reading comprehension over multiple documents. arXiv preprint , abs/1911.00484. · arXiv
- Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NIPS .
- Johannes Welbl, Pontus Stenetorp, and Sebastian Riedel. 2018. Constructing datasets for multi-hop reading comprehension across documents. TACL , 6:287-302.
- Felix Wu, Angela Fan, Alexei Baevski, Yann Dauphin, and Michael Auli. 2019. Pay less attention with lightweight and dynamic convolutions. arXiv preprint , abs/1901.10430. · arXiv
- Qizhe Xie, Zihang Dai, Eduard H. Hovy, Minh-Thang Luong, and Quoc V. Le. 2019. Unsupervised data augmentation for consistency training. arXiv preprint , abs/1904.12848. · arXiv
- Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shu xin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Li-Wei Wang, and Tie-Yan Liu. 2020. On layer normalization in the transformer architecture. arXiv preprint , abs/2002.04745. · arXiv
- Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William W. Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. 2018. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In EMNLP .
- Zihao Ye, Qipeng Guo, Quan Gan, Xipeng Qiu, and Zheng Zhang. 2019. BP-Transformer: Modelling long-range context via binary partitioning. arXiv preprint , abs/1911.04070. · arXiv
- Manzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie, C. Alberti, S. Onta˜ n´ on, Philip Pham, Anirudh Ravula, Qifan Wang, L. Yang, and A. Ahmed. 2020. Big bird: Transformers for longer sequences. ArXiv , abs/2007.14062. · arXiv
- Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, and Yejin Choi. 2019. Defending against neural fake news. In NeurIPS .
- Jingqing Zhang, Yao Zhao, Mohammad Saleh, and Peter J Liu. 2020. Pegasus: Pre-training with extracted gap-sentences for abstractive summarization. ICML .
- Authors
- Beltagy, I., Peters, M. E., & Cohan, A.
- Affiliations
- Allen Institute for Artificial Intelligence (US)
- Venue
- arXiv
- Publisher
- arXiv
- Published
- 2020
- ISSN
- 2331-8422 (ISSN-L)
- arXiv
- 2004.05150
- OpenAlex
- W3015468748
- Cited by
- 2,281
- References
- 53
- Citations by year
- 2026: 44 · 2025: 226 · 2024: 398 · 2023: 651 · 2022: 428 · 2021: 432 · 2020: 100 · 2019: 1
- Type
- posted content
- Language
- en
- Open access
- green
- arxiv.org
- Locations
- arXiv (Cornell University) (submittedVersion)
- arXiv (Cornell University)
- Topics
- Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
- Physical Sciences › Computer Science › Artificial Intelligence › Natural Language Processing Techniques
- Physical Sciences › Computer Science › Computer Vision and Pattern Recognition › Advanced Neural Network Applications
- Keywords
- long-context language modeling, efficient large language models
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