无需调参的采样方法,让大模型生成更稳定高质量文本。
p-less Sampling: A Robust Hyperparameter-Free Approach for LLM Decoding
- 基于信息论动态设定截断阈值,自动选择候选词集。
- 温度越高越稳定,生成质量下降少于传统方法。
- 无超参数、效率高,适合需快速推理的场景。
从大语言模型生成高质量输出通常依赖采样解码策略来概率性选择下一个词元。尽管已有多种采样方法,但其性能对超参数敏感,且不同任务与温度设置需不同配置。本文提出 $p$-less sampling:一种基于信息论的采样方法,在每一步根据完整词元概率分布动态设定截断阈值。该方法无需任何超参数,随温度升高仍保持高质量输出。我们从理论角度分析该方法,并在数学、逻辑推理和创意写作等任务上实证验证其有效性。结果表明,$p$-less sampling 在各类任务中持续优于现有方法,且在高温下文本质量退化显著更少。此外,它通过更低的平均采样时间与更短生成长度实现更高推理效率,且不牺牲准确性。我们还通过定性案例、个案研究与多样性评估进一步揭示其优势。代码已开源:https://github.com/ryttry/p-less。
原文摘要 · Abstract (English)
Obtaining high-quality outputs from Large Language Models (LLMs) often depends upon the choice of a sampling-based decoding strategy to probabilistically choose the next token at each generation step. While a variety of such sampling methods have been proposed, their performance can be sensitive to the selection of hyperparameters which may require different settings depending upon the generation task and temperature configuration. In this work, we introduce $p$-less sampling: an information-theoretic approach to sampling which dynamically sets a truncation threshold at each decoding step based on the entire token probability distribution. Unlike existing methods, $p$-less sampling has no hyperparameters and consistently produces high-quality outputs as temperature increases. We provide theoretical perspectives on $p$-less sampling to ground our proposed method and conduct experiments to empirically validate its effectiveness across a range of math, logical reasoning, and creative writing tasks. Our results demonstrate how $p$-less sampling consistently outperforms existing sampling approaches while exhibiting much less degradation in text quality at higher temperature values. We further show how $p$-less achieves greater inference-time efficiency than alternative methods through lower average token sampling times and shorter generation lengths, without sacrificing accuracy. Finally, we provide analyses to highlight the benefits of $p$-less through qualitative examples, case studies, and diversity assessments. The code is available at https://github.com/ryttry/p-less .
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。