首页 / 术语表 / 上下文窗口
什么是上下文窗口(Context Window)?
上下文窗口是 LLM 在单次请求中可处理的最大 token 数量(输入与输出之和)。现代模型范围从 4K 到 200 万 token 不等。osFoundry 目录为每个模型列出了其上下文窗口大小。
详细说明
Token 是子词单元;英文平均每个 token 约 3 至 4 个字符。128K 上下文窗口大约可容纳 10 万词。窗口包括系统提示、对话历史、检索到的上下文以及模型生成的回复——每一部分都会计入上限。
更大的窗口可塞入更多上下文,但每次请求成本更高且收益递减——超过 50K 至 100K 后质量通常会下降。RAG 等策略只检索相关分块,而不是把全部内容塞进去。
osFoundry 如何处理上下文窗口(Context Window)
osFoundry 的知识库 + RAG 流水线针对每个查询只检索相关分块,让上下文窗口保持聚焦。如果需要更大窗口,您也可以从目录中挑选具备更大窗口的模型。
常见问题
How many characters fit in a 128 K context window?
Roughly 100,000 English words, or about 100,000 Japanese characters — tokenizer-dependent. Languages with lower tokenizer efficiency consume the window faster for the same content.
What happens when I exceed the context window?
The overflow is truncated, or the tool silently summarizes/drops older history. Whether you get an error or silent loss depends on the implementation — missing middle topics in long-meeting summaries is the classic symptom.
Is a bigger context window always better?
A larger cap is more flexible, but long inputs cost more, respond slower, and are prone to lost-in-the-middle recall gaps. Retrieving only the relevant chunks (chunking/RAG) is often more reliable than stuffing everything in.
相关术语
相关功能