atlas

Research map / Large language models / Instruction and fine-tuning

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

ICLR 2024 · Large language models › Instruction and fine-tuning · approach: Efficient LLM fine-tuning systems · 39 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes LongLoRA, which extends Llama2 context to 32k-100k with shifted sparse attention during fine-tuning plus LoRA with trainable embedding and normalization layers, on a single 8xA100 machine.

Problem

Extending the context window of pre-trained LLMs via fine-tuning is computationally expensive because self-attention cost grows quadratically, and plain LoRA performs poorly for long-context adaptation.

Approach

Shifted sparse attention (S^2-Attn) splits tokens into groups for local attention during training, shifting half the heads by half a group so information flows between groups; standard full attention is kept at inference. Combined with LoRA that also trains embedding and normalization layers, this closes the gap to full fine-tuning.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add S²-Attn instead of short attention without shiftingLlama2-7B long-context fine-tuning · PG19 validation, target context 8192perplexity: 8.29 -> 8.04Helped
Train normalization and embedding layers alongside LoRA rank 8 (ablation)Llama2-7B · PG19 validation, context 32768perplexity: 11.44 -> 8.12Helped
Train normalization layers alongside LoRA rank 8 (ablation)Llama2-7B · PG19 validation, context 32768perplexity: 11.44 -> 10.49Helped
Train embedding layers alongside LoRA rank 8 (ablation)Llama2-7B · PG19 validation, context 32768perplexity: 11.44 -> 8.29Helped
Increase LoRA rank from 8 to 256 while keeping embeddings and normalization frozen (ablation)Llama2-7B · PG19 validation, context 32768perplexity: 11.44 -> 11.98Hurt
Reverse the S²-Attn shifting direction (ablation)Llama2-7B fine-tuned with S²-Attn · PG19 validation, context 8192perplexity: 8.04 -> 8.04No clear effect
Put shifted tokens in individual groups (ablation)Llama2-7B fine-tuned with S²-Attn · PG19 validation, context 8192perplexity: 8.04 -> 8.03No clear effect
Swap shifted tokens with original front tokens (ablation)Llama2-7B fine-tuned with S²-Attn · PG19 validation, context 8192perplexity: 8.04 -> 8.05No clear effect
Reduce S²-Attn group size to 1/8 of target context (ablation)Llama2-7B LongLoRA · PG19 validation, context 8192perplexity: 8.04 -> 8.16Hurt
Shift between sequential layers rather than attention heads (ablation)Llama2-7B long-context fine-tuning · PG19 validation, context 32768perplexity: 8.12 -> 9.70Hurt
Use pattern 1 in every attention head instead of mixing patterns (ablation)Llama2-7B long-context fine-tuning · PG19 validation, context 32768perplexity: 8.12 -> 8.39Hurt
Replace S²-Attn with dilated attention (ablation)Llama2-7B long-context fine-tuning · PG19 validation, context 32768perplexity: 8.12 -> 11.78Hurt

Surprising findings

Limitations

Experimental setup

Datasets: RedPajama PG19 proof-pile LongAlpaca-12k LongBench LEval LongChat topic retrieval

Benchmarks: PG19 proof-pile LongChat topic retrieval passkey retrieval LongBench LEval

Metrics: perplexity accuracy win-rate

Baselines: Full fine-tuning LoRA Position Interpolation LongChat-13B LongChat-v1.5-7B Vicuna-v1.5-7B GPT-3.5-Turbo Landmark attention

Builds on: LoRA Position Interpolation Flash-Attention2 Swin Transformer

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy