AI summary · arXiv: 2404.19553v1 · cs.CL

Extending Llama-3's Context Ten-Fold Overnight

Peitian Zhang, Ninglu Shao, Zheng Liu, Shitao Xiao, Hongjin Qian, Qiwei Ye, Zhicheng Dou
Original paper Submitted to arXiv on 30 Apr. 2024 License: CC BY 4.0

How to read this summary? Illustrated guide

The essentials

  • Successfully extended context length of Llama-3-8B-Instruct from 8K to 80K through QLoRA fine-tuning
  • Explored Multi-Detail QA tasks with homogeneous and heterogeneous contexts, as well as Biography Summarization tasks with context lengths between 64K to 80K
  • Training dataset included question-answer pairs from multi-turn conversations and instances from RedPajama and LongAlpaca datasets
  • Model fine-tuned using QLoRA with LoRA rank set to 32 and alpha to 16, achieving remarkable results on downstream long-context tasks
  • Released resources, including model, training data, and code, are publicly available for further research in training long-context LLMs

Key points written by AI: they may contain errors, check them against the paper.

AI-generated keywords: LLMAs

Read further

  • Comprehensive Summary
  • Layman's Summary
  • Blog article
  • Original abstract
, , , , The team successfully extended the context length of Llama-3-8B-Instruct from 8K to 80K through QLoRA fine-tuning, resulting in superior performance across various evaluation tasks. They explored Multi-Detail QA tasks involving homogeneous and heterogeneous contexts, as well as Biography Summarization tasks with context lengths between 64K to 80K. The training dataset included question-answer pairs organized in multi-turn conversations and instances from RedPajama and LongAlpaca datasets. The model was fine-tuned using QLoRA with LoRA rank set to 32 and alpha to 16, achieving remarkable results on downstream long-context tasks. The released resources, including the model, training data, and code, are publicly available for further research in training long-context LLMs. Additionally, the model was evaluated on LongBench and InfiniteBench benchmarks, showcasing consistent outperformance compared to baselines except for code completion tasks. Further improvements may involve mixing more code data during training.

Was this synthesis useful?

Score: -1

Why do we need votes?

Votes are used to determine whether we need to re-run our summarizing tools. If the count reaches -10, our tools can be restarted.

Figures and plots

Ask about a figure by number or use its question button to request visual analysis. Up to two figures and four image panels per question. Values read from plots are approximate; check the original data.

AI assistant instructions?

Tools for this paper

Explain it differently 1 free rewrite left today
Save to a collection Group papers in collections to compare them, chat with them and export them. Continue with Google Create a free account Log in

Advanced tools Premium

For researchers who follow a field closely: citation alerts, journal-club slides, version comparison and Zotero export. Discover Premium

Zotero Zotero guide
Citation alerts 27 papers already cite it: be emailed each new one. Citation alerts guide
Who works on it?

Among the 27 papers around this one, the name that comes back most: Wei Ping (2 papers)

6 more people sign several of them. The full map adds their institutions and approaches, from the papers of the last years.

Continue with Google Create a free account: your first map is free
Weekly letter The latest letter of its field, "Artificial intelligence this week" of 30 November 2026: Artificial intelligence this week: What the tests leave out · Receive one by email for free

Papers around this one

See them on a map

Ranked by how close their title and abstract are to this paper’s. Select some to read them together.

