Het uitbreiden van het contextvenster van grote taalmodelen via positionele interpolatie
Extending Context Window of Large Language Models via Positional Interpolation
June 27, 2023
Auteurs: Shouyuan Chen, Sherman Wong, Liangjian Chen, Yuandong Tian
cs.AI
Samenvatting
We presenteren Position Interpolation (PI), dat de contextvenstergroottes van RoPE-gebaseerde voorgetrainde LLM's, zoals LLaMA-modellen, uitbreidt tot maximaal 32768 met minimale fine-tuning (binnen 1000 stappen), terwijl het sterke empirische resultaten laat zien op verschillende taken die een lange context vereisen, waaronder passkey retrieval, taalmodellering en samenvatting van lange documenten van LLaMA 7B tot 65B. Tegelijkertijd behoudt het door Position Interpolation uitgebreide model relatief goed de kwaliteit op taken binnen het oorspronkelijke contextvenster. Om dit doel te bereiken, schaalt Position Interpolation de invoerpositie-indices lineair omlaag om ze aan te passen aan de oorspronkelijke contextvenstergrootte, in plaats van te extrapoleren buiten de getrainde contextlengte, wat kan leiden tot catastrofaal hoge attentiescores die het self-attention-mechanisme volledig kunnen verpesten. Ons theoretisch onderzoek toont aan dat de bovengrens van interpolatie minstens ∼600 keer kleiner is dan die van extrapolatie, wat verder de stabiliteit ervan aantoont. Modellen die via Position Interpolation zijn uitgebreid, behouden hun oorspronkelijke architectuur en kunnen de meeste bestaande optimalisaties en infrastructuur hergebruiken.
English
We present Position Interpolation (PI) that extends the context window sizes
of RoPE-based pretrained LLMs such as LLaMA models to up to 32768 with minimal
fine-tuning (within 1000 steps), while demonstrating strong empirical results
on various tasks that require long context, including passkey retrieval,
language modeling, and long document summarization from LLaMA 7B to 65B.
Meanwhile, the extended model by Position Interpolation preserve quality
relatively well on tasks within its original context window. To achieve this
goal, Position Interpolation linearly down-scales the input position indices to
match the original context window size, rather than extrapolating beyond the
trained context length which may lead to catastrophically high attention scores
that completely ruin the self-attention mechanism. Our theoretical study shows
that the upper bound of interpolation is at least sim 600 times smaller
than that of extrapolation, further demonstrating its stability. Models
extended via Position Interpolation retain its original architecture and can
reuse most pre-existing optimization and infrastructure.