我的征尘是星辰大海。。。
The dirt and dust from my pilgrimage forms oceans of stars...
-------当记忆的篇章变得零碎,当追忆的图片变得模糊,我们只能求助于数字存储的永恒的回忆
作者:黄教授
手机视频列表
从第一性原理分析大模型两个瓶颈
视频
音频
原始脚本
从第一性原理拆解,大模型两大瓶颈为何难以逾越?当我们讨论 Transformer 大模型的局限性时,始终绕不开两个核心瓶颈,上下文长度瓶颈与串行生成瓶颈。 很多人好奇,这些瓶颈是 Transformer 架构的专属问题?还是所有追求理解与生成人类语言的模型都躲不开的本质难题?要回答这个问题,不能只看技术细节,更需要用第一性原理,从问题的本质需求出发,拆解背后的数学逻辑与认知规律,才能明白他们为何在可预见的将来难以被彻底克服。 一,先明确我们要解决的两个瓶颈到底是什么?在深入原理前,必须先清晰界定讨论的对象。 这两个瓶颈并非抽象概念,而是直接影响模型能力的现实约束。 一、上下文长度瓶颈,看得远为何要付出天价成本?Transformer 的核心机制是自注意力,Self-Attention。 要理解一句话的含义,每个词 Token 都需要看到其他所有比如,他昨天去超市买了它,今天才发现坏了。 中。 它必须关联到超市买的东西才能理解。 这种全词交互的需求直接导致了计算复杂度与上下文长度 n 成平方关系,O N 平方。 当上下文长度 n 等于1000时,需要计算的词与词关联次数是1000×1000等 等于11百万。 当N提升到1万,次数会暴涨到11亿。 若想支持10万上下文,次数会达到11百亿。 这不是线性增加,而是多项市集的陡增。 即便算力每年翻倍,N的提升速度依然会被 O N 平方的复杂度拖后腿。 算力翻10倍,N最多只能提升3倍。 3平方约等于10,这就是看得远的代价。 二、串行生成瓶颈,说得出为何不能并行加速。 大模型生成文本时,始终是一个词接一个词的输出。 比如写文章时,先出京,再出天,再出天气。 这背后是自回归,Auto Regressive 机制。 每次生成下一个词,模型都需要参考已经生成的所有词,加输入的上下文。 重新经计算整个词汇表,比如10万词的概率分布,只有确定了今天才能判断下一个词更可能是天气而非吃饭。 只有确定了今天天气才能判断下一个词更可能是晴朗而非电脑。 这种后一个词依赖前一个词的逻辑导致生成过程必须是串行的,无法像同时计算100个独立数据那样并行生成10个词,因为每个词的概率都被前序词动态影响。 哪怕用再强的并行算力,也无法跳过先算前一个词的步骤。 二,第一性原理拆解,瓶颈的本质是认知需求与计算规律的冲突。 这两个瓶颈之所以难以逾越,并非因为 Transformer 架构不够先进,而是因为它们根植于让模型理解生成语言的本质需求。 只要模型想实现类人类的语言认知,就绕不开两个两个底层矛盾。 这是数学规律与认知逻辑决定的第一性约束。 一、上下文瓶颈。 全局理解必然伴随复杂度代价,语言的核心特点是全局性。 关联,一句话的含义不是单个词的简单叠加,而是所有词通过语法语义连接形成的整体。 比如小明告诉小红,他的书落在教室了。 他到底指小明还是小红?必须看小明、小红、书、教室的全局关系才能确定。 这是人类理解语言的基本逻辑,也是模型要实现准确理解的最低要求。 要满足这种全局关联需求,模型必须处理任意两 两个词之间的关系,而处理所有两两关系的数学复杂度最低就是 ON²。 这不是 Transformer 的选择,而是全局关联的必然结果,哪怕换成非 Transformer 架构,比如早期的 RNN,要实现全局理解,要么接受 ON²的复杂度。 比如用双向 RNN 加权连接层,要么牺牲关联范围。 比如普通 RNN 只能关注最近的几个词。 现在的稀疏注意力、滑动窗口等优化,本质是用局部关联替代全局关联。 比如只让每个词看前后500个词,代价是丢失长距离依赖。 比如1000词外的他无法关联到超市买的东西。 结论,只要想保留全局理解语言的能力,就必须付出至少 ON²的复杂度。 这是全局关联认知需求与计算复杂度的本质矛盾,与架构无关。 除非我们接受模型只能理解局部语义,否则无法彻底消除这个瓶颈。 只能通过技术优化缓解,比如让复杂度从 ON²降到 ON LOG N。 嗯,但无法消除。 二、串行生成瓶颈。 语义连贯必然依赖序列依赖,语言生成的核心要求是语义连贯性。 人类说话写作时,每一句话都有逻辑流向。 我早上起床后,下一句更可能是刷牙洗脸,而非发射火箭。 因为今天下雨后,下一句更可能是所以带伞,而非所以吃火锅。 这种连贯性的本质是语义的序列依赖,后一个内容必须在前一个内容的逻辑框架内生成。 而序列依赖的数学本质是动态条件概率,下一个词的概率,批词,必须依赖于前序所有词的条件分布,批词词一,词二二,词。 这种依赖前序结果的计算,在数学上就是串行计算,因为前序结果词一到词。 是计算后续结果词的必要条件,无法并行。 哪怕尝试非自回归生成,比如一次生成多个词,也必须付出代价。 要么牺牲连贯性,比如一次生成今天天气电脑,语义断裂。 要么通过多轮修正,先并行生成粗糙结果,再逐词修正。 本质是把串行步骤隐藏到修正环节,并没有真正实现并行生成 结论,只要想保证生成内容的语义连贯,就必须保留序列依赖,而序列依赖必然导致串行生成。 这是语义连贯需求与并行计算规律的本质矛盾。 除非我们接受生成的文本逻辑混乱,否则无法绕过串行瓶颈。 三、为何可预见的将来难以突破?规律的约束无捷径,很多人期待用更先进的架构或更强的算力突破瓶颈。 但从第一性原理看,这两个瓶颈的核心是认知需求与计算规律的冲突,而非技术不够强。 算力提升只能延缓上下文瓶颈,比如 如算力翻100倍,N 能从1万提升到10万,但无法改变 N 增大时复杂度陡增的规律。 只要 N 持续提升,总有一天算力会跟不上 O N 平方的消耗。 架构创新只能优化串行瓶颈,比如让每个词的生成速度变快,但无法改变语音依赖需要串行的 逻辑,就像人类无法同时说出10个连贯的词,模型也无法同时生成10个逻辑连贯的词。 简单来说,这两个瓶颈不是技术问题,而是目标与规律的匹配问题。 我们想让模型像人一样理解长文本,说连贯的话,就必须接受理解长文本需要高复杂度。 说连贯的话需要串行的现实。 总结,瓶颈不是缺陷,而是目标的必然代价。 Transformer 的两个瓶颈,本质是我们对模型的认知需求与数学计算规律之间的平衡。 想让模型看得远,全局理解,就必须接受复杂度高。 想让模型说的顺,语义连贯,就必须接受串行生成。 未来的技术可能会让瓶颈更宽松,比如让上下文长度达到100万,让生成速度提升10倍。 但只要我们对语言理解与生成的核心需求不变,这两个瓶颈就不会被彻底克服。 它们不是 Transformer 的专属问题,而是所有追求类人类语言智能的模型都需要面对的本是约束。
修正脚本
从第一性原理拆解,大模型两大瓶颈为何难以逾越?当我们讨论 Transformer 大模型的局限性时,始终绕不开两个核心瓶颈,上下文长度瓶颈与串行生成瓶颈。 很多人好奇,这些瓶颈是 Transformer 架构的专属问题?还是所有追求理解与生成人类语言的模型都躲不开的本质难题?要回答这个问题,不能只看技术细节,更需要用第一性原理,从问题的本质需求出发,拆解背后的数学逻辑与认知规律,才能明白它们为何在可预见的将来难以被彻底克服。 一,先明确我们要解决的两个瓶颈到底是什么?在深入原理前,必须先清晰界定讨论的对象。 这两个瓶颈并非抽象概念,而是直接影响模型能力的现实约束。 一、上下文长度瓶颈,看得远为何要付出天价成本?Transformer 的核心机制是自注意力,Self-Attention。 要理解一句话的含义,每个词 Token 都需要看到其他所有词,比如“他昨天去超市买了它,今天才发现坏了”中,它必须关联到超市买的东西才能理解。 这种全词交互的需求直接导致了计算复杂度与上下文长度 n 成平方关系,O N 平方。 当上下文长度 n 等于1000时,需要计算的词与词关联次数是1000×1000等于一百万。 当N提升到1万,次数会暴涨到一亿。 若想支持10万上下文,次数会达到一百亿。 这不是线性增加,而是多项式的陡增。 即便算力每年翻倍,N的提升速度依然会被 O N 平方的复杂度拖后腿。 算力翻10倍,N最多只能提升3倍。 3平方约等于10,这就是看得远的代价。 二、串行生成瓶颈,说得出为何不能并行加速。 大模型生成文本时,始终是一个词接一个词的输出。 比如写文章时,先出今,再出天,再出天气。 这背后是自回归,Auto Regressive 机制。 每次生成下一个词,模型都需要参考已经生成的所有词,加输入的上下文。 重新计算整个词汇表,比如10万词的概率分布,只有确定了今天才能判断下一个词更可能是天气而非吃饭。 只有确定了今天天气才能判断下一个词更可能是晴朗而非电脑。 这种后一个词依赖前一个词的逻辑导致生成过程必须是串行的,无法像同时计算100个独立数据那样并行生成10个词,因为每个词的概率都被前序词动态影响。 哪怕用再强的并行算力,也无法跳过先算前一个词的步骤。 二,第一性原理拆解,瓶颈的本质是认知需求与计算规律的冲突。 这两个瓶颈之所以难以逾越,并非因为 Transformer 架构不够先进,而是因为它们根植于让模型理解生成语言的本质需求。 只要模型想实现类人类的语言认知,就绕不开两个底层矛盾。 这是数学规律与认知逻辑决定的第一性约束。 一、上下文瓶颈。 全局理解必然伴随复杂度代价,语言的核心特点是全局性关联,一句话的含义不是单个词的简单叠加,而是所有词通过语法语义连接形成的整体。 比如小明告诉小红,他的书落在教室了。 他到底指小明还是小红?必须看小明、小红、书、教室的全局关系才能确定。 这是人类理解语言的基本逻辑,也是模型要实现准确理解的最低要求。 要满足这种全局关联需求,模型必须处理任意两个词之间的关系,而处理所有两两关系的数学复杂度最低就是 ON²。 这不是 Transformer 的选择,而是全局关联的必然结果,哪怕换成非 Transformer 架构,比如早期的 RNN,要实现全局理解,要么接受 ON²的复杂度。 比如用双向 RNN 加权连接层,要么牺牲关联范围。 比如普通 RNN 只能关注最近的几个词。 现在的稀疏注意力、滑动窗口等优化,本质是用局部关联替代全局关联。 比如只让每个词看前后500个词,代价是丢失长距离依赖。 比如1000词外的他无法关联到超市买的东西。 结论,只要想保留全局理解语言的能力,就必须付出至少 ON²的复杂度。 这是全局关联认知需求与计算复杂度的本质矛盾,与架构无关。 除非我们接受模型只能理解局部语义,否则无法彻底消除这个瓶颈。 只能通过技术优化缓解,比如让复杂度从 ON²降到 ON LOG N,但无法消除。 二、串行生成瓶颈。 语义连贯必然依赖序列依赖,语言生成的核心要求是语义连贯性。 人类说话写作时,每一句话都有逻辑流向。 我早上起床后,下一句更可能是刷牙洗脸,而非发射火箭。 因为今天下雨后,下一句更可能是所以带伞,而非所以吃火锅。 这种连贯性的本质是语义的序列依赖,后一个内容必须在前一个内容的逻辑框架内生成。 而序列依赖的数学本质是动态条件概率,下一个词的概率必须依赖于前序所有词的条件分布:词一、词二……词i。 这种依赖前序结果的计算,在数学上就是串行计算,因为前序结果词一到词i是计算后续结果词的必要条件,无法并行。 哪怕尝试非自回归生成,比如一次生成多个词,也必须付出代价。 要么牺牲连贯性,比如一次生成今天天气电脑,语义断裂。 要么通过多轮修正,先并行生成粗糙结果,再逐词修正。 本质是把串行步骤隐藏到修正环节,并没有真正实现并行生成。结论,只要想保证生成内容的语义连贯,就必须保留序列依赖,而序列依赖必然导致串行生成。 这是语义连贯需求与并行计算规律的本质矛盾。 除非我们接受生成的文本逻辑混乱,否则无法绕过串行瓶颈。 三、为何可预见的将来难以突破?规律的约束无捷径,很多人期待用更先进的架构或更强的算力突破瓶颈。 但从第一性原理看,这两个瓶颈的核心是认知需求与计算规律的冲突,而非技术不够强。 算力提升只能延缓上下文瓶颈,比如算力翻100倍,N 能从1万提升到10万,但无法改变 N 增大时复杂度陡增的规律。 只要 N 持续提升,总有一天算力会跟不上 O N 平方的消耗。 架构创新只能优化串行瓶颈,比如让每个词的生成速度变快,但无法改变序列依赖需要串行的逻辑,就像人类无法同时说出10个连贯的词,模型也无法同时生成10个逻辑连贯的词。 简单来说,这两个瓶颈不是技术问题,而是目标与规律的匹配问题。 我们想让模型像人一样理解长文本,说连贯的话,就必须接受理解长文本需要高复杂度。 说连贯的话需要串行的现实。 总结,瓶颈不是缺陷,而是目标的必然代价。 Transformer 的两个瓶颈,本质是我们对模型的认知需求与数学计算规律之间的平衡。 想让模型看得远,全局理解,就必须接受复杂度高。 想让模型说得顺,语义连贯,就必须接受串行生成。 未来的技术可能会让瓶颈更宽松,比如让上下文长度达到100万,让生成速度提升10倍。 但只要我们对语言理解与生成的核心需求不变,这两个瓶颈就不会被彻底克服。 它们不是 Transformer 的专属问题,而是所有追求类人类语言智能的模型都需要面对的本质约束。
英文翻译
Let’s break it down from first principles: Why are the two major bottlenecks of large models so hard to overcome? When we discuss the limitations of Transformer large models, two core bottlenecks always come up: the context length bottleneck and the sequential generation bottleneck. Many people are curious: Are these bottlenecks unique to the Transformer architecture? Or are they fundamental challenges that any model aiming to understand and generate human language must face? To answer this, we cannot simply look at technical details; we need to use first principles—starting from the essential demands of the problem—to deconstruct the underlying mathematical logic and cognitive patterns, in order to understand why they are unlikely to be fully overcome in the foreseeable future. First, let’s clarify exactly what these two bottlenecks are. Before diving into the principles, we must clearly define what we are discussing. These two bottlenecks are not abstract concepts; they are real constraints that directly affect model capabilities. 1. Context Length Bottleneck: Why does seeing far come at such a high cost? The core mechanism of Transformer is self-attention. To understand the meaning of a sentence, every token needs to see all other tokens. For example, in “He went to the supermarket and bought it yesterday, but only realized it was broken today,” the word “it” must be linked to the item bought at the supermarket to be understood. This need for full-word interaction directly causes the computational complexity to be quadratic with respect to the context length n: O(n²). When the context length n = 1000, the number of word-to-word associations to compute is 1000 × 1000 = 1 million. When n increases to 10,000, the number skyrockets to 100 million. To support a context of 100,000, the number reaches 10 billion. This is not linear growth; it is a steep polynomial increase. Even if computing power doubles every year, the rate of increase in n is still dragged down by the O(n²) complexity. If computing power increases by 10 times, n can only increase by about 3 times (since 3² ≈ 10). That is the price of seeing far. 2. Sequential Generation Bottleneck: Why can’t generation be parallelized? When large models generate text, they always output one word at a time. For example, when writing a sentence, they first output “today,” then “weather,” then “is.” This is driven by the auto-regressive mechanism. Each time the next word is generated, the model must refer to all previously generated words plus the input context, and recompute the probability distribution over the entire vocabulary (say 100,000 words). Only after determining “today” can it be more likely that the next word is “weather” rather than “dinner.” Only after determining “today’s weather” can the next word more likely be “sunny” rather than “computer.” This dependency—where each subsequent word relies on the previous word—means that the generation process must be sequential. It is impossible to generate 10 words in parallel like simultaneously computing 100 independent data points, because the probability of each word is dynamically influenced by its predecessors. Even with massive parallel computing power, you cannot skip the step of first computing the previous word. 2. Deconstruction from First Principles: The essence of the bottlenecks is the conflict between cognitive needs and computational laws. These two bottlenecks are difficult to overcome not because the Transformer architecture is not advanced enough, but because they are rooted in the essential requirements for the model to understand and generate human language. As long as the model aims to achieve human-like language cognition, it cannot escape two fundamental contradictions. These are first-principle constraints determined by mathematical laws and cognitive logic. 1) Context Bottleneck: Global understanding inevitably comes with a complexity cost. A core feature of language is global relevance: the meaning of a sentence is not a simple sum of individual words, but a whole formed by the syntactic and semantic connections among all words. For example, in “Xiao Ming told Xiao Hong that his book was left in the classroom,” does “his” refer to Xiao Ming or Xiao Hong? This can only be determined by looking at the global relationship among Xiao Ming, Xiao Hong, the book, and the classroom. This is the basic logic of human language understanding, and also the minimum requirement for a model to achieve accurate understanding. To satisfy this global relevance requirement, the model must handle relationships between any two words. The minimal mathematical complexity for processing all pairwise relationships is O(n²). This is not a choice of Transformer; it is an inevitable result of global relevance. Even if we replace it with a non-Transformer architecture, such as early RNNs, to achieve global understanding, we either accept O(n²) complexity (e.g., by using bidirectional RNNs with weighted connection layers) or sacrifice the range of relevance (e.g., ordinary RNNs can only focus on the most recent few words). Current optimizations like sparse attention and sliding windows essentially replace global relevance with local relevance—for example, letting each word only see the 500 words before and after it. The cost is losing long-distance dependencies: for instance, a word 1000 positions away cannot be linked to the item bought at the supermarket. Conclusion: As long as we want the model to retain the ability to globally understand language, we must pay at least O(n²) complexity. This is an inherent contradiction between the cognitive need for global relevance and computational complexity, independent of architecture. Unless we accept that the model can only understand local semantics, this bottleneck cannot be completely eliminated. It can only be mitigated through technical optimizations, such as reducing complexity from O(n²) to O(n log n), but it cannot be eliminated. 2) Sequential Generation Bottleneck: Semantic coherence necessarily relies on sequential dependency. The core requirement of language generation is semantic coherence. When humans speak or write, every sentence has a logical flow. For example, after “I got up this morning,” the next sentence is more likely to be “I brushed my teeth” than “I launched a rocket.” After “It’s raining today,” the next sentence is more likely to be “So I brought an umbrella” than “So I’m eating hotpot.” The essence of this coherence is sequential dependency in semantics: the next content must be generated within the logical framework of the previous content. The mathematical essence of sequential dependency is dynamic conditional probability: the probability of the next word must depend on the conditional distribution of all previous words (word1, word2, …, wordi). This kind of calculation dependent on previous results is, mathematically, sequential computation, because the previous results (word1 to wordi) are necessary conditions for computing the subsequent result—they cannot be parallelized. Even if we try non-autoregressive generation (e.g., generating multiple words at once), we must pay a price. Either we sacrifice coherence (e.g., generating “today weather computer” without semantic continuity) or we use multiple rounds of revision—first generating a rough result in parallel, then correcting word by word. Essentially, this hides the sequential steps in the revision process and does not truly achieve parallel generation. Conclusion: As long as we want to ensure the semantic coherence of generated content, we must retain sequential dependency, and sequential dependency inevitably leads to sequential generation. This is an inherent contradiction between the need for semantic coherence and the laws of parallel computation. Unless we accept logically incoherent generated text, we cannot bypass the sequential bottleneck. 3. Why is it hard to break through in the foreseeable future? Constraints of laws leave no shortcuts. Many people hope to break through these bottlenecks with more advanced architectures or stronger computing power. But from the first-principle perspective, the core of these two bottlenecks is the conflict between cognitive needs and computational laws, not insufficient technology. Increasing computing power can only postpone the context bottleneck. For example, if computing power increases by 100 times, n can increase from 10,000 to 100,000, but it cannot change the law that complexity skyrockets as n increases. As long as n keeps growing, there will come a time when computing power falls behind the O(n²) consumption. Architectural innovation can only optimize the sequential bottleneck, such as making each word generation faster, but it cannot change the logic that sequential dependency requires serial processing—just as humans cannot utter 10 coherent words simultaneously, a model cannot generate 10 logically coherent words at the same time. In simple terms, these two bottlenecks are not technical problems; they are problems of matching goals with laws. If we want the model to understand long texts like a human and speak coherently, we must accept that understanding long texts requires high complexity and speaking coherently requires sequential processing. Summary: Bottlenecks are not defects but the inevitable cost of the goal. The two bottlenecks of Transformer are essentially a balance between our cognitive demands on models and the laws of mathematical computation. If we want the model to see far (global understanding), we must accept high complexity. If we want the model to speak smoothly (semantic coherence), we must accept sequential generation. Future technology may make these bottlenecks more forgiving—for instance, extending context length to 1 million or increasing generation speed by 10 times. But as long as our core demands for language understanding and generation remain unchanged, these two bottlenecks will never be completely overcome. They are not exclusive to Transformer but are fundamental constraints that any model pursuing human-like language intelligence must face.
back to top