LongRoPE2 : Mise à l'échelle quasi sans perte de la fenêtre contextuelle des modèles de langage
LongRoPE2: Near-Lossless LLM Context Window Scaling
February 27, 2025
Auteurs: Ning Shang, Li Lyna Zhang, Siyuan Wang, Gaokai Zhang, Gilsinia Lopez, Fan Yang, Weizhu Chen, Mao Yang
cs.AI
Résumé
LongRoPE2 est une approche novatrice qui étend la fenêtre de contexte effective des grands modèles de langage (LLMs) pré-entraînés à la longueur cible, tout en préservant les performances sur la fenêtre de contexte originale plus courte. Cela est réalisé grâce à trois contributions : (1) une hypothèse selon laquelle un entraînement insuffisant dans les dimensions supérieures de RoPE contribue aux problèmes persistants de hors-distribution (OOD) observés dans les méthodes existantes ; (2) un algorithme efficace de redimensionnement de RoPE qui adopte une recherche évolutive guidée par la perplexité "needle-driven" pour résoudre le problème d'entraînement insuffisant ; (3) une approche d'entraînement à fenêtre de contexte mixte qui affine les poids du modèle pour adopter RoPE redimensionné pour les séquences à contexte long tout en préservant les performances à contexte court avec RoPE original. Des expériences approfondies sur LLaMA3-8B et Phi3-mini-3.8B à travers divers benchmarks valident l'hypothèse et démontrent l'efficacité de LongRoPE2. Remarquablement, LongRoPE2 étend LLaMA3-8B pour atteindre une longueur de contexte effective de 128K tout en conservant plus de 98,5 % des performances à contexte court, en utilisant seulement 10B tokens -- 80 fois moins que l'approche de Meta, qui ne parvient pas à atteindre la longueur de contexte effective cible. Le code sera disponible à l'adresse 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