Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuning

About

It is well known that LLMs cannot generalize well to long contexts whose lengths are larger than the training sequence length. This poses challenges when employing LLMs for processing long input sequences during inference. In this work, we argue that LLMs themselves have inherent capabilities to handle long contexts without fine-tuning. To achieve this goal, we propose SelfExtend to extend the context window of LLMs by constructing bi-level attention information: the grouped attention and the neighbor attention. The grouped attention captures the dependencies among tokens that are far apart, while neighbor attention captures dependencies among adjacent tokens within a specified range. The two-level attentions are computed based on the original model's self-attention mechanism during inference. With minor code modification, our SelfExtend can effortlessly extend existing LLMs' context window without any fine-tuning. We conduct comprehensive experiments on multiple benchmarks and the results show that our SelfExtend can effectively extend existing LLMs' context window length. The code can be found at \url{https://github.com/datamllab/LongLM}.

Hongye Jin, Xiaotian Han, Jingfeng Yang, Zhimeng Jiang, Zirui Liu, Chia-Yuan Chang, Huiyuan Chen, Xia Hu• 2024

Related benchmarks

TaskDatasetResultRank
Long-context Language UnderstandingLongBench
M-Avg45.28
219
Language ModelingPG-19 (test)
Perplexity10.91
106
Language ModelingPG-19
Perplexity8.81
96
Long-context Language UnderstandingL-Eval
Coursera58.28
26
Long-context Language UnderstandingL-Eval (test)
Coursera55.38
26
Long-context Language UnderstandingLongBench 1.0 (test)
MultiNews21.35
21
Multi-document Question AnsweringMDQA
Recall@172.6
16
Key-Value RetrievalKV retrieval
Precision@199.6
14
Long-context Visual Question AnsweringVisual HayStack Long Window (test)
Accuracy (50 images)50.35
11
Long-context Visual Question AnsweringVisual HayStack Short Window (test)
Accuracy (1 Image)78.53
11
Showing 10 of 11 rows

Other info

Follow for update