我的征尘是星辰大海。。。
The dirt and dust from my pilgrimage forms oceans of stars...
-------当记忆的篇章变得零碎,当追忆的图片变得模糊,我们只能求助于数字存储的永恒的回忆
作者:黄教授
手机视频列表
关于大模型上下文长度限制及其突破方向的讨论
视频
音频
原始脚本
关于大模型上下前视及突破方向的讨论备忘录。 一、大模型上下文限制的核心根源。 一、 Transformer 架构的先天约束,位置嵌入的 Positional Encoding 的固定性 Transformer,需通过位置嵌入为 token 添加顺序信息,该嵌入在训练时已设定固定最大长度,如512。 如4096 token 超出长度的 token 无法获得有效位置信息,导致模型性能骤降。 注意力机制的计算复杂度,自注意力需计算每个 token 与所有 token 的关联权重,计算量与上下文长度的平方成正比,L 扩大10倍,则计算量扩大100倍。 当前硬件 GPU、TPU 无法 支撑超大 L 的实时计算,这是上下文受限的根本瓶颈。 二,与人类认知及计算机运行的共性规律。 人类认知的天然局限,人类注意力与短期记忆类似有限上下文窗口,无法同时处理海量细节信息,需通过抽象概念简化思考,若强行记忆所有细节会导致逻辑割裂、重点丢失。 运行的底层逻辑。 计算机依赖栈存储当前上下文,栈空间有限,需通过上下文切换。 count switch 点 h,将暂不使用的呛式房暂存如存入内存硬盘,再切换至新任务。 这与大模型上下文受限的本质逻辑一致。 二、突破上下文限制的核心思路。 一、语义抽象与符号压缩,提升上下文信息密度。 新逻辑,将底层低语义密度,如蒸 起机车四个汉字 token 抽象为高语义密度的符号。 如 A 代表蒸汽机车,一个符号 token 用更少的位置槽位承载更核心的逻辑,间接实现上下文扩容。 实际价值,例如描述蒸汽机车、内燃机车、电力机车的技术迭代,底层需12个汉字 token ,符号化 后仅需 A、B、C 三个 token,上下文占用减少75%,且保留核心逻辑关系,避免细节挤占上下文空间。 类比场景,类似 HTML 超链接、维基百科概念。 对其讨论前默认双方理解基础概念,无需反复展开解释,通过预共识减少冗余信息。 二、分层处理与工具协作,拆分上下文处理流程,检索增强生成,将长文本拆分为核心段落块,通过检索筛选与问题相关的高价值块作为上下文输入模型,本质是用检索做初步抽象,过滤无效 Token,避免全量长文本直接输入。 分层注意,英文,Hierarchical Tension。 对长文本做段落级、句子级、词级分层编码,模型先关注段落间的高层逻,如 A、B 的迭代关系,再深入细节,避免陷入词级平层计算导致的逻辑割裂。 多轮交互补全,针对问题未说完,如5000字题干超上下文。 或需分布共识,如讨论 AI 优化编程,需先确认场景的情况。 通过多轮交互,先补全信息,对其认知,再生成答案,而非单词强行输出。 三、能力落地的分工,模型内生 vs Web 工具。 一、当前主流方案,外部工具把关。 加大模型聚焦认知,外部工具层负责规则化,低算力成本的判断。 如文本长度检测,超过上方阈值时提示请分段输入。 概念完整性判断,用小模型关键词匹配,识别未收录的冷门术语,触发 RAG 检索补充概念解释,逻辑完整性检 如发现题干条件缺失,如求 A 加 B,却未给 B 值,直接提示补充信息。 大模型层核心认知,专注理解补全后的信息,生成逻辑答案,无需分心处理流程决策,避免算力浪费在非语义理解任务上。 二、长期发展趋势。 基础认知内生加复杂流程外挂,模型内生能力沉淀,通过预训练,加入不完整文本识别任务和对齐训练,让模型知道不懂就问,使大模型逐渐具备判断问题完整性、识别自身能力边界的基础认知。 如主动说,该概念需补充解释才能回答。 外部工具持续负责复杂调度,调用哪个工具,RAG 计算器,找哪个细分专家模型等流程性决策,仍由外部工具层承担。 因规则加轻量工具比大模型重复思考决策更高效稳定。 四,关键结论。 一,大模型上下文限制的核心是 Transformer 架构的平方。 及计算复杂度与硬件算力上限,而非此 表大小、Token 嵌入维度等参数。 二、突破限制的核心方向是提升信息密度,抽象符号和优化处理流程,分层加工具。 这与人类认知规律抽象思考、计算机运行逻辑上下篇切换高度契合。 三、能力落地需分工协作,当前靠外部工具做流 流程把关,长期大模型内生基础认知能力,最终实现模型负责思考,工具负责执行的高效模式。 既解决上下文限制,又保证交互的灵活性与准确性。
修正脚本
关于大模型上下文限制及突破方向的讨论备忘录。 一、大模型上下文限制的核心根源。 一、 Transformer 架构的先天约束,位置嵌入的 Positional Encoding 的固定性:Transformer,需通过位置嵌入为 token 添加顺序信息,该嵌入在训练时已设定固定最大长度,如512。 超出长度的 token 无法获得有效位置信息,导致模型性能骤降。 注意力机制的计算复杂度,自注意力需计算每个 token 与所有 token 的关联权重,计算量与上下文长度的平方成正比,L 扩大10倍,则计算量扩大100倍。 当前硬件 GPU、TPU 无法支撑超大 L 的实时计算,这是上下文受限的根本瓶颈。 二、与人类认知及计算机运行的共性规律。 人类认知的天然局限,人类注意力与短期记忆类似有限上下文窗口,无法同时处理海量细节信息,需通过抽象概念简化思考,若强行记忆所有细节会导致逻辑割裂、重点丢失。 运行的底层逻辑。 计算机依赖栈存储当前上下文,栈空间有限,需通过上下文切换。 count switch 时,将暂不使用的栈数据暂存到存入内存硬盘,再切换至新任务。 这与大模型上下文受限的本质逻辑一致。 二、突破上下文限制的核心思路。 一、语义抽象与符号压缩,提升上下文信息密度。 新逻辑,将底层低语义密度,如蒸汽机车四个汉字 token 抽象为高语义密度的符号。 如 A 代表蒸汽机车,一个符号 token 用更少的位置槽位承载更核心的逻辑,间接实现上下文扩容。 实际价值,例如描述蒸汽机车、内燃机车、电力机车的技术迭代,底层需12个汉字 token ,符号化 后仅需 A、B、C 三个 token,上下文占用减少75%,且保留核心逻辑关系,避免细节挤占上下文空间。 类比场景,类似 HTML 超链接、维基百科概念。 对其讨论前默认双方理解基础概念,无需反复展开解释,通过预共识减少冗余信息。 二、分层处理与工具协作,拆分上下文处理流程,检索增强生成,将长文本拆分为核心段落块,通过检索筛选与问题相关的高价值块作为上下文输入模型,本质是用检索做初步抽象,过滤无效 Token,避免全量长文本直接输入。 分层注意力,英文,Hierarchical Tension。 对长文本做段落级、句子级、词级分层编码,模型先关注段落间的高层逻辑,如 A、B 的迭代关系,再深入细节,避免陷入词级平层计算导致的逻辑割裂。 多轮交互补全,针对问题未说完,如5000字题干超上下文。 或需分步共识,如讨论 AI 优化编程,需先确认场景的情况。 通过多轮交互,先补全信息,对齐认知,再生成答案,而非单轮强行输出。 三、能力落地的分工,模型内生 vs Web 工具。 一、当前主流方案,外部工具把关。 让大模型聚焦认知,外部工具层负责规则化、低算力成本的判断。 如文本长度检测,超过上方阈值时提示请分段输入。 概念完整性判断,用小模型关键词匹配,识别未收录的冷门术语,触发 RAG 检索补充概念解释,逻辑完整性检测:如发现题干条件缺失,如求 A 加 B,却未给 B 值,直接提示补充信息。 大模型层核心认知,专注理解补全后的信息,生成逻辑答案,无需分心处理流程决策,避免算力浪费在非语义理解任务上。 二、长期发展趋势。 基础认知内生加复杂流程外挂,模型内生能力沉淀,通过预训练,加入不完整文本识别任务和对齐训练,让模型知道不懂就问,使大模型逐渐具备判断问题完整性、识别自身能力边界的基础认知。 如主动说,该概念需补充解释才能回答。 外部工具持续负责复杂调度,调用哪个工具,RAG 计算器,找哪个细分专家模型等流程性决策,仍由外部工具层承担。 因规则加轻量工具比大模型重复思考决策更高效稳定。 四、关键结论。 一、大模型上下文限制的核心是 Transformer 架构的平方计算复杂度与硬件算力上限,而非词表大小、Token 嵌入维度等参数。 二、突破限制的核心方向是提升信息密度,抽象符号和优化处理流程,分层加工具。 这与人类认知规律抽象思考、计算机运行逻辑上下文切换高度契合。 三、能力落地需分工协作,当前靠外部工具做流程把关,长期大模型内生基础认知能力,最终实现模型负责思考,工具负责执行的高效模式。 既解决上下文限制,又保证交互的灵活性与准确性。
英文翻译
**Memorandum on Discussion of Large Model Context Limitations and Breakthrough Directions** **I. Core Roots of Large Model Context Limitations** **1. Inherent Constraints of the Transformer Architecture** - **Fixedness of Positional Encoding**: Transformers require positional embeddings to add sequential information to tokens. These embeddings have a fixed maximum length during training (e.g., 512). Tokens exceeding this length cannot obtain effective positional information, leading to a sharp decline in model performance. - **Computational Complexity of Attention Mechanism**: Self-attention needs to compute correlation weights between each token and all others. The computation scales quadratically with context length (L): if L increases 10 times, computation increases 100 times. Current hardware (GPUs, TPUs) cannot support real-time computation for extremely large L, making this the fundamental bottleneck. **2. Common Patterns with Human Cognition and Computer Operation** - **Natural Limits of Human Cognition**: Human attention and short-term memory are analogous to limited context windows. We cannot process massive detailed information simultaneously and must simplify thinking through abstract concepts. Forcing memorization of all details leads to logical fragmentation and loss of focus. - **Underlying Logic of Computer Operation**: Computers rely on stacks to store current context, which have limited space. Context switching is used to temporarily store unused stack data to memory/hard disk when switching tasks. This aligns with the essential logic of large model context limitations. **II. Core Ideas for Breaking Context Limitations** **1. Semantic Abstraction and Symbolic Compression – Increasing Context Information Density** - **New Logic**: Abstract low-level, low-semantic-density tokens (e.g., the four Chinese characters for "steam locomotive") into high-semantic-density symbols (e.g., "A" representing "steam locomotive"). A single symbolic token uses fewer position slots to carry more core logic, indirectly expanding context capacity. - **Practical Value**: For describing the technical iterations of steam, internal combustion, and electric locomotives, the underlying level requires 12 Chinese-character tokens. After symbolization, only three tokens (A, B, C) are needed, reducing context usage by 75% while preserving core logical relationships and avoiding detail crowding. - **Analogy**: Similar to HTML hyperlinks or Wikipedia concept citations. Before discussing a concept, both parties default to understanding the basic concept, avoiding repeated elaboration and reducing redundant information through pre-consensus. **2. Hierarchical Processing and Tool Collaboration – Splitting Context Processing Workflow** - **Retrieval-Augmented Generation (RAG)**: Split long texts into core paragraph blocks. Retrieve and filter high-value blocks relevant to the question as context input to the model. This essentially uses retrieval for preliminary abstraction, filtering out invalid tokens and avoiding direct input of full long texts. - **Hierarchical Attention**: Encode long texts at paragraph, sentence, and word levels. The model first focuses on high-level logic between paragraphs (e.g., the iterative relationship between A and B) before delving into details, avoiding logical fragmentation from flat word-level computation. - **Multi-turn Interactive Completion**: For incomplete questions (e.g., a 5000-character prompt exceeding context), or when stepwise consensus is needed (e.g., discussing AI-optimized programming requires first confirming the scenario), use multi-turn interactions to complete information, align understanding, and then generate the answer, rather than forcing a single-turn output. **III. Division of Capability Implementation – Model Intrinsic vs. Web Tools** **1. Current Mainstream Approach: External Tools for Gatekeeping** - Let the large model focus on cognition; the external tool layer handles rule-based, low-computation-cost judgments. - *Text Length Detection*: Prompt for segmented input when exceeding a preset threshold. - *Concept Completeness Judgment*: Use small-model keyword matching to identify unrecorded niche terms, triggering RAG retrieval to supplement concept explanations. - *Logical Integrity Detection*: If a question lacks necessary conditions (e.g., "Calculate A+B" but B is not given), directly prompt for supplementary information. - **Large Model Layer (Core Cognition)**: Focus on understanding the supplemented information and generating logical answers, without needing to handle process decisions, avoiding wasting computation on non-semantic-understanding tasks. **2. Long-term Development Trend** - **Intrinsic Basic Cognition + External Complex Workflow**: - Model intrinsic capability refinement: Through pre-training, incorporate incomplete text recognition tasks and alignment training, enabling the model to "know when it doesn't know" and proactively ask for clarification. For example, directly stating, "This concept requires supplementary explanation for me to answer." - External tools continue to handle complex scheduling: Process-level decisions such as which tool to call (RAG, calculator, specific expert model) remain with the external tool layer. This is because rule-based lightweight tools are more efficient and stable than having the large model repeatedly think and decide. **IV. Key Conclusions** 1. The core of large model context limitations lies in the quadratic computational complexity of the Transformer architecture and the upper limit of hardware computing power, not parameters such as vocabulary size or token embedding dimensions. 2. The core direction for breakthrough is to increase information density (through abstract symbols) and optimize processing workflows (through hierarchical processing + tools). This aligns closely with the laws of human cognition (abstract thinking) and computer operation logic (context switching). 3. Capability implementation requires division of labor: currently, external tools handle process gatekeeping; in the long term, large models will develop intrinsic basic cognitive abilities, ultimately achieving an efficient model where the model is responsible for thinking and tools for execution. This resolves context limitations while ensuring flexibility and accuracy in interaction.
back to top