S3-18 · 基础 S3-18 · Foundation

上下文窗口 · 一次能看见多少 Context Window · How Much Is Visible at Once

token stream → fixed-capacity window → visible prefix → next computation

上下文窗口是模型一次计算中最多能接收和关联的 token 范围。它是结构容量,不是长期记忆;装得下,也不等于每一处都能同样用好。 A context window is the token range a model can receive and relate in one computation. It is structural capacity, not long-term memory—and fitting does not guarantee equal use.

01 · 想象一张固定宽度的桌子 01 · Picture a desk with fixed width

新便签不断推上桌,桌面满了以后,最早那张还在眼前吗? As new notes keep arriving, what happens to the oldest one when the desk is full?

02 窗口传送带:逐张塞入 token Window Conveyor: Feed Tokens One at a Time

容量 ≠ 记忆 capacity ≠ memory
窗口内 Visible
0/6
tokens
已掉出 Dropped
0
不再可见 no longer visible
注意力工作量 Attention work
0
n2 pairs

03 把“窗口”拆成 4 个事实 Four Facts Hidden Inside “Window”

讲容量,不讲选材 capacity, not curation
PART 01

单位是 token Measured in tokens

窗口按 token 计数,不按汉字、单词或文件页数计数。 Capacity is counted in tokens, not characters, words, or document pages.

PART 02

范围有上限 The range is bounded

超限信息必须被截断、压缩或拒绝,不能假装仍在本次计算里。 Overflow must be truncated, compressed, or rejected; it cannot remain in the same computation by wishful thinking.

PART 03

更大有成本 Larger has a cost

本页用 n2 对比注意力配对量;这是教学尺度,不代表具体模型账单。 This lesson uses n2 attention pairs for intuition; it is not a bill for any specific model.

PART 04

更大不等于更可靠 Larger is not more reliable

无关 token 也会占位置。选择放什么属于 S6 上下文工程,而不是本页职责。 Irrelevant tokens also take space. Choosing what belongs is context engineering in S6, not this page’s job.

04 最小机制:只保留末尾 C 张 Minimal Mechanism: Keep Only the Last C Tokens

sliding window
visible = tokensmax(0,n−C)…n
n 是已送入总数,C 是窗口容量。拖动容量滑块即可验证可见切片怎样改变。 n is the number fed and C is capacity. Move the capacity slider to verify how the visible slice changes.
新 token 进入 New token enters 总数 n 增加 total n grows
超过容量 C n exceeds C 最左侧被截去 left edge is trimmed
本次计算只见切片 Only the slice is visible 掉出不等于已记住 dropped does not mean remembered

05 边界实验:用噪声挤掉原始任务 Boundary Test: Push the Task Out with Noise

主动制造失败 Create a failure

让“只读”从左侧掉出去 Make “read only” fall off the left edge

固定容量为 4,再塞入整条序列。原始任务会离开窗口;这证明窗口不是永久记忆。 Set capacity to four and feed the full stream. The original task leaves the window, proving that a context window is not permanent memory.

尚未执行。原始任务 token 仍未掉出。 Not run yet. The task token has not fallen out.
进过窗口的信息就会长期记住。 Anything that entered the window becomes long-term memory. → ✓ 窗口只描述本次计算可见范围。 The window only describes visibility in this computation.
窗口越大,答案一定越可靠。 A larger window always makes answers more reliable. → ✓ 更大也会容纳更多噪声并增加工作量。 More capacity can hold more noise and require more work.
窗口页应决定哪些资料值得放。 A window lesson should decide which material belongs. → ✓ S3 讲窗口是什么;S6 讲往里放什么。 S3 explains the window; S6 explains what to put inside.
06 · 一句话带走 06 · One line to keep

上下文窗口是一次计算能看见的 token 容量;超限 token 会掉出,而更大容量只意味着能装更多,不保证记得更久或用得更好。 A context window is the token capacity visible to one computation: overflow falls out, and a larger window means more fits—not that it is remembered longer or used better.