LongRoPE2: Scalatura Quasi Senza Perdite della Finestra di Contesto nei Modelli Linguistici
LongRoPE2: Near-Lossless LLM Context Window Scaling
February 27, 2025
Autori: Ning Shang, Li Lyna Zhang, Siyuan Wang, Gaokai Zhang, Gilsinia Lopez, Fan Yang, Weizhu Chen, Mao Yang
cs.AI
Abstract
LongRoPE2 è un approccio innovativo che estende la finestra di contesto effettiva di modelli linguistici pre-addestrati (LLM) alla lunghezza desiderata, preservando al contempo le prestazioni sulla finestra di contesto originale più breve. Questo risultato è ottenuto attraverso tre contributi principali: (1) un'ipotesi secondo cui un addestramento insufficiente nelle dimensioni superiori di RoPE contribuisce ai persistenti problemi di out-of-distribution (OOD) osservati nei metodi esistenti; (2) un algoritmo efficace di ridimensionamento di RoPE che adotta una ricerca evolutiva guidata dalla perplessità "needle-driven" per affrontare il problema dell'addestramento insufficiente; (3) un approccio di addestramento con finestra di contesto mista che affina i pesi del modello per adottare RoPE ridimensionato per sequenze di contesto lungo, preservando al contempo le prestazioni su contesti brevi con il RoPE originale. Esperimenti estesi su LLaMA3-8B e Phi3-mini-3.8B su vari benchmark convalidano l'ipotesi e dimostrano l'efficacia di LongRoPE2. In modo notevole, LongRoPE2 estende LLaMA3-8B per raggiungere una lunghezza di contesto effettiva di 128K, mantenendo oltre il 98,5% delle prestazioni su contesti brevi, utilizzando solo 10B token — 80 volte in meno rispetto all'approccio di Meta, che non riesce a raggiungere la lunghezza di contesto effettiva desiderata. Il codice sarà disponibile su https://github.com/microsoft/LongRoPE.
English
LongRoPE2 is a novel approach that extends the effective context window of
pre-trained large language models (LLMs) to the target length, while preserving
the performance on the original shorter context window. This is achieved by
three contributions: (1) a hypothesis that insufficient training in higher RoPE
dimensions contributes to the persistent out-of-distribution (OOD) issues
observed in existing methods; (2) an effective RoPE rescaling algorithm that
adopts evolutionary search guided by "needle-driven" perplexity to address the
insufficient training problem; (3) a mixed context window training approach
that fine-tunes model weights to adopt rescaled RoPE for long-context sequences
while preserving the short-context performance with the original RoPE.
Extensive experiments on LLaMA3-8B and Phi3-mini-3.8B across various benchmarks
validate the hypothesis and demonstrate the effectiveness of LongRoPE2.
Remarkably, LongRoPE2 extends LLaMA3-8B to achieve a 128K effective context
length while retaining over 98.5% of short-context performance, using only 10B
tokens -- 80x fewer than Meta's approach, which fails to reach the target
effective context length. Code will be available at
https://github.com/microsoft/LongRoPE.Summary
AI-Generated Summary