Attention Is All You Need
Ashish Vaswani, Noam Shazeer et al.
0
Citations
0
Influential Citations
—
Venue
2024
Year
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 …
Long-context capabilities are critical for many real-world LLM applications, such as processing entire documents, codebases, or long conversations. However, standard LLMs are typically trained on sequences of 2k-4k tokens due to the quadratic cost of full self-attention. Fine-tuning these models to handle longer contexts (e.g., 32k or 100k tokens) is prohibitively expensive for most researchers and practitioners. LongLoRA addresses this bottleneck by providing an efficient fine-tuning method that extends context length with minimal additional compute, democratizing access to long-context LLMs.
This paper is particularly timely as the community seeks practical ways to adapt pre-trained models without full retraining. By building on LoRA, a popular parameter-efficient fine-tuning technique, LongLoRA lowers the barrier for customizing LLMs to specific long-context tasks. The work also highlights a key insight: naive LoRA fine-tuning fails for long-context adaptation, necessitating architectural modifications like the proposed shift-short attention.
LongLoRA was evaluated on LLaMA and LLaMA2 models (7B, 13B, 70B parameters) extended to 32k and 100k context lengths. Key results:
LongLoRA provides a practical recipe for extending LLM context windows without massive computational resources. This enables researchers and small teams to fine-tune models for tasks like legal document analysis, scientific paper review, or long-form code generation. The work also underscores the importance of architectural innovations (S2-Attn) in conjunction with parameter-efficient fine-tuning. Future work could explore combining LongLoRA with other attention approximations (e.g., FlashAttention) or extending to even longer contexts. The approach is model-agnostic and has been adopted in several open-source projects, indicating its immediate impact on the AI community.
Ashish Vaswani, Noam Shazeer et al.
Jakubův, Jan, Chvalovský, Karel et al.
Pauli Virtanen, Ralf Gommers et al.
Tom B. Brown, Benjamin Mann et al.