S4-11 · 基础 S4-11 · Foundation

结束 Token · 停止也是一次候选选择 End-of-Sequence Token · Stopping Is Another Token Choice

EOS logit → EOS probability each step → select stop

结束 Token(End-of-Sequence Token,EOS)表示序列应停止。生成不是模型神秘地“觉得说完了”,而是在某一步选择了这个特殊 token。 The End-of-Sequence Token (EOS) marks that a sequence should stop. Generation does not mysteriously “feel finished”; it selects this special token at a step.

01 · 一句话为什么会停 01 · Why a sentence stops

打字机没有“我讲完了”的感觉,它凭什么在某一格自动停下来? A typewriter has no feeling of being done, so what makes it stop at a particular slot?

02 调 EOS logit,看停止提前或延后 Move the EOS Logit and Watch Stopping Shift

概率柱语法 Probability-bar grammar
状态 A Metric A
状态 B Metric B
状态 C Metric C

概率与输出均为固定种子的教学模拟,不代表真实模型。拖回主变量即可复核结论。 Probabilities and outputs are fixed-seed teaching simulations, not real model output. Move the main variable back to verify the conclusion.

03 把变化拆成 4 个零件 Break the Change into Four Parts

End-of-Sequence Token
PART 01

EOS 候选 EOS candidate

〈EOS〉与普通词一起出现在下一 token 候选集合中。 appears in the next-token candidate set alongside ordinary words.

PART 02

EOS logit EOS logit

它也有一个未归一化分数,可单独调高或调低。 It also has an unnormalized score that can rise or fall.

PART 03

停止概率 Stop probability

softmax 把 EOS logit 变成每一步可见的停止概率。 Softmax turns the EOS logit into a visible stop probability at every step.

PART 04

终止动作 Stop action

一旦采样或选择到 EOS,生成循环停止,EOS 通常不展示给用户。 Once EOS is sampled or selected, generation stops and EOS is usually hidden from the user.

04 最小机制:EOS 与内容 token 一起竞争 Minimal Mechanism: EOS Competes with Content Tokens

End-of-Sequence Token
p(EOS) = softmax(zEOS, zcontent)
提高 zEOS 会提高每一步停止概率;固定种子下,停止位置会单调提前或保持。 Raising zEOS increases stop probability at every step; with a fixed seed, the stop position moves earlier or stays.
调高 EOS logit Raise EOS logit 停止概率上升 stop probability rises
每步参与选择 Compete each step 更早命中 EOS EOS is hit earlier
循环终止 Stop the loop 输出变短 output becomes shorter

05 边界实验:把 EOS 分数推得过高 Boundary Test: Push the EOS Score Too High

主动制造失败 Create a failure

第一步就想停,内容还没展开 It wants to stop before content unfolds

把 EOS logit 拉到 4.0。观察第一步停止概率如何压过内容候选,使回答提前结束。 Set the EOS logit to 4.0. Watch step-one stop probability overpower content candidates and end the answer too early.

尚未执行。先在主交互中观察正常机制。 Not run yet. Observe the normal mechanism in the main interaction first.
模型靠理解“说完了”才停止。 The model stops because it understands it is done. → ✓ 停止对应特殊 EOS token 被选择。 Stopping corresponds to selecting a special EOS token.
EOS 只能出现在句号后。 EOS can appear only after punctuation. → ✓ 它是候选 token,位置由当前概率决定。 It is a candidate token whose position follows current probability.
调低 EOS 就能无限生成。 Lowering EOS guarantees infinite generation. → ✓ 最大长度等外部边界仍会强制停止。 External limits such as maximum length can still force a stop.
06 · 一句话带走 06 · One line to keep

EOS 是参与下一 token 竞争的特殊结束标记;拖动它的 logit,就能看到停止概率与结束位置一起提前或延后。 EOS is a special end marker competing as the next token. Move its logit to watch stop probability and the ending position shift earlier or later.