LongRoPE2: Escalado de Ventana de Contexto en LLM con Pérdida Mínima
LongRoPE2: Near-Lossless LLM Context Window Scaling
February 27, 2025
Autores: Ning Shang, Li Lyna Zhang, Siyuan Wang, Gaokai Zhang, Gilsinia Lopez, Fan Yang, Weizhu Chen, Mao Yang
cs.AI
Resumen
LongRoPE2 es un enfoque novedoso que extiende la ventana de contexto efectiva de los modelos de lenguaje preentrenados de gran escala (LLMs) hasta la longitud objetivo, preservando el rendimiento en la ventana de contexto original más corta. Esto se logra mediante tres contribuciones: (1) una hipótesis que sugiere que el entrenamiento insuficiente en dimensiones superiores de RoPE contribuye a los persistentes problemas de fuera de distribución (OOD) observados en métodos existentes; (2) un algoritmo efectivo de reescalado de RoPE que emplea búsqueda evolutiva guiada por perplejidad "impulsada por aguja" para abordar el problema de entrenamiento insuficiente; (3) un enfoque de entrenamiento con ventana de contexto mixto que ajusta los pesos del modelo para adoptar RoPE reescalado en secuencias de contexto largo, manteniendo el rendimiento en contexto corto con el RoPE original. Experimentos exhaustivos en LLaMA3-8B y Phi3-mini-3.8B en diversos benchmarks validan la hipótesis y demuestran la efectividad de LongRoPE2. Notablemente, LongRoPE2 extiende LLaMA3-8B para alcanzar una longitud de contexto efectiva de 128K, conservando más del 98.5% del rendimiento en contexto corto, utilizando solo 10B tokens — 80 veces menos que el enfoque de Meta, que no logra alcanzar la longitud de contexto efectiva objetivo. El código estará disponible en 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