atlas

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

YaRN: Efficient Context Window Extension of Large Language Models

ICLR 2024 · Large language models › Instruction and fine-tuning · approach: Efficient LLM fine-tuning systems · 18 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 YaRN, a RoPE interpolation method combining NTK-by-parts frequency interpolation with attention temperature scaling (plus dynamic scaling at inference) to extend LLaMA and Llama 2 context windows to 64k-128k with little fine-tuning.

Problem

RoPE-based LLMs fail to generalize beyond their pretraining context length, and prior extension methods (Position Interpolation, NTK-aware) either degrade quality or need large amounts of fine-tuning compute.

Approach

Per-dimension RoPE interpolation chosen by wavelength-to-context ratio (no interpolation for high-frequency dims, full interpolation for low-frequency dims, ramp in between), combined with a constant attention logit temperature sqrt(1/t)=0.1 ln(s)+1 implemented as a rescaling of rotary embeddings, and optional dynamic scaling at inference.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use YaRN instead of NTK-by-parts (ablation)LLaMA 7B · Proof-pile, 8192 contextperplexity: 3.62 -> 3.30Helped
Use YaRN instead of PI (ablation)LLaMA 7B · Proof-pile, 8192 contextperplexity: 4.64 -> 3.30Helped
Fine-tune with YaRN for 400 steps rather than use no fine-tuning (ablation)LLaMA 7B · Proof-pile, 32768 contextperplexity: 3.45 -> 2.77Helped
Use YaRN instead of PI with 400 fine-tuning steps (ablation)LLaMA 7B · Proof-pile, 8192 contextperplexity: 4.64 -> 3.30Helped
Use YaRN instead of NTK-aware with 400 fine-tuning steps (ablation)LLaMA 7B · Proof-pile, 8192 contextperplexity: 3.73 -> 3.30Helped
Use YaRN with 400 steps rather than PI with 1000 steps (ablation)Llama 2 7B · Proof-pile, 8192 contextperplexity: 3.51 -> 3.50No clear effect
Extend Llama 2 7B to 128k with YaRN rather than 64kLlama 2 7B · Passkey retrievalaccuracy: 96.3% -> 99.4%Helped
Extend Llama 2 13B to 128k with YaRN rather than 64kLlama 2 13B · Passkey retrievalaccuracy: 97.5% -> 99.4%Helped
Extend context with YaRN instead of leaving the model unextendedLlama 2 7B · HellaSwagscore: 77.8 -> 78.8Helped
Extend context with YaRN instead of leaving the model unextendedLlama 2 13B · ARC-Challengescore: 59.4 -> 58.1Hurt
Use YaRN instead of Dynamic-PIpretrained Llama 2 without fine-tuning · GovReport long-range evaluationperplexityHelped
Use YaRN instead of competing interpolation techniques with the same training budgetLLaMA 7B · Passkey retrieval, prompts up to 32kaccuracyHelped

Surprising findings

Limitations

Experimental setup

Datasets: PG19 GovReport Proof-pile RedPajama

Benchmarks: Proof-pile sliding-window perplexity GovReport perplexity passkey retrieval Hugging Face Open LLM Leaderboard (ARC-c, HellaSwag, MMLU, TruthfulQA)

Metrics: perplexity passkey retrieval accuracy accuracy

Baselines: Position Interpolation NTK-aware interpolation NTK-by-parts Code Llama Together.ai Llama-2-7B-32K LLongMA-2 7B

Builds on: RoPE Position Interpolation NTK-aware interpolation Dynamic NTK FlashAttention-2

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