LLoCO: Lernen langer Kontexte offline
LLoCO: Learning Long Contexts Offline
April 11, 2024
Autoren: Sijun Tan, Xiuyu Li, Shishir Patil, Ziyang Wu, Tianjun Zhang, Kurt Keutzer, Joseph E. Gonzalez, Raluca Ada Popa
cs.AI
Zusammenfassung
Die Verarbeitung langer Kontexte bleibt für große Sprachmodelle (LLMs) aufgrund des quadratischen Rechenaufwands und des Speicherbedarfs des Self-Attention-Mechanismus sowie der beträchtlichen KV-Cache-Größen während der Generierung eine Herausforderung. Wir schlagen einen neuartigen Ansatz vor, um dieses Problem zu lösen, indem wir Kontexte offline durch Kontextkompression und parameter-effizientes Feintuning im jeweiligen Bereich erlernen. Unsere Methode ermöglicht es einem LLM, eine prägnante Darstellung des ursprünglichen Kontexts zu erstellen und relevante Informationen effizient abzurufen, um Fragen genau zu beantworten. Wir stellen LLoCO vor, eine Technik, die Kontextkompression, Abruf und parameter-effizientes Feintuning unter Verwendung von LoRA kombiniert. Unser Ansatz erweitert das effektive Kontextfenster eines 4k-Token LLaMA2-7B-Modells, um bis zu 128k Tokens zu verarbeiten. Wir evaluieren unseren Ansatz anhand mehrerer Datensätze für Fragen und Antworten zu langen Kontexten und zeigen, dass LLoCO signifikant besser abschneidet als das Lernen im Kontext, während es während der Inferenz 30-mal weniger Tokens verwendet. LLoCO erreicht eine bis zu 7,62-fache Beschleunigung und reduziert erheblich die Kosten für das Beantworten von Fragen zu langen Dokumenten, was es zu einer vielversprechenden Lösung für die effiziente Verarbeitung langer Kontexte macht. Unser Code ist öffentlich unter https://github.com/jeffreysijuntan/lloco verfügbar.
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.Summary
AI-Generated Summary