Trainingsvrije schaling van grote taalmodellen voor lange contexten
Training-Free Long-Context Scaling of Large Language Models
February 27, 2024
Auteurs: Chenxin An, Fei Huang, Jun Zhang, Shansan Gong, Xipeng Qiu, Chang Zhou, Lingpeng Kong
cs.AI
Samenvatting
Het vermogen van Large Language Models (LLMs) om coherente tekst te verwerken en te genereren, wordt aanzienlijk verzwakt wanneer het aantal invoertokens hun vooraf getrainde lengte overschrijdt. Gezien de hoge kosten van het finetunen van grootschalige modellen met langere sequenties, stellen we Dual Chunk Attention (DCA) voor, waarmee Llama2 70B contextvensters van meer dan 100k tokens kan ondersteunen zonder voortdurende training. Door de aandachtberekening voor lange sequenties op te splitsen in chunk-gebaseerde modules, slaagt DCA erin om de relatieve positionele informatie van tokens binnen dezelfde chunk (Intra-Chunk) en over verschillende chunks (Inter-Chunk) effectief vast te leggen, en integreert het naadloos met Flash Attention. Naast zijn indrukwekkende extrapolatievermogen, behaalt DCA prestaties op praktische lang-context taken die vergelijkbaar zijn met of zelfs beter dan die van gefinetunde modellen. In vergelijking met propriëtaire modellen, bereikt ons trainingsvrije 70B-model 94% van de prestaties van gpt-3.5-16k, wat aangeeft dat het een levensvatbare open-source alternatief is. Alle code en gegevens die in dit werk zijn gebruikt, zijn vrijgegeven op https://github.com/HKUNLP/ChunkLlama.
English
The ability of Large Language Models (LLMs) to process and generate coherent
text is markedly weakened when the number of input tokens exceeds their
pretraining length. Given the expensive overhead of finetuning large-scale
models with longer sequences, we propose Dual Chunk Attention (DCA), which
enables Llama2 70B to support context windows of more than 100k tokens without
continual training. By decomposing the attention computation for long sequences
into chunk-based modules, DCA manages to effectively capture the relative
positional information of tokens within the same chunk (Intra-Chunk) and across
distinct chunks (Inter-Chunk), as well as integrates seamlessly with Flash
Attention. In addition to its impressive extrapolation capability, DCA achieves
performance on practical long-context tasks that is comparable to or even
better than that of finetuned models. When compared with proprietary models,
our training-free 70B model attains 94% of the performance of gpt-3.5-16k,
indicating it is a viable open-source alternative. All code and data used in
this work are released at https://github.com/HKUNLP/ChunkLlama.