arXiv:2505.11183stat.MLcs.CL2025-05

不同目标下,大模型解码算法效果差异大,选错方法可能白忙。

On Next-Token Prediction in LLMs: How End Goals Determine the Consistency of Decoding Algorithms

  • 用真实概率分布时,随机采样能忠实生成符合分布的文本。
  • 在完整序列0-1损失最小化目标下,无多项式时间最优解。
  • 信息检索与创意生成需不同解码策略,当前常用方法缺乏理论支撑。

基于交叉熵损失的概率性下一个词预测是大多数大语言模型的基础。给定前序词序列,该预测为词汇表中每个可能的下一个词分配概率。有多种方式利用这一预测生成词序列。本文研究了贪婪、前瞻、随机采样及温度缩放随机采样等几种解码算法,在不同目标(以损失函数编码)下的一致性表现。尽管代理损失与目标损失的一致性问题已有研究,但本工作首次在大语言模型语境下系统探讨该问题。我们发现,只要下一个词预测收敛到真实概率分布,随机采样就能一致地输出符合真实分布采样的序列。但对于最小化整个序列0-1损失等目标,我们证明不存在对所有概率分布均最优的多项式时间算法,且所研究的各类解码算法仅对部分分布最优。分析表明,解码算法在信息检索与创造性生成间存在本质分歧,说明根据任务目标选择合适算法至关重要,而当前许多常用算法在诸多场景下缺乏理论基础。

原文摘要 · Abstract (English)

Probabilistic next-token prediction trained using cross-entropy loss is the basis of most large language models. Given a sequence of previous values, next-token prediction assigns a probability to each possible next value in the vocabulary. There are many ways to use next-token prediction to output token sequences. This paper examines a few of these algorithms (greedy, lookahead, random sampling, and temperature-scaled random sampling) and studies their consistency with respect to various goals encoded as loss functions. Although consistency of surrogate losses with respect to a target loss function is a well researched topic, we are the first to study it in the context of LLMs (to the best of our knowledge). We find that, so long as next-token prediction converges to its true probability distribution, random sampling is consistent with outputting sequences that mimic sampling from the true probability distribution. For the other goals, such as minimizing the 0-1 loss on the entire sequence, we show no polynomial-time algorithm is optimal for all probability distributions and all decoding algorithms studied are only optimal for a subset of probability distributions. When analyzing these results, we see that there is a dichotomy created between the goals of information retrieval and creative generation for the decoding algorithms. This shows that choosing the correct decoding algorithm based on the desired goal is extremely important and many of the ones used are lacking theoretical grounding in numerous scenarios.

解码算法语言模型理论分析

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