Skip to main content
QUICK REVIEW

[논문 리뷰] Extending Context Window of Large Language Models via Positional Interpolation

Shouyuan Chen, S.H. Wong|arXiv (Cornell University)|2023. 06. 27.
Topic ModelingComputer Science인용 수 44
한 줄 요약

본 논문은 RoPE 기반 LLM의 컨텍스트 창을 최소한의 미세조정으로 최대 32768 토큰까지 확장하는 Position Interpolation (PI)를 소개하며, 원래 작업의 성능을 유지하고 여러 LLaMA 모델 규모에 걸친 강력한 장문맥 모델링을 가능하게 한다.

ABSTRACT

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 imes$ 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.

연구 동기 및 목표

  • RoPE 기반 LLM들(LLaMA 예시)의 유효 컨텍스트 윈도우를 학습 길이 이상으로 확장한다.
  • 보간 위치 인덱스를 보간하는 것이 외삽이 아니라 안정적인 어텐션과 용이한 적응을 제공한다는 것을 입증한다.
  • 장문맥 언어 모델링, 검색 유사 작업, 장문서 요약에서 실험적 이점을 보여준다.
  • 확장 이후 원래 컨텍스트 윈도우(2048) 내의 성능에 대한 영향Assess

제안 방법

  • Position Interpolation을 사용하여 입력 위치 인덱스를 다운스케일링하여 최대 위치를 프리트레이닝 윈도우와 일치시킨다.
Figure 1: An illustration of our Position Interpolation method. Consider a Llama model pre-trained with a 2048 context window length. Upper left illustrates the normal usage of an LLM model: input position indices (blue dots) are within the pre-trained range. Upper right illustrates length extrapola
Figure 1: An illustration of our Position Interpolation method. Consider a Llama model pre-trained with a 2048 context window length. Upper left illustrates the normal usage of an LLM model: input position indices (blue dots) are within the pre-trained range. Upper right illustrates length extrapola

실험 결과

연구 질문

  • RQ1Position Interpolation이 아키텍처 변경 없이 RoPE-based LLM 컨텍스트 윈도를 32768 토큰과 같은 크기로 확장할 수 있는가?
  • RQ2보간 위치가 어텐션 점수에 대해 직접 외삽보다 더 안정적이고 확장 가능한 확장을 제공하는가?
  • RQ3PI의 실증적 영향은 LLaMA 7B–65B에 걸친 퍼플렉시티, 패스키 검색, 장문서 요약에 어떤가?
  • RQ4PI가 원래 2048 토큰 윈도우 내의 성능에 어떤 영향을 미치는가?
  • RQ5RoPE 어텐션에 대한 보간과 외삽 간 이론적 경계 차이는 무엇인가?

주요 결과

  • PI는 LLaMA 7B–65B 전반에서 최소한의 미세조정(약 1000 스텝)으로 컨텍스트 윈도우를 최대 32768까지 확장할 수 있다.
  • 보간된 어텐션 점수는 더 안정적이며, LLaMA 7B 설정에서 보간 경계가 외삽의 약 600배 더 작다.
  • PI로 확장된 모델은 PG19 및 증명-더미 데이터세트에서 컨텍스트가 긴 경우에도 퍼플렉시티가 개선되나, 직접 파인튜닝은 더 긴 컨텍스트에서 악화된다.
  • PI로 확장된 모델은 2048 토큰의 일부 벤치마크에서만 약간의 저하를 보이며 원래 컨텍스트 성능을 유지한다.
  • 패스키 검색 실험에서 PI는 대략 200 스텝 정도에서 7B와 33B 모델에서 확장된 컨텍스트를 유효 컨텍스트 윈도우로 달성한다.
  • 장문서 요약(GovReport)의 경우 PI-enabled 16K 컨텍스트가 베이스라인과 비교해 경쟁력 있는 ROUGE 점수를 나타낸다.
Figure 2: Extrapolation versus interpolation. Left: a fitted attention score function (in red) in the form of Eqn. 3 with $d=d_{\mathrm{model}}/n_{\mathrm{head}}=4096/32=128$ (setting of LLaMA 7B). Dots are random input points to be fitted and red curve is the fitted score function via least square,
Figure 2: Extrapolation versus interpolation. Left: a fitted attention score function (in red) in the form of Eqn. 3 with $d=d_{\mathrm{model}}/n_{\mathrm{head}}=4096/32=128$ (setting of LLaMA 7B). Dots are random input points to be fitted and red curve is the fitted score function via least square,

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.