Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Adapting Language Models to Compress Contexts

About

Transformer-based language models (LMs) are powerful and widely-applicable tools, but their usefulness is constrained by a finite context window and the expensive computational cost of processing long text documents. We propose to adapt pre-trained LMs into AutoCompressors. These language models are capable of compressing long contexts into compact summary vectors, which are then accessible to the model as soft prompts. Summary vectors are trained with an unsupervised objective, whereby long documents are processed in segments, and summary vectors from all previous segments are used in language modeling. We fine-tune OPT and Llama-2 models on sequences of up to 30,720 tokens and show that AutoCompressors can utilize long contexts to improve perplexity. We evaluate AutoCompressors on in-context learning by compressing task demonstrations and find that summary vectors are good substitutes for plain-text demonstrations, increasing accuracy while reducing inference costs. Finally, we explore the benefits of pre-computing summary vectors for large corpora by applying summary vectors to retrievalaugmented language modeling and a passage re-ranking task. Overall, AutoCompressors emerge as a simple and inexpensive solution to extend the context window of LMs while speeding up inference over long contexts.

Alexis Chevalier, Alexander Wettig, Anirudh Ajith, Danqi Chen• 2023

Related benchmarks

TaskDatasetResultRank
Mathematical ReasoningGSM8K
Accuracy22.7
1362
Long-context Language UnderstandingLongBench (test)
Average Score20.5
147
Question AnsweringSQuAD
F121.46
134
Question AnsweringHotpotQA
F116.29
128
Question AnsweringSQuAD (test)
F160.55
111
Question AnsweringNarrativeQA (test)--
68
Question AnsweringQASPER (test)
F1 Score (Match)16.47
27
Question AnsweringNaturalQuestions processed
Accuracy49.23
22
Question AnsweringHotpotQA (test)
Exact Match (EM)32
22
Multi-hop Question AnsweringHotpotQA 10 related documents
F129.02
21
Showing 10 of 28 rows

Other info

Follow for update