대규모 언어 모델에서 컨텍스트 압축을 위한 인-컨텍스트 오토인코더
In-context Autoencoder for Context Compression in a Large Language Model
July 13, 2023
저자: Tao Ge, Jing Hu, Xun Wang, Si-Qing Chen, Furu Wei
cs.AI
초록
대규모 언어 모델(LLM)에서의 컨텍스트 압축을 위해 In-context Autoencoder(ICAE)를 제안한다. ICAE는 두 가지 모듈로 구성된다: LoRA를 통해 LLM에서 적응된 학습 가능한 인코더는 긴 컨텍스트를 제한된 수의 메모리 슬롯으로 압축하며, 고정된 디코더는 다양한 목적을 위해 메모리 슬롯에 조건을 걸 수 있는 타겟 LLM이다. 먼저, ICAE를 대량의 텍스트 데이터에 대해 자동 인코딩 및 언어 모델링 목표를 사용하여 사전 학습시켜, 원본 컨텍스트를 정확하고 포괄적으로 표현하는 메모리 슬롯을 생성할 수 있도록 한다. 그런 다음, 소량의 지시 데이터에 대해 사전 학습된 ICAE를 미세 조정하여 다양한 프롬프트와의 상호작용을 강화하고 원하는 응답을 생성할 수 있도록 한다. 실험 결과는 제안된 사전 학습 및 미세 조정 패러다임으로 학습된 ICAE가 4배의 컨텍스트 압축을 통해 효과적으로 메모리 슬롯을 생성할 수 있으며, 이를 타겟 LLM이 다양한 프롬프트에 잘 반응할 수 있음을 보여준다. 이러한 유망한 결과는 ICAE가 긴 컨텍스트 문제에 대한 새로운 접근 방식과 LLM 추론에서의 계산 및 메모리 오버헤드를 줄일 수 있는 잠재력을 보여주며, LLM을 위한 컨텍스트 관리에 대한 추가 연구의 필요성을 시사한다. 코드와 데이터는 곧 공개될 예정이다.
English
We propose the In-context Autoencoder (ICAE) for context compression in a
large language model (LLM). The ICAE has two modules: a learnable encoder
adapted with LoRA from an LLM for compressing a long context into a limited
number of memory slots, and a fixed decoder which is the target LLM that can
condition on the memory slots for various purposes. We first pretrain the ICAE
using both autoencoding and language modeling objectives on massive text data,
enabling it to generate memory slots that accurately and comprehensively
represent the original context. Then, we fine-tune the pretrained ICAE on a
small amount of instruct data to enhance its interaction with various prompts
for producing desirable responses. Our experimental results demonstrate that
the ICAE learned with our proposed pretraining and fine-tuning paradigm can
effectively produce memory slots with 4times context compression, which can
be well conditioned on by the target LLM to respond to various prompts. The
promising results demonstrate significant implications of the ICAE for its
novel approach to the long context problem and its potential to reduce
computation and memory overheads for LLM inference in practice, suggesting
further research effort in context management for an LLM. Our code and data
will be released shortly.