4K에서 400K로의 도약: 활성화 비콘을 활용한 LLM의 컨텍스트 확장
Soaring from 4K to 400K: Extending LLM's Context with Activation Beacon
January 7, 2024
저자: Peitian Zhang, Zheng Liu, Shitao Xiao, Ninglu Shao, Qiwei Ye, Zhicheng Dou
cs.AI
초록
긴 문맥의 활용은 대형 언어 모델(LLM)의 제한된 문맥 창 길이로 인해 큰 도전 과제로 여겨진다. 문맥 창은 미세 조정을 통해 확장할 수 있지만, 이는 학습 및 추론 시간에 상당한 비용을 초래하며 LLM의 원래 능력에 부정적인 영향을 미칠 수 있다. 본 연구에서는 Activation Beacon을 제안한다. 이는 LLM의 원시 활성화를 더욱 간결한 형태로 압축하여 제한된 문맥 창 내에서 훨씬 더 긴 문맥을 인지할 수 있도록 한다. Activation Beacon은 LLM에 플러그 앤 플레이 모듈로 도입된다. 이는 짧은 문맥에 대한 LLM의 원래 능력을 완전히 보존하면서 더 긴 문맥을 처리하는 새로운 능력을 확장한다. 또한, 긴 문맥을 처리하기 위해 짧은 슬라이딩 창과 함께 작동하여 학습 및 추론 과정에서 경쟁력 있는 메모리 및 시간 효율성을 달성한다. Activation Beacon은 다양한 압축 비율을 가진 비콘의 혼합을 조건으로 하는 자동 회귀 작업을 통해 학습된다. 이러한 처리 덕분에 단일 8xA800 GPU 머신에서 9시간 미만의 시간을 소비하며 단 10,000 단계만으로 짧은 시퀀스 데이터로 효율적으로 학습할 수 있다. 실험 연구는 Activation Beacon이 Llama-2-7B의 문맥 길이를 100배(4K에서 400K로) 확장할 수 있음을 보여주며, 긴 문맥 생성 및 이해 작업 모두에서 우수한 결과를 달성한다. 우리의 모델과 코드는 BGE 저장소에서 이용 가능할 예정이다.
English
The utilization of long contexts poses a big challenge for large language
models due to their limited context window length. Although the context window
can be extended through fine-tuning, it will result in a considerable cost at
both training and inference time, and exert an unfavorable impact to the LLM's
original capabilities. In this work, we propose Activation Beacon, which
condenses LLM's raw activations into more compact forms such that it can
perceive a much longer context with a limited context window. Activation Beacon
is introduced as a plug-and-play module for the LLM. It fully preserves the
LLM's original capability on short contexts while extending the new capability
on processing longer contexts. Besides, it works with short sliding windows to
process the long context, which achieves a competitive memory and time
efficiency in both training and inference. Activation Beacon is learned by the
auto-regression task conditioned on a mixture of beacons with diversified
condensing ratios. Thanks to such a treatment, it can be efficiently trained
purely with short-sequence data in just 10K steps, which consumes less than 9
hours on a single 8xA800 GPU machine. The experimental studies show that
Activation Beacon is able to extend Llama-2-7B's context length by times100
times (from 4K to 400K), meanwhile achieving a superior result on both
long-context generation and understanding tasks. Our model and code will be
available at the BGE repository.