Closest papers

  1. Very close
    Effective Long-Context Scaling of Foundation Models
    Wenhan Xiong, Jingyu Liu, Igor Molybog et al. · 2023 · Computation and Language · cited 368 times · AI summary available
    Abstract

    We present a series of long-context LLMs that support effective context windows of up to 32,768 tokens. Our model series are built through continual pretraining from Llama 2 with longer training sequences and on a dataset where long texts are upsampled. We perform extensive evaluation on language modeling, synthetic context probing tasks, and a wide range of research benchmarks. On research benchmarks, our models achieve consistent improvements on most regular tasks and significant improvements on long-context tasks over Llama 2. Notably, with a cost-effective instruction tuning procedure that does not require human-annotated long instruction data, the 70B variant can already surpass gpt-3.5…

  2. Very close
    From 128K to 4M: Efficient Training of Ultra-Long Context Large Language Models
    Che-Jian Xu, Wei Ping, Peng Xu et al. · 2025 · Annual Meeting of the Association for Computational Linguistics · cited 20 times · Not summarized yet
    Abstract

    Long-context capabilities are essential for a wide range of applications, including document and video understanding, in-context learning, and inference-time scaling, all of which require models to process and reason over long sequences of text and multimodal data. In this work, we introduce a efficient training recipe for building ultra-long context LLMs from aligned instruct model, pushing the boundaries of context lengths from 128K to 1M, 2M, and 4M tokens. Our approach leverages efficient continued pretraining strategies to extend the context window and employs effective instruction tuning to maintain the instruction-following and reasoning abilities. Our UltraLong-8B, built on Llama3.1-…

  3. Very close Cited by this paper
    Soaring from 4K to 400K: Extending LLM's Context with Activation Beacon
    Peitian Zhang, Zheng Liu, Shitao Xiao et al. · 2024 · Computation and Language · cited 123 times · AI summary available
    Abstract

    The utilization of long contexts poses a big challenge for large language models due to their limited context window length. Although the context window can be extended through fine-tuning, it will result in a considerable cost at both training and inference time, and exert an unfavorable impact to the LLM's original capabilities. In this work, we propose Activation Beacon, which condenses LLM's raw activations into more compact forms such that it can perceive a much longer context with a limited context window. Activation Beacon is introduced as a plug-and-play module for the LLM. It fully preserves the LLM's original capability on short contexts while extending the new capability on proces…

  4. Very close
    LongQLoRA: Efficient and Effective Method to Extend Context Length of Large Language Models
    Jianxin Yang · 2023 · arXiv.org · preprint, not peer reviewed · cited 11 times · Not summarized yet
    Abstract

    We present LongQLoRA, an efficient and effective method to extend context length of large language models with less training resources. LongQLoRA combines the advantages of Position Interpolation, QLoRA and Shift Short Attention of LongLoRA. With a single 32GB V100 GPU, LongQLoRA can extend the context length of LLaMA2 7B and 13B from 4096 to 8192 and even to 12k within 1000 finetuning steps. LongQLoRA achieves competitive perplexity performance on PG19 and Proof-pile datasets, our model outperforms LongLoRA and is very close to MPT-7B-8K within the evaluation context length of 8192. We collect and build 39k long instruction data to extend context length of Vicuna-13B from 4096 to 8192 and a…

  5. Very close
    LongLoRA: Efficient Fine-tuning of Long-Context Large Language Models
    Yukang Chen, Shengju Qian, Haotian Tang et al. · 2023 · Computation and Language · cited 310 times · AI summary available
    Abstract

    We present LongLoRA, an efficient fine-tuning approach that extends the context sizes of pre-trained large language models (LLMs), with limited computation cost. Typically, training LLMs with long context sizes is computationally expensive, requiring extensive training hours and GPU resources. For example, training on the context length of 8192 needs 16x computational costs in self-attention layers as that of 2048. In this paper, we speed up the context extension of LLMs in two aspects. On the one hand, although dense global attention is needed during inference, fine-tuning the model can be effectively and efficiently done by sparse local attention. The proposed shift short attention effecti…

  6. Very close
    Training Ultra Long Context Language Model with Fully Pipelined Distributed Transformer
    Jinghan Yao, Sam Adé Jacobs, Masahiro Tanaka et al. · 2024 · Conference on Machine Learning and Systems · cited 14 times · Not summarized yet
    Abstract

    Large Language Models (LLMs) with long context capabilities are integral to complex tasks in natural language processing and computational biology, such as text generation and protein sequence analysis. However, training LLMs directly on extremely long contexts demands considerable GPU resources and increased memory, leading to higher costs and greater complexity. Alternative approaches that introduce long context capabilities via downstream finetuning or adaptations impose significant design limitations. In this paper, we propose Fully Pipelined Distributed Transformer (FPDT) for efficiently training long-context LLMs with extreme hardware efficiency. For GPT and Llama models, we achieve a …

  7. Very close
    InfiniteHiP: Extending Language Model Context Up to 3 Million Tokens on a Single GPU
    Heejun Lee, Geon Park, Jaduk Suh et al. · 2025 · Computation and Language · preprint, not peer reviewed · cited 12 times · AI summary available
    Abstract

    In modern large language models (LLMs), handling very long context lengths presents significant challenges as it causes slower inference speeds and increased memory costs. Additionally, most existing pre-trained LLMs fail to generalize beyond their original training sequence lengths. To enable efficient and practical long-context utilization, we introduce InfiniteHiP, a novel, and practical LLM inference framework that accelerates processing by dynamically eliminating irrelevant context tokens through a modular hierarchical token pruning algorithm. Our method also allows generalization to longer sequences by selectively applying various RoPE adjustment methods according to the internal atten…

  8. Close
    LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuning
    Hongye Jin, Xiaotian Han, Jingfeng Yang et al. · 2024 · Computation and Language · cited 194 times · AI summary available
    Abstract

    This work elicits LLMs' inherent ability to handle long contexts without fine-tuning. The limited length of the training sequence during training may limit the application of Large Language Models (LLMs) on long input sequences for inference. In this work, we argue that existing LLMs themselves have inherent capabilities for handling long contexts. Based on this argument, we suggest extending LLMs' context window by themselves to fully utilize the inherent ability.We propose Self-Extend to stimulate LLMs' long context handling potential. The basic idea is to construct bi-level attention information: the group level and the neighbor level. The two levels are computed by the original model's s…

