arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2410.23771cs.CLcs.LG
收藏

长上下文语言建模中困惑度有什么问题?

What is Wrong with Perplexity for Long-context Language Modeling?

State Key Lab of General Artificial Intelligence, School of Intelligence Science and Technology, Peking University(一般人工智能国家重点实验室,智能科学与技术学院,北京大学);MIT CSAIL(麻省理工学院计算机科学与人工智能实验室);Alibaba Group(阿里巴巴集团);TUM CIT, MCML, MDSI(技术大学(TUM) CIT、MCML、MDSI);MIT EECS, CSAIL(麻省理工学院电子工程与计算机科学系,计算机科学与人工智能实验室);Institute for Artificial Intelligence, Peking University(人工智能研究院,北京大学)

Lizhe Fang, Yifei Wang, Zhaoyang Liu, Chenheng Zhang, Stefanie Jegelka, Jinyang Gao, Bolin Ding, Yisen Wang

AI总结:

本文揭示 PPL 因平均所有 token 而忽视关键 token,提出 LongPPL 指标和 LongCE 微调损失,以更准确评估并提升 LLM 长上下文能力。

摘要:

处理长上下文输入对于大语言模型(LLM)在长对话、文档摘要和多样本上下文学习等任务中至关重要。尽管近期方法已经扩展了 LLM 的上下文窗口,并采用困惑度(PPL)作为标准评估指标,但事实证明,PPL 在评估长上下文能力方面并不可靠。这一局限的根本原因仍不清楚。在本工作中,我们对该问题给出了全面解释。我们发现,PPL 通过在所有 token 上取平均而忽略了对长上下文理解至关重要的关键 token,从而掩盖了模型在长上下文场景中的真实性能。为解决这一问题,我们提出 LongPPL,这是一种新颖指标,通过采用长短上下文对比方法识别关键 token,并将重点放在这些 token 上。实验表明,LongPPL 与多种长上下文基准上的性能具有很强相关性(例如 Pearson 相关系数为 -0.96),在预测准确性方面显著优于传统 PPL。此外,我们提出 LongCE(Long-context Cross-Entropy)损失,这是一种用于微调的重加权策略,会优先考虑关键 token,从而在不同基准上带来持续提升。总之,这些贡献更深入地揭示了 PPL 的局限性,并为准确评估和增强 LLM 的长上下文能力提供了有效解决方案。代码可在 https://github.com/PKU-ML/LongPPL 获取。

英文摘要:

Handling long-context inputs is crucial for large language models (LLMs) in tasks such as extended conversations, document summarization, and many-shot in-context learning. While recent approaches have extended the context windows of LLMs and employed perplexity (PPL) as a standard evaluation metric, PPL has proven unreliable for assessing long-context capabilities. The underlying cause of this limitation has remained unclear. In this work, we provide a comprehensive explanation for this issue. We find that PPL overlooks key tokens, which are essential for long-context understanding, by averaging across all tokens and thereby obscuring the true performance of models in long-context scenarios. To address this, we propose \textbf{LongPPL}, a novel metric that focuses on key tokens by employing a long-short context contrastive method to identify them. Our experiments demonstrate that LongPPL strongly correlates with performance on various long-context benchmarks (e.g., Pearson correlation of -0.96), significantly outperforming traditional PPL in predictive accuracy. Additionally, we introduce \textbf{LongCE} (Long-context Cross-Entropy) loss, a re-weighting strategy for fine-tuning that prioritizes key tokens, leading to consistent improvements across diverse benchmarks. In summary, these contributions offer deeper insights into the limitations of PPL and present effective solutions for accurately evaluating and enhancing the long-context capabilities of LLMs. Code is available at https://github.com/PKU-ML/LongPPL.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