大規模言語モデルにおける文脈圧縮のためのインコンテクストオートエンコーダ
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は2つのモジュールで構成されています。1つは、LLMからLoRAを用いて適応させた学習可能なエンコーダで、長い文脈を限られた数のメモリスロットに圧縮します。もう1つは、固定されたデコーダで、これはターゲット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.