TensorX
返回文献探索

Paper · arXiv 2307.06945

In-context Autoencoder for Context Compression in a Large Language Model

Tao Ge, Jing Hu, Xun Wang, Si-Qing Chen, Furu Wei

29 upvotesJuly 13, 2023arXiv 预印本
AI 摘要

The In-context Autoencoder (ICAE) compresses long contexts into memory slots for efficient LLM inference using a combination of pretraining and fine-tuning.

In-context AutoencoderICAElearnable encoderLoRALLMmemory slotsautoencodinglanguage modelingcontext compressionpretrainingfine-tuninginstruct datapromptsdesirable responsescontext management

Abstract

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.

北京市昌平区探索星信息技术及软件开发工作室

京ICP备2026059466号