LongLoRA: Efficient Fine-tuning of Long-Context Large Language Models

AI-generated keywords: LongLoRA Context Extension Sparse Local Attention Parameter-Efficient Regime LongQA

AI-generated Key Points

The license of the paper does not allow us to build upon its content and the key points are generated using the paper metadata rather than the full article.

  • LongLoRA is an efficient fine-tuning approach for extending the context sizes of pre-trained large language models (LLMs) with limited computation cost.
  • Training LLMs with long context sizes is computationally expensive and requires extensive training hours and GPU resources.
  • LongLoRA proposes two aspects to speed up the context extension of LLMs:
  • Fine-tuning the model can be effectively and efficiently done by sparse local attention, resulting in significant computation savings with similar performance to fine-tuning with vanilla attention.
  • The parameter-efficient fine-tuning regime for context expansion works well under the premise of trainable embedding and normalization.
  • LongLoRA demonstrates strong empirical results on various tasks using LLaMA2 models from 7B/13B to 70B, while retaining their original architectures and being compatible with most existing techniques like FlashAttention-2.
  • To make LongLoRA practical, the authors provide a dataset called LongQA for supervised fine-tuning, which contains more than 3k long-context question-answer pairs.
  • The authors provide code, models, dataset, and a demo for LongLoRA on GitHub at https://github.com/dvlab-research/LongLoRA.
Also access our AI generated: Comprehensive summary, Lay summary, Blog-like article; or ask questions about this paper to our AI assistant.

Authors: Yukang Chen, Shengju Qian, Haotian Tang, Xin Lai, Zhijian Liu, Song Han, Jiaya Jia

Code, models, dataset, and demo are available at https://github.com/dvlab-research/LongLoRA

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 effectively enables context extension, leading to non-trivial computation saving with similar performance to fine-tuning with vanilla attention. Particularly, it can be implemented with only two lines of code in training, while being optional in inference. On the other hand, we revisit the parameter-efficient fine-tuning regime for context expansion. Notably, we find that LoRA for context extension works well under the premise of trainable embedding and normalization. LongLoRA demonstrates strong empirical results on various tasks on LLaMA2 models from 7B/13B to 70B. LongLoRA adopts LLaMA2 7B from 4k context to 100k, or LLaMA2 70B to 32k on a single 8x A100 machine. LongLoRA extends models' context while retaining their original architectures, and is compatible with most existing techniques, like FlashAttention-2. In addition, to make LongLoRA practical, we collect a dataset, LongQA, for supervised fine-tuning. It contains more than 3k long context question-answer pairs.

Submitted to arXiv on 21 Sep. 2023

Ask questions about this paper to our AI assistant

You can also chat with multiple papers at once here.

The license of the paper does not allow us to build upon its content and the AI assistant only knows about the paper metadata rather than the full article.

AI assistant instructions?

Results of the summarizing process for the arXiv paper: 2309.12307v1

This paper's license doesn't allow us to build upon its content and the summarizing process is here made with the paper's metadata rather than the article.

LongLoRA is an efficient fine-tuning approach that extends the context sizes of pre-trained large language models (LLMs) with limited computation cost. Training LLMs with long context sizes is typically computationally expensive and requires extensive training hours and GPU resources. For example, training on a context length of 8192 needs 16x computational costs in self-attention layers compared to that of 2048. This paper proposes two aspects to speed up the context extension of LLMs. Firstly, while 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 enables context extension, resulting in significant computation savings with similar performance to fine-tuning with vanilla attention. This approach can be implemented with just two lines of code in training and is optional in inference. Secondly, the paper revisits the parameter-efficient fine-tuning regime for context expansion. It finds that LoRA for context extension works well under the premise of trainable embedding and normalization. LongLoRA demonstrates strong empirical results on various tasks using LLaMA2 models from 7B/13B to 70B. It extends models' context while retaining their original architectures and is compatible with most existing techniques like FlashAttention-2. To make LongLoRA practical, the authors collect a dataset called LongQA for supervised fine-tuning. This dataset contains more than 3k long-context question-answer pairs. The authors provide code, models, dataset, and a demo for LongLoRA on GitHub at https://github.com/dvlab-research/LongLoRA . In summary, LongLoRA presents an efficient approach for extending the context sizes of large language models without significant computational costs. It achieves this through sparse local attention during fine-tuning and parameter-efficient regime for context expansion. The approach demonstrates strong empirical results across various tasks and is compatible with existing techniques. The authors also provide a dataset for supervised fine-tuning to make LongLoRA practical.
Created on 10 Nov. 2023

Assess the quality of the AI-generated content by voting

Score: 0

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.

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

The license of this specific paper does not allow us to build upon its content and the summarizing tools will be run using the paper metadata rather than the full article. However, it still does a good job, and you can also try our tools on papers with more open licenses.

Similar papers summarized with our AI tools

Navigate through even more similar papers through a

tree representation

Look for similar papers (in beta version)

By clicking on the button above, our algorithm will scan all papers in our database to find the closest based on the contents of the full papers and not just on metadata. Please note that it only works for papers that we have generated summaries for and you can rerun it from time to time to get a more accurate result while our database grows.

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.