跳到主要内容Skip to main content

logits 与概率分布Logits and Probability Distribution

Logits and Probability Distribution

  • 核心概念Core concepts
  • 第四站 · 看懂Station 4 · Under the Hood
解决什么问题What problem it solves

模型每一步输出的不是词,而是整个词表的分数表。采样参数都作用在这上面。What the model outputs at each step is not a word but a score table over the whole vocabulary. All sampling parameters act on it.

这是什么What it is

每一步,模型给词表里每个候选 token 打一个分数,即 logits。

分数经 softmax 变成概率分布:所有候选的概率加起来为 1。

温度、top-k、top-p 都是在这张分布上做手脚。

At each step the model assigns a score — a logit — to every candidate token in the vocabulary.

Softmax turns the scores into a probability distribution: all candidates sum to 1.

Temperature, top-k and top-p all reshape this distribution.

为什么需要知道Why it matters

理解了它,采样参数不再是玄学。它们改的是分布的形状,不是模型的「想法」。Once you get it, sampling parameters stop being mysticism: they change the shape of the distribution, not the model's 'mind'.

出处Sources
  • Jurafsky & Martin《Speech and Language Processing》第 3 章(语言模型输出词表上的概率分布)Jurafsky & Martin, Speech and Language Processing, ch. 3 ↗
  • Holtzman 等《The Curious Case of Neural Text Degeneration》§3.3(温度采样的讨论)Holtzman et al., The Curious Case of Neural Text Degeneration, §3.3 ↗