XL3M: A Training-free Framework for LLM Length Extension Based on Segment-wise Inference
Not on the map. Why?
Abstract (arXiv)
Length generalization failure problem, namely the large language model (LLM) fails to generalize to texts longer than its maximum training length, greatly restricts the application of LLM in the scenarios with streaming long inputs. To address this problem, the existing methods either require substantial costs or introduce precision loss. In this paper, we empirically find that the accuracy of the LLM's prediction is highly correlated to its certainty. Based on this, we propose an efficient training free framework, named XL3M (it means extra-long large language model), which enables the LLMs trained on short sequences to reason extremely long sequence without any further training or fine-tuning. Under the XL3M framework, the input context will be firstly decomposed into multiple short sub-contexts, where each sub-context contains an independent segment and a common ``question'' which is a few tokens from the end of the original context. Then XL3M gives a method to measure the relevance between each segment and the ``question'', and constructs a concise key context by splicing all the relevant segments in chronological order. The key context is further used instead of the original context to complete the inference task. Evaluations on comprehensive benchmarks show the superiority of XL3M. Using our framework, a Llama2-7B model is able to reason 20M long sequences on an 8-card Huawei Ascend 910B NPU machine with 64GB memory per card.
Key facts. Cited by 8 papers in the map (data through 14 Oct 2026). Builds on 24 of its 27 references that are in the map. First posted on arXiv 28 May 2024.
Builds on
24 of 27 references.
References · 24
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
- 2023A Survey of Large Language Modelscited by 2,576
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
- 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,984
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,417
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 740
- 2023A Comprehensive Overview of Large Language Modelscited by 648
12 more
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 601
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
- 2023Effective Long-Context Scaling of Foundation Modelscited by 303
- 2023Challenges and Applications of Large Language Modelscited by 254
- 2022Memorizing Transformerscited by 226
- 2022Exploring Length Generalization in Large Language Modelscited by 206
- 2024Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attentioncited by 200
- 2023Focused Transformer: Contrastive Training for Context Scalingcited by 133
- 2023Unlimiformer: Long-Range Transformers with Unlimited Length Inputcited by 128
- 2022Parallel Context Windows for Large Language Modelscited by 81
- 2023Giraffe: Adventures in Expanding Context Lengths in LLMscited by 33
- 2023An Overview on Language Models: Recent Developments and Outlookcited by 22
Built on by
Citing papers per year: 2024: 2; 2025: 6.
8 papers.
- 2024BABILong: Testing the Limits of LLMs with Long Context Reasoning-in-a-Haystackcited by 215
- 2025A Survey of Context Engineering for Large Language Modelscited by 126
- 2025A Survey of Token Compression for Efficient Multimodal Large Language Modelscited by 25
- 2024LLM×MapReduce: Simplified Long-Sequence Processing using Large Language Modelscited by 17
- 2025Scaling External Knowledge Input Beyond Context Windows of LLMs via Multi-Agent Collaborationcited by 4
- 2025TreeKV: Smooth Key-Value Cache Compression with Tree Structurescited by 3
- 2025ToM: Leveraging Tree-oriented MapReduce for Long-Context Reasoning in Large Language Modelscited by 1
- 2025CacheFocus: Dynamic Cache Re-Positioning for Efficient Retrieval-Augmented Generationcited by 0
- 2025ToM: Leveraging Tree-oriented MapReduce for Long-Context Reasoning in Large Language Models1 Nov 2025
- 2025A Survey of Token Compression for Efficient Multimodal Large Language Models27 Jul 2025
- 2025A Survey of Context Engineering for Large Language Models17 Jul 2025
- 2025Scaling External Knowledge Input Beyond Context Windows of LLMs via Multi-Agent Collaboration27 May 2025
- 2025CacheFocus: Dynamic Cache Re-Positioning for Efficient Retrieval-Augmented Generation16 Feb 2025
- 2025TreeKV: Smooth Key-Value Cache Compression with Tree Structures9 Jan 2025
- 2024LLM×MapReduce: Simplified Long-Sequence Processing using Large Language Models12 Oct 2024
- 2024BABILong: Testing the Limits of LLMs with Long Context Reasoning-in-a-Haystack14 Jun 2024