LLoCO: Lange Contexten Offline Leren
LLoCO: Learning Long Contexts Offline
April 11, 2024
Auteurs: Sijun Tan, Xiuyu Li, Shishir Patil, Ziyang Wu, Tianjun Zhang, Kurt Keutzer, Joseph E. Gonzalez, Raluca Ada Popa
cs.AI
Samenvatting
Het verwerken van lange contexten blijft een uitdaging voor grote taalmodellen (LLM's) vanwege de kwadratische reken- en geheugenoverhead van het self-attention-mechanisme en de aanzienlijke grootte van de KV-cache tijdens generatie. Wij stellen een nieuwe aanpak voor om dit probleem aan te pakken door contexten offline te leren via contextcompressie en domeinspecifieke parameter-efficiënte finetuning. Onze methode stelt een LLM in staat om een beknopte representatie van de oorspronkelijke context te creëren en efficiënt relevante informatie op te halen om vragen nauwkeurig te beantwoorden. Wij introduceren LLoCO, een techniek die contextcompressie, informatie-opvraging en parameter-efficiënte finetuning combineert met behulp van LoRA. Onze aanpak breidt het effectieve contextvenster van een 4k-token LLaMA2-7B-model uit tot het verwerken van maximaal 128k tokens. Wij evalueren onze aanpak op verschillende lange-context vraag-antwoorddatasets en tonen aan dat LLoCO aanzienlijk beter presteert dan in-context learning, terwijl het 30 keer minder tokens gebruikt tijdens inferentie. LLoCO bereikt een versnelling tot 7,62 keer en vermindert de kosten van vraag-antwoordtaken voor lange documenten aanzienlijk, waardoor het een veelbelovende oplossing is voor efficiënte verwerking van lange contexten. Onze code is publiekelijk beschikbaar op https://github.com/jeffreysijuntan/lloco.
English
Processing long contexts remains a challenge for large language models (LLMs)
due to the quadratic computational and memory overhead of the self-attention
mechanism and the substantial KV cache sizes during generation. We propose a
novel approach to address this problem by learning contexts offline through
context compression and in-domain parameter-efficient finetuning. Our method
enables an LLM to create a concise representation of the original context and
efficiently retrieve relevant information to answer questions accurately. We
introduce LLoCO, a technique that combines context compression, retrieval, and
parameter-efficient finetuning using LoRA. Our approach extends the effective
context window of a 4k token LLaMA2-7B model to handle up to 128k tokens. We
evaluate our approach on several long-context question-answering datasets,
demonstrating that LLoCO significantly outperforms in-context learning while
using 30times fewer tokens during inference. LLoCO achieves up to
7.62times speed-up and substantially reduces the cost of long document
question answering, making it a promising solution for efficient long context
processing. Our code is publicly available at
https://github.com/jeffreysijuntan/lloco.