Files
nexus/wiki/concepts/Context-Window.md

33 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Context Window"
type: concept
tags: [llm, context-window, token, embedding, rag]
last_updated: 2025-01-16
---
## Definition
Context Window上下文窗口是 LLM 或 Embedding Model 一次性处理的最大 token 数量。超过该限制的内容无法被模型感知,必须切分或截断。
## Key Numbers
- **Embedding Model**:通常 512~8192 token如 BAAI/bge 系列)
- **LLM**:差异极大,从 4KGPT-3.5)到 200K+Claude 3不等
## Practical Impact
### 对 Embedding Model
- 决定单次可 Embedding 的最大文本长度
- 超过则需 Split切分文档
### 对 LLMGeneration 阶段)
- 决定用户问题 + 检索上下文 + 系统 Prompt 的总 token 预算
- 超过则需截断(可能丢失关键信息)
## Token Estimation
- **英文**1 token ≈ 3~4 个字母
- **中文**1 token ≈ 1 个汉字
## Related Concepts
- [[Split]] — 文档需要切分以满足 Context Window 约束
- [[Embedding]] — Embedding Model 的 Context Window 限制
- [[Token]] — Context Window 的计量单位
- [[Generation]] — LLM 的 Context Window 决定最终可输入的上下文量