我的征尘是星辰大海。。。
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。 长度达到4096时,超出长度的 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 the Discussion of Large Model Context Limitations and Breakthrough Directions** **I. Core Root Causes of Large Model Context Limitations** **I.1 Inherent Constraints of the Transformer Architecture** - **Fixedness of Positional Encoding in Transformers**: Transformers rely on positional embeddings to add sequence information to tokens. These embeddings are pre-set with a maximum length during training (e.g., 512). When the length reaches 4096, tokens beyond that length fail to obtain valid positional information, causing a sharp decline in model performance. - **Computational Complexity of Attention Mechanism**: Self-attention must compute the relevance weights between each token and all other tokens. The computational cost scales quadratically with the context length L: if L increases by 10×, the computation increases by 100×. Current hardware (GPUs, TPUs) cannot support real-time computation for extremely large L, making this a fundamental bottleneck for context limitations. **I.2 Common Patterns with Human Cognition and Computer Operation** - **Natural Limitations of Human Cognition**: Human attention and short-term memory are essentially limited context windows that cannot process massive details simultaneously. Humans rely on abstract concepts to simplify thinking; forcing the memorization of all details leads to logical fragmentation and loss of focus. - **Underlying Logic of Computer Operation**: Computers rely on a stack to store the current context, where stack space is finite. Context switching (e.g., count switch) temporarily stores pages of inactive processes in memory or hard disk before switching to a new task. This aligns with the essential logic of large model context limitations. **II. Core Ideas for Breaking Context Limitations** **II.1 Semantic Abstraction and Symbol Compression – Increasing Context Information Density** - **New Logic**: Abstract low-semantic-density tokens (e.g., the four Chinese characters for "steam locomotive") into high-semantic-density symbols (e.g., "A" representing "steam locomotive"). One symbolic token uses fewer positional slots to carry more core logic, indirectly expanding context capacity. - **Practical Value**: For example, describing the technological evolution of steam locomotive (A), internal combustion locomotive (B), and electric locomotive (C) would require 12 Chinese-character tokens. After symbolization, only three tokens (A, B, C) are needed—a 75% reduction in context usage, preserving core logical relationships while avoiding detail crowding. - **Analogy**: Similar to HTML hyperlinks or Wikipedia concept pages. Discussion assumes both parties have a pre-understanding of basic concepts, eliminating the need for repetitive explanation and reducing redundant information via pre-consensus. **II.2 Layered Processing and Tool Collaboration – Splitting Context Processing Pipelines** - **Retrieval-Augmented Generation (RAG)**: Split long texts into core paragraph chunks. Use retrieval to filter high-value chunks relevant to the question as input to the model. Essentially, retrieval performs preliminary abstraction to filter out invalid tokens, avoiding direct input of the full long text. - **Hierarchical Attention**: Apply hierarchical encoding at paragraph, sentence, and word levels for long texts. 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 caused by flat word-level computation. - **Multi-turn Interactive Completion**: For questions that are incomplete (e.g., a 5000-character query exceeding context limits) or require stepwise consensus (e.g., discussing AI optimization for programming—first confirming the scenario), use multi-turn interactions to complete information, align understanding, and then generate answers, rather than forcing a single-turn output. **III. Division of Capability Implementation – Model Internalization vs. Web Tools** **III.1 Current Mainstream Approach: External Tools for Gatekeeping** - Let large models focus on cognition, while an external tool layer handles rule-based decisions with low computational cost. - **Text Length Detection**: Prompt "Please input in segments" when the length exceeds a set threshold. - **Concept Completeness Judgment**: Use a small model’s keyword matching to identify missing rare terms, triggering RAG to retrieve supplementary concept explanations. - **Logical Completeness Detection**: If input conditions are missing (e.g., "Find A+B" but missing value for B), immediately prompt for supplementary information. - **Large Model Layer – Core Cognition**: Focus on understanding the completed information and generating logical answers, without being distracted by process decisions, thus avoiding waste of computational resources on non-semantic understanding tasks. **III.2 Long-term Development Trends** - **Internalization of Basic Cognition + Externalization of Complex Workflows** - **Model Internal Capacity Accumulation**: Through pre-training, incorporate tasks like identifying incomplete texts and alignment training, teaching the model to ask when it doesn’t know. This gradually equips the model with basic cognition to judge problem completeness and recognize its own capability boundaries (e.g., actively stating, "This concept requires supplementary explanation to answer"). - **External Tools Continue to Handle Complex Dispatching**: Process decisions such as which tool to invoke (RAG, calculator, specialized expert model) remain handled by the external tool layer. This is because rule-based + lightweight tools are more efficient and stable than having the large model repeatedly think through decisions. **IV. Key Conclusions** 1. The core obstacle to large model context limitations is the quadratic complexity of the Transformer architecture and the upper limit of hardware computing power, not parameters like vocabulary size or token embedding dimensions. 2. The main directions for breaking limitations are increasing information density (via abstract symbols) and optimizing processing flows (layering + tools). This aligns highly 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 internalize basic cognitive abilities. The ultimate goal is an efficient pattern where the model is responsible for thinking and tools are responsible for execution—solving context limitations while ensuring interactive flexibility and accuracy.
back to top