arXiv:2503.09202cs.CL2025-03NAACL被引 15

通过给训练词元加权,提升大模型处理长文本的能力。

Token Weighting for Long-Range Language Modeling

  • 用长短上下文模型对比判断词元重要性,动态分配损失权重。
  • 在多个长文本任务上验证,非均匀加权显著提升模型表现。
  • 小模型即可辅助打分,适合资源有限的长文本训练场景。

大语言模型在长文本理解任务中仍面临挑战。我们假设,传统的等权重下一个词预测训练方式是原因之一:每个词元都被赋予相同重要性。但实际中,预测下一个词所需上下文长度差异很大。为此,我们提出多种新颖的词元加权方案,在损失函数中为不同词元分配不同权重,从而扩展现有方法。我们采用两步框架,通过比较长上下文与短上下文模型对词元的置信度来评分。在多个长文本理解任务上评估,结果表明非均匀损失权重能有效增强模型的长程建模能力。使用比目标模型小得多的短上下文模型进行评分也有效。本工作深化了对长程语言建模权衡的理解,并基于实证提供了通过损失加权指导模型训练的建议。代码已开源。

原文摘要 · Abstract (English)

Many applications of large language models (LLMs) require long-context understanding, but models continue to struggle with such tasks. We hypothesize that conventional next-token prediction training could contribute to this, because each token is assigned equal weight. Yet, intuitively, the amount of context needed to predict the next token accurately varies greatly across different data. To reflect this, we propose various novel token-weighting schemes that assign different weights to each training token in the loss, thereby generalizing existing works. For this, we categorize token-weighting methods using a two-step framework which compares the confidences of a long-context and short-context model to score tokens. We evaluate all methods on multiple long-context understanding tasks and show that non-uniform loss weights are helpful to improve the long-context abilities of LLMs. Different short-context models can be used effectively for token scoring, including models that are much smaller than the long-context model that is trained. All in all, this work contributes to a better understanding of the trade-offs long-context language modeling faces and provides guidelines for model steering via loss-weighting based on empirical evidence. The code can be found on Github.

长文本词元加权损失优化LLM

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。