Prior work it builds on

  1. Close A method it uses
    $\infty$Bench: Extending Long Context Evaluation Beyond 100K Tokens
    Xinrong Zhang, Yingfa Chen, Shengding Hu et al. · 2024 · 2023.12.15ARR · cited 456 times · Not summarized yet
    Abstract

    Processing and reasoning over long contexts is crucial for many practical applications of Large Language Models (LLMs), such as document comprehension and agent construction. Despite recent strides in making LLMs process contexts with more than 100K tokens, there is currently a lack of a standardized benchmark to evaluate this long-context capability. Existing public benchmarks typically focus on contexts around 10K tokens, limiting the assessment and comparison of LLMs in processing longer contexts. In this paper, we propose $\infty$Bench, the first LLM benchmark featuring an average data length surpassing 100K tokens. $\infty$Bench comprises synthetic and realistic tasks spanning diverse d…

  2. Close
    Extending Context Window of Large Language Models via Positional Interpolation
    Shouyuan Chen, Sherman Wong, Liangjian Chen et al. · 2023 · Computation and Language · preprint, not peer reviewed · cited 923 times · AI summary available
    Abstract

    We present Position Interpolation (PI) that extends the context window sizes of RoPE-based pretrained LLMs such as LLaMA models to up to 32768 with minimal fine-tuning (within 1000 steps), while demonstrating strong empirical results on various tasks that require long context, including passkey retrieval, language modeling, and long document summarization from LLaMA 7B to 65B. Meanwhile, the extended model by Position Interpolation preserve quality relatively well on tasks within its original context window. To achieve this goal, Position Interpolation linearly down-scales the input position indices to match the original context window size, rather than extrapolating beyond the trained conte…

  3. Close
    Data Engineering for Scaling Language Models to 128K Context
    Yao Fu, Rameswar Panda, Xinyao Niu et al. · 2024 · International Conference on Machine Learning · cited 243 times · Not summarized yet
    Abstract

    We study the continual pretraining recipe for scaling language models' context lengths to 128K, with a focus on data engineering. We hypothesize that long context modeling, in particular \textit{the ability to utilize information at arbitrary input locations}, is a capability that is mostly already acquired through large-scale pretraining, and that this capability can be readily extended to contexts substantially longer than seen during training~(e.g., 4K to 128K) through lightweight continual pretraining on appropriate data mixture. We investigate the \textit{quantity} and \textit{quality} of the data for continual pretraining: (1) for quantity, we show that 500 million to 5 billion tokens …

  4. Related A method it uses
    Measuring Massive Multitask Language Understanding
    Dan Hendrycks, Collin Burns, Steven Basart et al. · 2020 · International Conference on Learning Representations · cited 10,378 times · AI summary available
    Abstract

    We propose a new test to measure a text model's multitask accuracy. The test covers 57 tasks including elementary mathematics, US history, computer science, law, and more. To attain high accuracy on this test, models must possess extensive world knowledge and problem solving ability. We find that while most recent models have near random-chance accuracy, the very largest GPT-3 model improves over random chance by almost 20 percentage points on average. However, on every one of the 57 tasks, the best models still need substantial improvements before they can reach expert-level accuracy. Models also have lopsided performance and frequently do not know when they are wrong. Worse, they still hav…

