Recently, many methods have been developed to extend the context length of pre-trained large language models (LLMs), but they often require fine-tuning at the target length ($\gg4K$) and struggle to effectively utilize information from the middle part of the context. To address these issues, we propose $\textbf{C}$ontinuity-$\textbf{R}$elativity ind$\textbf{E}$xing with g$\textbf{A}$ussian $\textbf{M}$iddle ($\texttt{CREAM}$), which interpolates positional encodings by manipulating position indices. Apart from being simple, $\texttt{CREAM}$ is training-efficient: it only requires fine-tuning at the pre-trained context window (e.g., Llama 2-4K) and can extend LLMs to a much longer target context length (e.g., 256K). To ensure that the model focuses more on the information in the middle, we introduce a truncated Gaussian to encourage sampling from the middle part of the context during fine-tuning, thus alleviating the "Lost-in-the-Middle" problem faced by long-context LLMs. Experimental results show that $\texttt{CREAM}$ successfully extends LLMs to the target length for both Base and Chat versions of $\texttt{Llama2-7B}$ with "Never Miss A Beat". Our code is publicly available at https://github.com/bigai-nlco/cream.
Paper
Similar papers
Peer review
Summary
The paper introduces CREAM (Continuity-Relativity indExing with gAussian Middle), an efficient method for extending the context window of large language models (LLMs) to handle longer contexts without the need for extensive fine-tuning. CREAM manipulates position indices for shorter sequences within the pre-trained context window, using two key strategies: continuity, and relativity. Additionally, CREAM employs a truncated Gaussian distribution to enhance the model's focus on the middle part of the context, mitigating the "Lost-in-the-Middle" problem. Comprehensive experiments demonstrate CREAM's efficiency and effectiveness, showing improved performance over baselines like RandPos and PoSE on various tasks.
Strengths
CREAM achieves superior performance across a spectrum of long-context tasks. The empirical results substantiate CREAM's ability to effectively mitigate the "Lost-in-the-Middle" problem.
Weaknesses
I think the presentation of this paper is a significant problem. Actually, I cannot understand the method itself nor the intuitions behind it. First, I do not understand the concept of continuity in positional encoding. The authors use a short paragraph to explain continuity (lines 69-74) without any formulation, which is very abstract. The same goes for relativity, though I understood it from another paper. After explaining these two concepts, you still need to explain why they are important (I did not see this in the paper). Second, I do not understand why splitting the pre-trained context into three segments with different sizes can achieve continuity and relativity. Third, I do not understand why truncated Gaussian middle sampling mitigates the "Lost-in-the-Middle" problem. Line 113 states that it reduces the interval overlap in Eq2. But what is interval overlap and why does it result in the "Lost-in-the-Middle" problem? I may not be the ideal reader for this paper, but if other reviewers feel the same way, this paper may have been hastily completed.
Questions
See Weaknesses
Rating
3
Confidence
2
Soundness
2
Presentation
1
Contribution
2
Limitations
None
Summary
The paper presents CREAM (Continuity-Relativity indExing with gAussian Middle), an innovative approach to extend the context window of Large Language Models (LLMs) without the need for extensive fine-tuning at the target length. The authors address the "Lost in the Middle" problem, which plagues long-context LLMs by causing a performance drop when retrieving information from the middle of the context. CREAM achieves this by manipulating position indices and introducing a truncated Gaussian sampling method to focus on the middle part of the context during fine-tuning.
Strengths
1. **Novel Approach**: CREAM offers a novel positional encoding strategy that efficiently extends the context window of LLMs, which is a significant contribution to the field. 2. **Empirical Evidence**: The paper provides strong empirical evidence through comprehensive experiments, demonstrating CREAM's superiority over existing methods like PoSE and RandPos, especially in handling middle context information. 3. **Training Efficiency**: The method requires fine-tuning at the pre-trained context window size, which is computationally efficient compared to fine-tuning at the target length. 4. **Theoretical Foundation**: The paper includes theoretical justifications for the use of truncated Gaussian distribution, adding rigor to the proposed method.
Weaknesses
1. **Generalizability**: While the paper shows impressive results, it is not clear how generalizable these findings are to other LLMs beyond the tested Llama2-7B model. And I'm wondering whether the method can work with PEFT tuning techniques, such as QLoRA. 2. **Lack of Comparative Analysis**: The paper could benefit from a more detailed comparative analysis with other contemporary methods. For example, in Table 2, the paper only compares one model (LongChat-v1.5-7B-32k) with the same 32k context window. I suggest that in such comparision, peer models should at least take the same length of input, otherwise, it cannot prove the effectiveness of the proposed model over other Long LLMs with 32k+ context windows. I suggest the author compare with models like Mistral-7B-Instruct-v0.2, LongLoRA etc.
Questions
1. What are the computational overheads associated with implementing CREAM, and how does it scale with larger context sizes? 2. Are there any specific hyperparameter settings in CREAM that are particularly sensitive, and how were these chosen?
Rating
5
Confidence
4
Soundness
3
Presentation
3
Contribution
3
Limitations
The discussion in Appendix F regarding the limitations of the CREAM method could be misleading. The author implies that CREAM provides enhanced performance compared to other methods concerning the "Lost in the Middle" issue but acknowledges that the problem is not fully solved due to the nature of decoder-only models. For a genuine limitations section, it is essential to delve deeper into the specific constraints of the CREAM approach and how these limitations might impact its application and effectiveness. A more explicit acknowledgment of the method's shortcomings and a clear explanation of why these issues cannot be overcome with the current model design would significantly improve the section's clarity and usefulness.
Rebuttal by Authors
>**Q2:** Are there any specific hyperparameter settings in CREAM that are particularly sensitive, and how were these chosen? **A2:** Our method requires only three preset hyperparameters: the mean $\mu$ and variance $\sigma$ of the truncated Gaussian sampling, and the length of the head and tail sections $k$. For the mean $\mu$, it depends on the expansion factor $\alpha$, specifically $\mu = (1 + \alpha) / 2$. For the length $k$, we follow the settings of StreamingLLM[3], which uses a value of 4. Since we have expanded by a factor of 8, we set $k = 4 \times 8 = 32$. This also depends on the expansion factor. For the variance $\sigma$, our setting should ensure higher sampling frequency in the middle and lower (but non-zero) frequency at the ends. The experimental results for different $\sigma$ values in the table in A2 of reviewer fWsk's response can be used as a reference. >**Limitations:** The discussion in Appendix F regarding the limitations of the CREAM method could be misleading. The author implies that CREAM provides enhanced performance compared to other methods concerning the "Lost in the Middle" issue but acknowledges that the problem is not fully solved due to the nature of decoder-only models. For a genuine limitations section, it is essential to delve deeper into the specific constraints of the CREAM approach and how these limitations might impact its application and effectiveness. A more explicit acknowledgment of the method's shortcomings and a clear explanation of why these issues cannot be overcome with the current model design would significantly improve the section's clarity and usefulness. **A:** Thank you for noticing our discussed limitations and providing suggestions. We would like to explicitly elaborate the limitations of CREAM as two-fold. First, our method did not involve any adjustments to the model architecture. As discussed in our research question as in L34-35, this work aims to reach an efficient and effective optimality based on a pre-trained model. Consequently, it encounters the decoder-only limit mentioned in [4]. Second, our methods follow prior works and fine-tune pre-trained models on a small dataset considering the efficiency. Nevertheless, our approach might benefit from further enhancement of pre-trained dataset. We will provide a more detailed discussion of the limitations in our paper. We hope our answers have resolved your concerns. If you have any other concerns, please feel free to let us know. Thanks again for your review. Reference: [1] LoRA: Low-Rank Adaptation of Large Language Models. ICLR, 2022. [2] Qlora: Efficient finetuning of quantized llms. NeurIPS, 2023. [3] Efficient Streaming Language Models with Attention Sinks. ICLR, 2024. [4] Lost in the middle: How language models use long contexts. TACL, 2024.
Summary
The paper proposes a new method, CREAM, that better enables extrapolation to longer contexts via finetuning at the base context length. The method uses positional embedding interpolation with the embeddings divided into three areas of interest and uses a truncated Gaussian to sample the position used for the middle segment, to increase training of the middle context. They show that this is at least as effective as prior length extrapolation methods that use finetuning at the base context length, and that CREAM-trained models suffer less from the lost in the middle problem.
Strengths
S1. The method shows clear improvement on the targeted issue (the lost in the middle phenomenon)-- e.g. in Table 1. S2. The method is well-motivated both intuitively and theoretically, and the explanation in section 2.2 is well-written and easy to follow. S3. The authors evaluate against the two most reasonable baselines (to my knowledge) and across a good selection of synthetic, long-context, and short-context tasks. (It would be an added benefit to evaluate against finetuning with position interpolation and *long* context at finetuning-time, to see the efficiency-performance tradeoff; however, I do not think this is strictly necessary to the paper's claims.)
Weaknesses
W1. The method is fairly similar to POSE in concept and performance. While I think the idea of emphasizing middle training is reasonable, well-explored, and clearly effective (e.g. in Figure 1), this has also been explored as a post-training or data selection correction in other work. Given the slight performance degradation from POSE on short-context tasks (i.e. in Table 4), I'm concerned that this might not be worth the tradeoff practically to do at training time. W2. Evaluation settings can differ subtly across papers, and so it would be better for the authors to reproduce baseline results rather than citing them from literature, where possible. This is most critical, I think, in Table 4, where the differences between methods are relatively small and all results are compared to the same baseline method, which is not an infeasibly expensive or unavailable model to run.
Questions
Q1. In Table 5: why does the 256k-extrapolated version of CREAM underperform the 128k-extrapolated version on short contexts? Q2. Say you had an even more limited amount of compute, to the point where finetuning on the base context length was prohibitively expensive (e.g., maybe you want to finetuned Llama3-8b but can't fit 8192 context at training time). Do you believe CREAM would be useful in this setting? Do you have any results (or speculation!) that suggest when the method may begin to break down with decreasing maximum training length? Q3. (Minor) What is the context length used in Figure 1? The x axis only reports the position of keys. Suggestions/comments: * Please explain in the text what the occasional highlighting of numbers represents (e.g. in Table 2). It would be helpful for readability to bold the best number in each column across tables.
Rating
6
Confidence
3
Soundness
3
Presentation
3
Contribution
2
Limitations
Yes, no concerns here.
Rebuttal by Authors
>**Q2:** Say you had an even more limited amount of compute, to the point where finetuning on the base context length was prohibitively expensive (e.g., maybe you want to finetuned Llama3-8b but can't fit 8192 context at training time). Do you believe CREAM would be useful in this setting? Do you have any results (or speculation!) that suggest when the method may begin to break down with decreasing maximum training length? **A2:** Thank you for providing the experimental setup, which further highlights the superiority of our method. Following your instructions, we fine-tuned LLaMa3-8b using a 4K context window size. The experimental results are presented in the table below. | AVG Length | 2000 | 2700 | 3300 | 4000 | 5200 | 6500 | 7800 | 8800 | 9700 | 11000 | 12000 | 14000 | 17000 | 19000 | 24000 | 28000 | 32000 | | :------------------ | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :---- | :---- | :---- | :---- | :---- | :---- | :------ | :---- | | LLaMa3-CREAM-Linear | 0.98 | 0.96 | 0.98 | 1.00 | 0.92 | 0.96 | 0.96 | 0.94 | 0.86 | 0.92 | 0.92 | 0.92 | 0.86 | 0.84 | 0.70 | 0.60 | 0.48 | The results presented in the table demonstrate that our method **is well-suited to this setting and performs surprisingly well.** >**Q3:** (Minor) What is the context length used in Figure 1? The x axis only reports the position of keys. **A3:** This is consistent with the setting in [5] and corresponds to an approximate length of 5K. Results with longer contexts (10K) are in Table 1. >**Suggestions/comments:** >Please explain in the text what the occasional highlighting of numbers represents (e.g. in Table 2). It would be helpful for readability to bold the best number in each column across tables. **A:** Thank you for the insightful suggestions. The highlighted numbers in Table 1 and Table 2 emphasize the advantages of our results compared to other methods. In Table 2, we have bolded the average results. Following your suggestion, we will also bold the best results in each column. We hope our answers have resolved your concerns. If you have any other concerns, please feel free to let us know. Thanks again for your review. Reference: [1] Yi: Open foundation models by 01. arXiv preprint arXiv:2403.04652, 2024. [2] Qwen2 technical report. arXiv preprint arXiv:2407.10671, 2024. [3] Internlm2 technical report. arXiv preprint arXiv:2403.17297, 2024. [4] Data Engineering for Scaling Language Models to 128K Context. ICML, 2024. [5] Lost in the middle: How language models use long contexts. TACL, 2024.
Thanks for the detailed response! > W1 I appreciate the multiple random seeds for the short-context performance eval (and would love to see this extended to report error bars on the long-context evals as well). My major concern was short-context regression relative to POSE, and looking at the results over multiple random seeds shows that there is not a significant difference in short-context performance. > Q1 Totally my bad, somehow missed that this table was perplexity! > we fine-tuned LLaMa3-8b using a 4K context window I'm also glad to see how well the method performs in this even more length-constrained scenario. Given the rebuttal, I have raised my score 5->6. Thanks for the nice paper!
We would like to express our sincere gratitude for your thorough review of our paper. Your expertise has greatly contributed to enhancing the quality of our work, and we are committed to incorporating your suggestions during the revision process. Thank you once again for acknowledging our efforts.
Summary
The paper proposes a method for extending the context window of pretrain large language models. The approach, CREAM, relies on modifying position indices to interpolate the positional encodings. Despite the often computationally expensive nature of such work, CREAM can extend to very long context windows while only needing to train at the original pretrained context window. Additionally, in their approach to the context length problem, the authors propose a solution that focuses explicitly on learning at the middle of the context — a span that often under-performs in long context models. The experimental results cover a wide variety of problems, both in terms of tasks, as well as context length challenges. Overall the results look very promising, and show a strong method for addressing a challenging task of extending the context length of LLMs.
Strengths
- The authors tackle two problems that go hand in hand, namely extending the context length during fine-tuning - but doing so in a way ensures consistent performance. - The approach divides the desired context length into three segments, which then results in relative positional distances that vary and consequently learning all relative positions within the target length $L$. The technique is simple, but clever and an effective way to efficiently expose the model to a broader range of relative positional distances during training. - The results are very strong, particularly with the performances listed on Long Bench, which encompasses a broad range of tasks.
Weaknesses
- No error bars shown on results. In most cases the results are quite strong, but the error bars would be helpful — particularly in some of the closer comparisons with PoSE. - The solution of using a truncated Gaussian approach lacks motivation. The "lost in the middle" problem is clear, however the solution of using a truncated Gaussian to force more focus on the middle seems brittle. Could the parameters of the truncated Gaussian be learned from data? The approach works well based on the results shown in Figure 5a, however.
Questions
The authors mention that CREAM only needed to be trained for 100 in some cases. Can the authors provide more insight on why the results are very good despite so little training? This seems like a significant achievement, but was not discussed in detail.
Rating
6
Confidence
3
Soundness
2
Presentation
4
Contribution
4
Limitations
The amount of focus on the middle context seems fixed in this approach. While the results for Gaussian truncation appear promising, it's not clear if this direct approach to solving the "lost in the middle" problem is universal. In short, how do we know how much to reweight the importance of the middle context, and does it vary by dataset or task?
Rebuttal by Authors
>**Q:** The authors mention that CREAM only needed to be trained for 100 in some cases. Can the authors provide more insight on why the results are very good despite so little training? This seems like a significant achievement, but was not discussed in detail. **A**: Thank you for the careful review. For the Base model (Llama2-7b), we conducted 1,000 steps of continual pre-training on the to ensure a fair comparison with prior works as in [5,6]. For the Chat model (Llama2-7b-chat), we performed only 100 steps of Instruction Fine-Tuning (IFT). Indeed, we attempted to extend the IFT to 400 steps, but the performance deteriorated; the detailed results are shown in the table below. This is because we used the instruction dataset ShareGPT as a substitution for the original IFT used for Chat model (the original dataset is not publicly accessible). This observation is in line with previous studies that have pointed out that **instruction fine-tuning on different datasets may lead to catastrophic forgetting and impact performance**[2,3,4]. To balance the effectiveness of position index learning and the degradation of the LLM's IFT performance, we limited the IFT to 100 steps. Like you have observed, 100 steps of finetuning yield effective long-context performance. | Model | Single-Doc QA | Multi-Doc QA | Summarization | Few-shot Learning | Code Completion | Synthetic Tasks | Macro | | :----------------- | :------------ | :----------- | :------------ | :---------------- | :-------------- | :-------------- | :---- | | Llama2-7B-chat-4k* | 24.9 | 22.6 | 24.7 | 60 | 48.1 | 5.9 | 31.0 | | 100 steps | 34.8 | 31.1 | 27.2 | 65.1 | 50.4 | 7.0 | 35.9 | | 400 steps | 30.9 | 23.5 | 27.1 | 62.4 | 35.6 | 3.4 | 30.5 | >**Limitations:** The amount of focus on the middle context seems fixed in this approach. While the results for Gaussian truncation appear promising, it's not clear if this direct approach to solving the "lost in the middle" problem is universal. In short, how do we know how much to reweight the importance of the middle context, and does it vary by dataset or task? **A:** Sorry about confusion. We would like to clarify that **the middle context our method focuses on is NOT fixed**. According to Algorithm 1, **each sample requires two rounds of sampling to obtain the final position index, so the intermediate context position index varies between samples.** Specifically, we first sample a factor $\alpha$ from a truncated Gaussian distribution to determine the interval where the current $P_e$ is located. Then, we uniformly sample the final $P_e$ from this interval, which is the ending position index of the intermediate section. The sample flow was discussed in L122-125. We would further add more clarification to explain our strategy. As mentioned above, our method **does NOT require meticulously designed weight distributions**; instead, it automatically assigns weights using truncated Gaussian sampling. Moreover, in all the experiments presented in our paper, all parameters remained consistent, yet the method still performed effectively across various tasks. This demonstrates the generality of our approach, which **does not change depending on the dataset or task**. We hope the above response can resolve your questions and concerns. Please let us know if there is any further question! Thanks again for your review. Reference: [1] Lost in the middle: How language models use long contexts. TACL, 2024. [2] CoachLM: Automatic Instruction Revisions Improve the Data Quality in LLM Instruction Tuning. ICDE, 2024. [3] Lima: Less is more for alignment. NeurIPS, 2024. [4] From Quantity to Quality: Boosting LLM Performance with Self-Guided Data Selection for Instruction Tuning. NAACL 2024. [5] Extending Context Window of Large Language Models via Positional Interpolation [6] PoSE: Efficient Context Window Extension of LLMs via Positional Skip-wise Training, ICLR 2024.
Thank you for the response. You have answered each of my questions and provided clarity on some points I misunderstood. I appreciate the additional analyses you’ve run — they provide insight and more confidence in your findings.
Thank you for your thorough review of our rebuttal and your encouraging feedback. Your expertise has significantly contributed to improving the quality of our work, and we are dedicated to incorporating your suggestions in our revision process. If you are satisfied with our rebuttal, we would be extremely grateful if you could consider increasing the final score.
Decision
Accept (poster)