TensorX
返回文献探索

Paper · arXiv 2402.17463

Training-Free Long-Context Scaling of Large Language Models

Chenxin An, Fei Huang, Jun Zhang, Shansan Gong, Xipeng Qiu, Chang Zhou, Lingpeng Kong

24 upvotesFebruary 27, 2024arXiv 预印本
AI 摘要

Dual Chunk Attention (DCA) enhances Llama2 70B to handle over 100k tokens without fine-tuning by decomposing attention into chunk-based modules, achieving performance comparable to finetuned models.

Large Language Models (LLMs)input tokenspretraining lengthfinetuningDual Chunk Attention (DCA)context windowsattention computationchunk-based modulesrelative positional informationFlash Attentionextrapolation capabilitypractical long-context taskstraining-free modelgpt-3.5-16kopen-source alternative

Abstract

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.

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

京ICP备2026059466号
Training-Free Long-Context Scaling of Large Language Models | TensorX