Papers that cite it

  1. Close
    Two are better than one: Context window extension with multi-grained self-injection
    Wei Han, Pan Zhou, Soujanya Poria et al. · 2024 · arXiv.org · preprint, not peer reviewed · cited 2 times · Not summarized yet
    Abstract

    The limited context window of contemporary large language models (LLMs) remains a huge barrier to their broader application across various domains. While continual pre-training on long-context data is a straightforward and effective solution, it incurs substantial costs in terms of data acquisition and computational resources. To alleviate this issue, we propose SharedLLM, a novel approach grounded in the design philosophy of multi-grained context compression and query-aware information retrieval. SharedLLM is composed of two short-context LLMs such as LLaMA-2, termed upper model and lower model. The lower model functions as a compressor while the upper model acts as a decoder. The upper mod…

  2. Close
    Flora: Effortless Context Construction to Arbitrary Length and Scale
    Tian-Xiang Chen, Zhentao Tan, Xiaofan Bo et al. · 2025 · AAAI Conference on Artificial Intelligence · cited 2 times · Not summarized yet
    Abstract

    Effectively handling long contexts is challenging for Large Language Models (LLMs) due to the rarity of long texts, high computational demands, and substantial forgetting of short-context abilities. Recent approaches have attempted to construct long contexts for instruction tuning, but these methods often require LLMs or human interventions, which are both costly and limited in length and diversity. Also, the drop in short-context performances of present long-context LLMs remains significant. In this paper, we introduce Flora, an effortless (human/LLM-free) long-context construction strategy. Flora can markedly enhance the long-context performance of LLMs by arbitrarily assembling short inst…

  3. Close
    Pretraining Context Compressor for Large Language Models with Embedding-Based Memory
    Yu-Hong Dai, Jian-Xun Lian, Yitian Huang et al. · 2025 · Annual Meeting of the Association for Computational Linguistics · cited 34 times · Not summarized yet
    Abstract

    Efficient processing of long contexts in large language models (LLMs) is essential for real-world applications like retrieval-augmented generation and in-context learning, especially in resource-constrained environments such as edge computing. This paper explores the embedding-based context compression to reduce inference costs while preserving the down-stream LLM configurations. We propose a decoupled compressor-LLM framework, pre-trained on text reconstruction and completion tasks, designed to effectively preserve essential contextual information within condensed embedding representations. Our extensive experiments investigate pretraining, model configurations, compression rates, efficienc…

  4. Close
    Stacked from One: Multi-Scale Self-Injection for Context Window Extension
    Wei Han, Pan Zhou, Soujanya Poria et al. · 2026 · International Conference on Learning Representations · Not summarized yet
    Abstract

    The limited context window of contemporary large language models (LLMs) remains a primary bottleneck for their broader application across diverse domains. Although continual pre-training on long-context data offers a straightforward solution, it incurs prohibitive data acquisition and computational costs. To address this challenge, we propose~\modelname, a novel framework based on multi-grained context compression and query-aware information acquisition. SharedLLM comprises two stacked short-context LLMs: a lower model serving as a compressor and an upper model acting as a decoder. The lower model compresses long inputs into compact, multi-grained representations, which are then forwarded to…

  5. Close
    MemoRAG: Boosting Long Context Processing with Global Memory-Enhanced Retrieval Augmentation
    Hong-Jin Qian, Zheng Liu, Peitian Zhang et al. · 2024 · The Web Conference · cited 172 times · AI summary available
    Abstract

    Processing long contexts presents a significant challenge for large language models (LLMs). While recent advancements allow LLMs to handle much longer contexts than before (e.g., 32K or 128K tokens), it is computationally expensive and can still be insufficient for many applications. Retrieval-Augmented Generation (RAG) is considered a promising strategy to address this problem. However, conventional RAG methods face inherent limitations because of two underlying requirements: 1) explicitly stated queries, and 2) well-structured knowledge. These conditions, however, do not hold in general long-context processing tasks. In this work, we propose MemoRAG, a novel RAG framework empowered by glob…

How are these papers found?

We compare the title and abstract of this paper with those of every paper summarized on this site, and with the papers Semantic Scholar recommends, those it cites and those citing it (for a much-cited paper, its most recent citations and, from OpenAlex, the most cited ones). Among the prior work and the follow-ups, the papers that use each other in depth, a method it uses and the much-cited follow-ups come a little higher. The levels (very close, close, related) come from the similarity of the texts, not from a judgment of quality; * marks a paper without an abstract, compared by its title. The sentence under a paper is written by an AI from the two abstracts: check it in the papers. A paper marked not relevant by three readers leaves the list.

Updated on 3 November 2026.

The illustrated guide to the papers around a paper

The previous summary was created more than a year ago and can be re-run (if necessary) by clicking on the Run button below.

Disclaimer: The AI-based summarization tool and virtual assistant provided on this website may not always provide accurate and complete summaries or responses. We encourage you to carefully review and evaluate the generated content to ensure its quality and relevance to your needs.