【外一篇:推理范式演进中的概念】

1.1 训练与推断的二分

机器学习系统存在两个核心阶段:

- 训练时间(Training Time):参数空间Θ的优化过程,目标函数为误差最小化 minL(θ;D_train)
- 推断时间(Inference Time):固定参数θ时对新样本x_test的条件分布预测p(y|x_test;θ)

大语言模型(LLM)领域的最新进展显示,通过引入思维链(CoT)机制,推断阶段的计算量(test time compute)显著增长,也收获了相应的智能提升。

1.2 逻辑学视角

推理类型 逻辑结构 确定性 典型应用
演绎 前提→必然结论 确定性 数学证明
归纳 个案→普遍规律 概率性 趋势发现
溯因 现象→最佳原因 启发式 诊断推测

Inference 对应概率模型中的推断过程,本质是大数据压缩后的经验性模式归纳。在传统的符号逻辑语境下,Reasoning 特指演绎推理的符号化过程,但考察当下的LLM推理模型,reasoning 最多只是对逻辑演绎的符号化模拟,本质上仍然是概率模型的推断(inference)生成。溯因在大模型范式下,其实现启发式推测的手段也还是大数据压缩后的经验性(逆向)模式归纳。总之,生成式AI大模型以不变应万变,各种思考推理过程一律采用下一词元预测(Next Token Prediction)形式的推断实现。生成机理不变,但 input-output 函数范式变了。

1.2 认知科学视角的函数范式

Kahneman在《思考,快与慢》中提出的双系统理论为理解大脑行为提供新视角:

- System 1(快思考):直觉式响应 input→output,对应大模型 seq2seq 函数式生成模式

output=F(input)

- System 2(慢思考):反思性推理 input→[Think]→output,体现为CoT (ChainofThought) 驱动的两阶段函数生成模式

CoT=F(input) & output=F(input+CoT)

大模型 F 的底层逻辑不变,但强化学习启动了思维链外化(CoT),搭建了应对复杂问题(input)的信息桥梁CoT,增加了大模型推断output的可解释性,最重要地,大幅提升了复杂问题的解决智能。

1.3 推理模型的计算-智能增长关系

强化学习赋能的推理模型新范式呈现的新 scaling law 是怎样的呢?并无定论,一切刚刚开始,经验法则需要时间测量。

例如,当test time compute增加10倍时:
- 推理准确率提升多少?
- 响应延迟增长多少?

`

1.4 答问

「蔡江滨l六问:早安,能否理解为cot的生成是推断inference ,根据cot生成的具体内容是推理?@wei li 」

cot+answer 的区分是人为的格式区分,对于ntp GPT 模型,它们都是概率性 inference 生成的 response

如果这个response 是针对理工类推理题目,那么这种 inference 是对于人类 reasoning,尤其是演绎( deduction)的模拟,但不是严格意义上的逻辑演绎。

如果是创作类任务,inference 中的 CoT 就是 planning/pondering 等思考过程, inference 中的answer就是生成结果,都谈不上逻辑推理。

reasoning model 这个实命名也不准确,还不如叫思考模型、思维链模型、慢思维模型、意识流模型、内心独白模型、小九九模型,总之就是 system 2,与传统的 system 1 模型比,只是多了个 CoT。

 

【原文】

生成式AI学习中容易混淆的几个术语

test time / reasoning / inference 辨析

推理模型是当前生成式AI的主流热点,带火了一个热词(buzz word)叫 test time compute,咱们就先从它谈起。

从模型开发者视角,test time(测试时间) 针对的是 training time (训练时间)。众所周知,这是机器学习的两个阶段,一个是在线,一个是离线。训练模型好比是软件开发;测试模型就是软件测试。模型测试阶段就是常说的(在线)推理(inference)阶段,所以 test time 又叫 inference time。

问题是,中文翻译“推理”对应了英文两个词:inference 和 reasoning,业内人士很多人是认为后者才是推理正解,而前者是错译(misnomer),合适的翻译是“推断”。但“推理”的一词二用已经混淆并流行了很久,社区习惯上不一定能改过来。但对于后学,还是要辨析清楚才好。

test time compute 之所以流行,是因为大模型领域近几个月的“范式转变”。社区依据预训练scaling law原来一直聚焦基座大模型的做大做强,但发现大算力带来大智能的效益递减,进入了平台期。于是把重心转移到后训练的强化学习,发展了一种称为 System 2 慢思维模式的推理模型。这种推理模型最大的特点就是运行起来慢了,原来的秒回现在是慢了几拍才回复,消耗了更多在线时间和在线推断的算力(即 test/inference time compute)。

按常理,在线计算量增加,模型运行慢了,听上去是在退步,而不是进步。但好消息是,模型对于复杂问题的处理智能飙升。时间换质量,当然应该看好这个新方向。慢思维推理模型的成就,就好比人类的三思而后行。一般而言,凡事喜欢琢磨的人,比不假思索就行动的人,更有智慧,也更加靠谱。学会了慢思维(术语叫思维链)的大模型亦是如此。

模型训练阶段,无论是预训练还是后训练,都是离线进行的,迭代循环,在改变模型的参数,模型并未成形,属于开发进行时。而 test time 说的是模型已经完成阶段。严格说,test time 是内部试运行阶段,让 QA(quality assurance)部门在上线发布前做测试。但现在谈 test time compute,已经不分内部测试还是用户使用,所以更准确的术语还是 inference time compute。

白老师说:

Inference当初译成推理就错,真的推理Reasoning不来还则罢了,这回真的来了,将错就错都难。

我说:

不知是不是下意识,以前一直有意无意地把 inference 与统计预测关联得更紧,而把 reasoning 与符号演绎(deduction)划了等号。前者是统计性的,后者是确定性的。(概率性)推断就是(统计性)预测,statistical inference。不知道受到了什么的暗中影响。

老友尼克说:

本意也差不多是这个意思。reasoning是偏deduction的。

大模型的术语最早借自于统计,统计中区分建模与inference两个阶段,大模型训练相当于建模。统计中inference翻译为“推断”。简中自媒体乱翻导致业界人也瞎起哄,好像上海电影译制厂把中国两代人的英文发音都带偏了。

但是定理证明community也用inference,好多会都以此冠名,所以很难把inference与reasoning完全隔开。相对讲,reasoning更偏deduction,最好的办法是在可能引起歧义时括号英文。

abduction在逻辑里是美国实用主义的特定叫法,源自Peirce。这个意思是把建模和inference合到一起的意思,就是Solomonoff Induction的不严谨的哲学说法。inference出错时,再去修正模型,the whole nine yard。在Kolmogorov Complexity中,inference被称为logic depth 。。。

其实,inference time 口语中也叫 running time 或 runtime,其他的近义词和关联词还有很多: test-time,real time,decoding time, prediction time, service time, execution time, on-the-fly computing time ...

 

 

【外一篇:推理范式演进中的概念

1.1 训练与推断的二分

机器学习系统存在两个核心阶段:

- 训练时间(Training Time):参数空间Θ的优化过程,目标函数为误差最小化 minL(θ;D_train)
- 推断时间(Inference Time):固定参数θ时对新样本x_test的条件分布预测p(y|x_test;θ)

大语言模型(LLM)领域的最新进展显示,通过引入思维链(CoT)机制,推断阶段的计算量(test time compute)显著增长。

1.2 逻辑学视角

推理类型 逻辑结构 确定性 典型应用
演绎 前提→必然结论 确定性 数学证明
归纳 个案→普遍规律 概率性 趋势发现
溯因 现象→最佳原因 启发式 诊断推测

在传统的符号逻辑语境下,Reasoning 特指演绎推理的符号化过程,但考察当下的LLM推理模型,reasoning 最多只是对逻辑演绎的符号化模拟,本质上仍然是概率模型的推断(inference)生成;而Inference对应概率模型中的推断过程,本质是大数据压缩后的经验性模式归纳。溯因在大模型范式下,实现启发式推测的手段也还是大数据压缩后的经验性(逆势)模式归纳。总之,生成式AI大模型以不变应万变,各种思考推理过程一律采用下一词元预测(Next Token Prediction)的 inference 实现。

1.2 认知科学维度

Kahneman在《思考,快与慢》中提出的双系统理论为理解大脑行为提供新视角:

- System 1(快思考):直觉式响应 input→output,对应大模型 seq2seq 函数式生成模式

output=F(input)

- System 2(慢思考):反思性推理 input→[Think]→output,体现为CoT(ChainofThought) 驱动的两阶段函数生成模式

CoT=F(input) & output=F(CoT)

1.3 推理模型的计算-智能增长关系

强化学习赋能的推理模型新范式呈现的新 scaling law 是怎样的呢?并无定论,一切刚刚开始,经验法则需要时间测量。

例如,当test time compute增加10倍时:
- 数学推理准确率提升多少?
- 响应延迟增长多少?

`

【相关】

 

 

 

 

思维链是大模型的符号神助攻

在人工智能发展的历史长河中,符号逻辑和神经网络一直如两条平行线,难以交汇。然而,2025年春节,DeepSeek发布的推理大模型R1揭示了一个令人惊叹的技术突破——思维链(Chain of Thought, CoT)的自主生成,其展现出的语言序列仿佛在模拟人类的符号逻辑。这一强化学习的进展或将重新定义符号逻辑与神经网络的融合方向。

DeepSeek R1 CoT 示例

符号逻辑的回归

DeepSeek R1推理模型的发布引发全球关注,其强化学习框架下自主生成的思维链展现出惊人的问题解决能力与创作能力。其核心机制仍是GPT风格的自回归下一词元预测 (next token prediction, NTP),但模型生成的中间结果——思维链,却呈现出典型的符号逻辑特征,有效模拟了人类的思考过程。

这一现象值得深思:大语言模型的本质从未改变,包括最新的推理模型,其内部运作仍是基于向量计算的条件概率。然而,为了模拟人类的符号推理,这些模型竟然学会了通过自然语言构建推理链条。更令人惊讶的是,这些符号链条确实有效,它们结合内部的词元预测机制,显著提升了模型的推理和创造能力。这是一个非常值得回味反思的技术进展。这件事的奇妙,是ChatGPT核爆以来最大的震撼。

符号与神经的无缝对接

这项奇迹的发生尤其让我们符号AI的老司机感慨。多少年来,我们心心念念地追求两条路线的融合,希望符号逻辑能在关键时刻帮助神经系统和统计模型,但一直看不到入口。忽然间,在大模型预训练进入平台期的关口,神经社区内部打开了一扇通向符号逻辑的大门,找到了一种神经与符号融合的路径。这一突破来得如此突然而有力,不能不让人既惊且叹。可惊的是,符号逻辑终于开始发力了;可叹的是,闯出这条路的还是神经社区的研发者,没有符号研究者什么事儿。

大模型就是个端到端的黑盒子,符号仅在输入输出两个端口出现。具体说,我们只能在输入端将符号“嵌入”(embedding)至高维向量空间,并在输出端通过 softmax 映射回符号,而内部的多层前馈的数据流则完全由向量运算主导,与符号逻辑无关,也很难以人类可以理解的符号来解释(因此才有专门的大模型可解释性研究)。此前所有结合符号与向量的努力都失败了,感觉这两种表示就是不同物种,无法融合。符号逻辑一直坐冷板凳,而符号本身除了作为训练数据燃料,在内部智能运作上一点也帮不了忙。

符号与概率的桥梁:CoT的奥秘

现今的推理大模型将内在“思考过程”外化为自然语言CoT,很像是模型的内心独白或意识流。模型在生成最终答案前,CoT重新嵌入系统中助力最终答案的生成。看似简单的这一过程,却在推理时成功地利用了自然语言这一符号载体,使得符号逻辑与神经网络在端口上实现了全程对接,没有一点违和或不容。

这是怎么发生的呢?一切多亏了自回归的 NTP 范式。下一词元预测的GPT生成方式,使得内部的“思维过程”可以在输出端外化为符号CoT,从而利用符号推理的形态,一步步模拟人类思维过程。

从信息论的角度看,推理大模型在 question-CoT-answer 的生成过程中,实际上构建了一条低熵的信息传输路径。相比传统的 question-answer 直接映射,这种显式的中间步骤大大降低了输入question与输出answer的信息鸿沟,显著提升了正确答案的生成概率。正如我在之前的博客(推理新范式 query+cot+answer 支持新的 scaling law 吗)中所论述的,CoT 充当了信息桥梁的角色。虽然不是严谨的符号逻辑推断过程,但它无需改变概率模型的底层运作机理,实现了对于人类推理的有效模拟。

自然语言vs形式语言:CoT的载体选择

CoT 本质是思维,语言只是载体,原理上没必要用自然语言,或任何特定的语言(例如中文,或英文)。但现在的实现方式,无路DeepSeek的R系列,还是OpenAI的O系列,就是直接用了中文或英文的思维链表示。推理模型在运行时,CoT先在输出端外化为中文或英文的符号序列,然后自回归循环运作,最终生成答案。看上去简直就是在符号与神经之间变戏法。以前何曾想到符号介入神经,还带这么玩的,内部与端口天衣无缝。

我们都要感谢DeepSeek,要不是 DeepSeek 给了这样一个开源的春节大礼包,又完全公开了自己的CoT,我们会一直蒙在鼓里,绞尽脑汁也想不明白 reasoning 这种符号逻辑,怎么就悄悄进入了神经过程。符号与向量的矛盾通过端口外化,化解于无形。

从符号逻辑的角度看,自然语言虽然老妪能解,但其精确性远逊于数学符号、形式逻辑表达式或编程语言代码。对于数理问题或逻辑推演,CoT 用这些形式语言比用自然语言显然更合适。然而,目前思维链生成采用自然语言,而不是形式语言。偶然也夹杂了一些数学符号,但思维链整体还是压倒性的使用英语或中文。R1论文中还提到他们的CoT连计算机代码都排斥在外。感觉上,这其实不是推理的正道,但可以理解其成因。CoT 是模型自主生成的序列,而据以生成的基座大模型本身,其训练数据以自然语言压倒多数。原因之二是开发者刻意追求的可解释性以及对用户的透明性,觉得自然语言大家都容易看明白。R1在设计CoT强化训练的时候,强调了格式的奖励,其中语言一致性当成了一个目标。夹杂不同语言或代码的CoT,剔除出局了。从长远来看,这未必是最明智的决策。

前景与思考

推理模型的 CoT 无疑是神经网络与符号逻辑融合的一次创新,也是近年来人工智能领域的重要里程碑。未来的CoT研究方向,可以考虑越来越多地奖励 CoT 以更加严谨的形式语言表示。至少要文理分科,文科任务(如创作)继续用自然语言做CoT的载体,这类思维过程涉及的主要是篇章规划和表达斟酌,而非严格推理;理工任务(数学、编程、逻辑等)则不同,应该训练模型尽量使用形式语言来表示CoT推理过程。当然,要做到后者,可能还要进一步加强基座模型等代码和其他形式语言的数据配比,否则 LLM也许 “憋”不出来合适的表示。

最后说一下概率模型与符号逻辑的严谨性差异。推理模型的 CoT 是推理模型的现场发挥,很多时候显得不够严谨。但其实人脑也是一样。没人能出口成章地把一个复杂数学证明一气呵成,就如同没人能一口气写出一个没有bugs的程序。严谨性都是在反复校验、修正,甚至是几代科学家前赴后继不断探究中完成的。CoT 不够严谨是拿模型的“草稿”与人类专家的定稿对比产生的印象。可以预见,对于非常复杂的问题,推理模型应该像人类一样反复校正,独立复现结果比对。这可能要指望各种推理 agents 的相互协作,以及它们与人类反馈的多层交互。

【相关】

 

再谈自然模态数据是高维空间的低维流形

这个话题实际上涉及 流形假设(Manifold Hypothesis)对抗样本攻击(Adversarial Attacks)高维几何的脆弱性


1. Normal Bundle 在高维空间的“刺猬”形象

normal bundel 是微分几何里的一个重要术语,中文翻译叫“法丛”,对于欠缺数学背景的我们来说,这个术语不好理解,但理解它对于大模型的骇客攻击与AI安全性蛮重要,咱们先看看它是个什么东西。

先破题:Normal 不是‘正常’,而是‘垂直’!

咱中文里‘法’字,来自‘法线’——就是几何里那个与曲面切线呈90度的垂直方向的线。比如你拿根筷子插进苹果,筷子方向就是苹果表面的‘法线方向’。数学家说的‘法丛’(Normal Bundle),其实就是把曲面上每一点的所有垂直方向‘打包’成捆(Bundle),像给苹果表面插满箭头的刺猬!

刺猬的类比是准确的!在 低维流形嵌入高维空间 时,法丛(Normal Bundle)确实可以被想象成“刺猬”——流形的每个点都有一个法向空间,而法丛就是把这些法向空间整体“打包”在一起。见我让Sora生成的法丛示意图:

这是我给Sora发的指令:

制作3D曲面切线与法线动态演示短视频,为科普用,数学家说的‘法丛’(Normal Bundle),其实就是把曲面上每一点的所有垂直方向‘打包’成捆(Bundle),像给苹果表面插满箭头的刺猬!

有几个关键点:

    • 在 3D 空间里,我们习惯把曲面(2D 流形)的法丛(Normal Bundle)想象成一个 1D 线性空间(即法线),所以它看起来像是一个“箭头丛”。
    • 在更高维空间中,比如一个 d 维流形嵌入到 n 维空间(d < n),它的法丛一般是 (n-d) 维的,这意味着法丛方向本身就有多个自由度,而不只是单纯的“刺”。
    • 用 3D 可视化高维流形的法丛,最常见的做法确实是让法丛的“刺”呈现出扇形的扩展感,因为高维空间的法向方向比低维空间的直观“法线”更加复杂。

所以 Sora 生成的图如果能表现出“立体感更强的刺猬形态”,或者在某些点上看到“扇面展开的刺”,就能更好地表达高维法丛的概念。

想象你是只二维蚂蚁,活在皱巴巴的树叶上。对你来说,前后左右是‘切空间’——现实世界;而上下方向就是‘法丛’——完全不可见的维度。所以‘法丛’的normal,本质是几何垂直性,不是日常说的‘正常不正常’。

数学家眼里的‘法丛’一点也不玄乎,就是垂直方向的集合。既然切空间是‘tangent’(相切的),那垂直方向就叫‘normal’(正交的),跟‘正常’没半毛钱关系!要怪就怪英文一词多义。


2. 高维空间 vs. 自然数据流形

“自然数据(文本、音频、图像、视频等)通常分布在一个远低于高维空间的流形上”,这是 流形假设(Manifold Hypothesis) 的核心观点:

    • 我们的高维数据(比如图片,通常是 256×256×3 维)并没有填满整个高维空间,而是集中在 远低于该维数的流形上
    • 这类似于:宇宙是三维的,但星星和星系主要分布在局部区域,而不是均匀填充整个宇宙。
    • 这个流形的维度一般和“人类可感知的主要变化”相关,比如在 人脸识别模型 里,所有可能的“人脸”数据分布在一个 远低于像素维度的低维流形 上,而这个流形包涵了现实中所有合理的人脸样本。这实际上是人脸与表情解耦可以work的原因。

3. 对抗样本:在法丛方向制造“幽灵数据”

既然 自然数据的流形是稀疏的,那这意味着:

    • 绝大多数可能的数据点 根本不属于自然数据的流形
    • 但在数学上,它们仍然是“合法”的高维向量,可以被构造出来,并且会落在 法丛方向 之中。

这是对抗攻击(Adversarial Attacks) 可以成立的根本原因:

    1. 模型只在自然流形上训练,它对“流形外的点”几乎没有概念。
    2. 对抗攻击就是在法丛方向上微调输入数据,让它离开流形,但仍然能欺骗模型的决策边界。
    3. 由于高维空间的稀疏性,很多非自然数据的点可能距离决策边界非常近,但在我们人类看来它们几乎与原始自然数据无差别。

一个经典的例子是:给神经网络输入一张猫的图片,稍微在 法丛方向 加一点扰动(人眼几乎察觉不到)。这张图片仍然落在数据空间里,但 已经偏离自然流形,导致模型认为它是一只狗。

这种“幽灵数据”之所以有效,正是因为 法丛方向是流形的正交补空间(Orthogonal Complement),而流形本身对它并不敏感——就像蚂蚁看不到第三维的变化。


4. 为什么法丛方向上的攻击有效?

既然自然数据流形本身很低维,而法丛方向是它的补空间,远高于流形维度,那么:

    1. 法丛方向上的变动可以很大,但仍然不影响数据的可感知特性(因为它们对人类而言是“无意义的方向”)。
    2. 但是对于机器学习模型而言,这些方向仍然是合法的数据输入,它并没有经过特殊训练去防御这种扰动。
    3. 于是,在某些关键点上,对抗样本只需要在法丛方向上加一点点扰动,就能让模型的决策边界翻车

这也解释了:

    • 为什么对抗样本攻击几乎无处不在?因为高维空间里“非自然数据”占比极高,总会有某些点可以被找到来攻击模型。
    • 为什么对抗样本对人类视觉几乎无影响?因为它利用的不是“自然数据的流形变化”,而是“法丛方向的变化”,这个方向人类或自然模型根本不敏感。
    • 为什么深度学习模型的泛化能力有时不稳定?因为它们过度依赖训练数据流形,而法丛方向上的任何变化都会导致预测结果的剧烈偏移。

5. 这是否意味着“无限对抗攻击”可能存在?

在理论上,确实可以构造出 无穷多的“几何意义上非自然的数据” 来攻击模型。

    • 这些数据点不属于原始数据流形,但它们可以被设计得 足够接近决策边界,从而诱导模型出错。
    • 只要高维空间的维度够高,法丛方向的自由度就足够多,攻击者总能找到某个点来实现攻击。

这也是为什么:

    • 对抗样本防御是个无止境的军备竞赛,模型越强,对抗攻击手段就要越高级。
    • 对抗训练(Adversarial Training) 是当前最有效的解决方案之一,本质上就是“让模型在法丛方向上也学会一些关键的变化”,从而增加对抗鲁棒性。
    • 如果不考虑计算成本,我们可以尝试在更大的法丛方向空间中做鲁棒性优化,但这通常代价太高,所以现实中只能有限度地解决。万全之策是少有的,迅速堵漏或patches 对应用系统变得尤为重要。

6. AI炼丹里的‘法丛陷阱’

搞大模型训练时,参数空间就像高低起伏的山脉。梯度下降是沿着‘切空间’(Tangent Space)找路,但万一算法抽风往‘法丛’方向抖动,就可能造成极度的训练不稳定。所以高阶炼丹师都要用正则化当护栏,专门防着往法丛深渊掉。

如果没有黑客,模型使用者用到的数据输入都是自然数据,与模型训练集是同质的,模型本身的泛化能力足以轻松应对。这是因为自然数据,包括用户的自然语言指令和样例都处于模型数据的切空间里,好比在平原地带,东西南北方向坡度平缓。

但不怕贼,就怕贼惦记。黑客可以刻意制造法丛区域的数据,攻击模型。法丛处于训练数据没有覆盖的未知区域,以此为测试数据,模型性能就急剧下降,可能表现得一塌糊涂。这就像开车——切空间是方向盘能控制的方向,法丛是侧翻悬崖的方向。

这是个头痛问题,单纯依靠数据中的统计模式,难以实现真正的分布外泛化和可靠的安全性保障。常规数据增强很难解决这个法丛数据攻击的问题,因为常规自然数据如同在已知区域做探索,不会主动探索法丛方向,而且这样的数据在通常的场景极为罕见:正常用户也不会故意跳崖。开发者要探索所有法丛危险方向需要无限资源,防不胜防,通常是对骇客的数据进攻,亡羊补牢,给模型做针对性补漏。

总结:

“刺猬模型”来展示法丛(Normal Bundle)是合理的,需要强调“不同点的法向方向形成的丛”,就能很好地表达它的几何概念。
自然数据流形 vs. 法丛方向的思考是对的,它基于自然数据的流形假设。
高维空间的稀疏性 + 法丛方向上的非自然数据确是对抗攻击成立的根本原因,所以确实可以构造无数个“几何上合法但不自然”的数据点来让模型翻车。
如果要防御,关键是让模型学会法丛方向上的“稳定性”,这就是对抗训练、正则化、鲁棒性优化、构造对抗数据patching等技术的意义。

高维空间和对抗攻击的研究,可以进一步研读对抗学习(Adversarial Learning)相关论文,尤其是 Ian Goodfellow 提出的 FGSM(Fast Gradient Sign Method)经典攻击方法及其后续的种种高级变体

 

【相关】

The Three-Stage Scaling Laws Large Language Models

Mr. Huang's background features three S-curves, illustrating the scaling relay race across three stages of large language models, demonstrating a persistent spirit akin to the Chinese fable of the legendary Old Man Who Moved Mountains.

We know that large language models have three stages: pre-training, post-training, and online inference. The biggest change in recent months is the community consensus, following Ilya Sutskever's claim, that the pre-training era has ended. The famous empirical scaling laws for pre-training appear to have plateaued. This has led to the rise of inference models (OpenAI's O series and Deepseek's R series, among others), which emphasize investment in chain-of-thought (CoT) reinforcement learning during post-training and utilization of online inference time (so-called "test time compute"). These reasoning models have indeed demonstrated unprecedented achievements in mathematics, coding, and creative writing.

The scaling of post-training for reasoning models has just begun, and it's unclear how far it can go. But we can gradually see this trajectory from O1 evolving to O3, and from R1 to the reportedly soon-to-be-released R2 and their enhanced capabilities. What about the test time scaling in the final inference stage?

Recently, I spoke with my old friend Junlin, one of the earliest advocates for the three S-curves of scaling in China. I mentioned that I hadn't seen any real test time scaling because no one can control the model's test time compute—how much time/computing power it uses and when it completes assigned tasks is determined by the model itself, so test time doesn't seem "scalable." Junlin agreed that this is currently the case.

These past few days, while playing with large models' deep research capabilities, I've gradually experienced some possibilities for test time scaling. The answer is emerging. Fundamentally, it's about whether there's a curve showing that if you give a query or topic more thinking and response time, it performs better. Specifically, with O3-mini, there's a button called "deep research" that users can choose to use or not to use. Without it, your question still follows a chain of thought because you initially selected the reinforced O3 reasoning model. The process for reasoning models typically takes a minute or two. However, if you also press the deep research button, the final reasoning time is extended by several times, potentially lasting up to 10 minutes. This shows us that even with the same model, different inference times produce different results. This should count as a precursor of test time scaling.

How does it work? How can users invest different amounts of test time compute based on the difficulty or challenge of their topic and their tolerance for waiting time to generate different results for the same topic? It turns out it uses an agent-like approach. The functionality provided by the deep research button is essentially a research reasoning agent. Agents are an additional LLM-native feature that doesn't require changing the model—it changes the interaction method during the inference stage. Currently, this interaction is very simple, just one round, but this test time scaling direction is expected to continue exploring longer and more interactions with users to help maximize the effect of test time compute.

If test time compute scaling doesn't quickly hit bottlenecks, we can imagine future deep research interacting with users for extended periods to complete highly complex projects. Perhaps we're moving beyond minute-level reasoning time investments—we can entirely envision large models investing hours or even days to complete challenging tasks, such as projects that would take human researchers months or years, or completing research projects humans cannot accomplish. The current deep research is very simple—after receiving the user's prompt/query, it immediately breaks down the problem and asks the user five or six simple questions to confirm the required sources, breadth, depth, and considerations for the research. After receiving user feedback, the model begins accepting updated materials (if any) and uses search to collect more relevant information. Then, following the decomposed tasks and the plan confirmed with the user, it analyzes each source and finally synthesizes everything into a research report. This naturally extends the required reasoning time because the task is no longer singular, and the materials aren't limited to knowledge already digested within the model but include more sources searched in real-time—processing all this takes time.

For both reinforcement learning in the post-training stage of reasoning models and the investment in test time compute during the inference stage, the scaling journey has just begun. Let's hope these two S-curves can continue to rise steadily for some time, allowing the scaling relay race to help us progress continuously on the path toward artificial general intelligence (AGI) and eventually artificial superintelligence (ASI).

 

【Related】

大模型三阶段的 scaling laws 接力赛

张俊林:从Deepseek R1看Scaling Law

 

大模型三阶段的 scaling laws 接力赛

黄教主背后是三个S曲线,illustrate 的是大模型三个阶段的“做大做强”的 scaling 接力赛,颇显挖山不止的愚公移山精神。

我们知道,大模型有三个阶段:预训练、后训练、在线推理。过去几个月最大的改变是,业内基本有了共识,就是伊利亚宣称的说法,预训练时代结束了,著名的预训练的 scaling law 的经验法则貌似走到了头,进入平台期。于是有了推理模型(OpenAI O 系列,以及deepseek R 系列等)的兴起,强调的是后训练的思维链强化学习的投入以及对于在线推理时间(所谓 test time compute)的利用。推理模型也确实在数学、代码以及文字创造性方面展现了前所未有的亮眼成绩。

推理模型的后训练 scaling 刚开始,能走多远,还不清晰。但这个轨迹可以从 o1 变成 o3,以及 r1 到据说今后一两个月随时可能发布的 r2 等能力增强上,慢慢看到。最后这个推理阶段的 test time scaling 呢?

前阵子我跟国内最早鼓吹 scaling 三条S曲线的老友 Junlin 说,根本就没看到什么 test time scaling 呀,因为用户不能掌控模型的 test time compute,它花多少时间/算力,啥时候完成我给它的指令任务,是大模型自己决定的,test time 并不是可以“伸缩”(scaling)的呢。Junlin说,目前确实如此。

这几天玩大模型 deep research,逐渐体会到一点 test time scaling 的伸缩可能性。答案的端倪出现了。说到底就是,如果一个query 或课题,有没有一条曲线表示,如果你给它更多的思考和响应时间,它就完成得更好。具体说,在 o3-mini 下,有一个 button 叫 deep research,用户可以选择用或者不用。如果不用,你的问题也会有思维链,因为你一开始就选择了已经后训练强化的 o3 推理模型。推理模型的思维过程通常是一两分钟吧。但是如果你同时又按下 deep research 按钮,它最终完成任务的推理时间是加n倍的等待时间,可以长达10来分钟。这至少让我们看到了,模型不变,但推理现场的缩放时间不同,其结果是不同的。这应该算是 test time scaling 的前序或影子了。

那它是怎么做到的呢?让用户可以根据自己的课题的难易或挑战性,以及自己可以容忍的等待时间,来对同一个课题做不同的 test time compute 的投入,以便生成不同的结果呢?原来,它用的是某种 agent 的思路。deep research 这个按钮所提供的功能,实际上就是一个研究性推理的 agent。agent 是 LLM-native 的附加 feature,但不需要改变模型,它所改变的是在推理阶段与用户的交互方式。目前这种交互非常简单,只有一轮,但所开辟的这个 test time scaling 方向,预计可以继续探索与用户更长更多的交互,来帮助最大化 test time compute 的效果。

如果 test time compute scaling 并不是很快就遇到瓶颈,可以想象将来的 deep research 可以与用户互动很长的时间去完成一个非常复杂的项目,也许不是分钟量级的推理时间投入了,完全可以想象大模型投入 hours 甚至 days 来完成一个高难课题,譬如一个人类研究员需要几个月甚至几年才能完成的项目,或者完成一个人类无法完成的研究项目。当前的 deep research 非常简单,它在得到用户的 prompt/query 后,立即分解问题,并反问用户五六个简单的问题,来确认这个研究所需要的资料来源、广度、深度以及注意事项。得到用户的反馈以后,模型开始接受用户更新的资料(if any),并用 search 来收集更多的相关资料,然后按照任务的分解以及与用户确认过的计划和信息,对于每一个来源做分析,最后综合贯通,形成研究报告。这样一来,它所需要耗费的推理时间自然就加长了,因为任务不再是单一的任务,资料也不仅仅是自己模型内部已经消化了的知识,而是现场搜索的更多来源,处理这一切都需要时间。

对于推理模型的后编辑阶段的强化学习以及它在推理阶段的 test time compute 的投入,这两阶段的 scaling 征程刚刚开始。希望这两条S曲线还可以稳定上升一段时间,让 scaling 的接力赛助力我们在通用智能(AGI)和超级智能(ASI)的道路上不断前行。

 

 

【相关】

张俊林:从Deepseek R1看Scaling Law

Fundamental Limitations of Deep Learning: Origins in Data-Driven Methodology

In today's rapidly evolving artificial intelligence landscape, deep learning models have become the core engine driving technological innovation. However, behind these impressive achievements, deep learning faces several fundamental limitations that are not merely technical implementation challenges but are determined by the essence of its methodological approach.

This article explores the core limitations of deep learning beyond the well-known "black box" problem and analyzes their mathematical origins.

I. "Original Sin" of Data-Driven Approaches: Philosophical Dilemma of Statistical Learning

Confusion Between Correlation and Causation

Deep learning models are essentially high-dimensional probability density estimators. Their core objective is to find the best approximation of the conditional probability distribution P(y|x;θ) through parameters θ. Models learn from large volumes of training data, attempting to capture statistical patterns of various sizes and generalize them to unknown data. However, this statistical learning paradigm leads to a fundamental problem: models learn P(y|x) rather than P(x→y) – statistical correlation rather than causal relationships.

Consider a simple example: an AI medical system might discover that a certain type of rash is highly correlated with malaria diagnoses (possibly because the data was collected in regions with mosquito proliferation issues). The model establishes a pseudo-causal relationship of "rash → malaria" while overlooking temperature, humidity, and other actual disease factors.

This "causal misplacement" leads to poor model performance in new environments:

    • In regions without mosquito problems, the model may over-diagnose malaria
    • When facing new infectious diseases, the model may misclassify them as known categories
    • When the diagnostic environment changes, model performance significantly deteriorates

Information Bottleneck and Compression Distortion

According to information bottleneck theory, neural networks need to perform a special kind of information compression during training: discarding information in input X that is irrelevant to prediction Y while preserving all relevant information. Mathematically, this is expressed as maximizing:

I(Z;Y) - β·I(X;Z)

Where Z is the intermediate representation, I denotes mutual information, and β is a trade-off coefficient.

When training data is insufficient or biased, this compression process encounters serious problems:

    1. Discarding genuine causal signals (e.g., cell morphological features in medical images)
    2. Preserving pseudo-correlative signals (e.g., using hospital wall colors as diagnostic criteria)

The essence of this "lossy compression" causes models to grasp incorrect features in new environments. In fact, when H(Y|X) is incorrectly minimized, the model establishes data defect-driven false information channels rather than accurate mappings of reality.

II. The Low-Dimensional Manifold Hypothesis for Natural Data

A classic assumption in machine learning theory is that natural data resides on low-dimensional manifolds within high-dimensional spaces. Taking a simple example of a two-dimensional manifold in three-dimensional space, it resembles folded paper – although data points exist in 3D space, the intrinsic structure is 2D. Manifolds possess local Euclidean properties of smoothness and continuity: the neighborhood of any point on the manifold can be mapped to a low-dimensional Euclidean space. For instance, when a face rotates, the image slides continuously on the manifold without sudden changes.

Basic Concepts

    • High-dimensional space: Refers to mathematical spaces with dimensions far greater than 3. For example, a 100x100 pixel image exists in a 10,000-dimensional space (each pixel being one dimension).
    • Low-dimensional manifold: A continuous, smooth low-dimensional structure embedded in high-dimensional space. For example, a two-dimensional surface in three-dimensional space, or a structure of dozens of dimensions in a space of millions of dimensions. For instance, all ways of writing the digit "2" in a 784-dimensional pixel space form an approximately 10-dimensional manifold (controlling stroke thickness, tilt, curvature, etc.).

Why Natural Data Forms Low-Dimensional Manifolds

Natural data (such as video, images, audio, text) may seem to contain high-dimensional features but is constrained by physical laws and semantic restrictions, exhibiting low-dimensional characteristics:

Physical constraints:

    • A facial photograph's parameters are limited by bone structure, lighting angle, facial muscle movements, etc., with actual degrees of freedom potentially fewer than 50 dimensions.

Semantic constraints:

    • In textual data, grammatical rules and semantic coherence restrict seemingly unlimited vocabulary combinations to a finite meaning space. Other modal data is similar, also constrained by relationships between atomic units (tokens).

Dimensionality Reduction and Feature Extraction

The information "compression" in models is actually a process of dimensionality reduction and feature extraction. For example, the hierarchical structure of Convolutional Neural Networks (CNNs) progressively strips away redundant dimensions, approaching the essence of data manifolds. Shallow layers extract edges (local linear structures), while deeper layers combine them into object parts (global manifold structures). Manifold Learning explicitly recovers the intrinsic low-dimensional structure of data.

Taking 3D object recognition as an example: The translation and rotation of objects in 3D space form a 6-dimensional manifold (3 translations + 3 rotations). When related video image data is embedded in high-dimensional pixel space, ideal 3D object recognition involves dimensionality reduction to its 6-dimensional manifold, identifying objects through feature extraction.

III. Adversarial Examples: Fragility at Distribution Boundaries

Adversarial examples refer to samples that, through minor perturbations to original input samples, can cause deep learning models to produce incorrect outputs. For instance, a slightly modified panda image might be identified as a turtle with 99% confidence by AI.

The existence of adversarial examples reveals structural defects in data manifolds, challenging the traditional manifold hypothesis discussed above and exposing its fragility:

    • Natural data manifolds contain numerous "holes": areas not covered by training data
    • Manifold boundaries have high-curvature regions: minor perturbations can cross category boundaries

Theoretically, the possible combinations of high-resolution color images far exceed astronomical numbers. While natural images are constrained by physical laws, substantially reducing the effective space, it remains far from being adequately covered by existing datasets. This data sparsity is one fundamental reason why deep learning models are susceptible to adversarial attacks and struggle to generalize to extreme scenarios.

This sparse coverage allows attackers to find vulnerable points near decision boundaries. For example, adding carefully designed noise to a panda image that is almost imperceptible to the human eye can cause an image recognition model to misclassify it as a turtle.

Adversarial examples are not random but systematically exploit the geometric structure of model decision boundaries. A panda image being identified as a turtle is not due to random noise but because the noise is precisely added in the direction of the shortest path to the decision boundary.

Failure of Lipschitz Continuity

Lipschitz continuity is a metric for measuring how sensitive a function is to input changes. The higher the Lipschitz constant (L-value) of a deep network, the more sensitive the model is to input perturbations. The L-value of actual deep networks in adversarial directions can reach 10^3 magnitude, meaning that even minor perturbations may cause dramatic changes in model output. For example, in an autonomous driving system, if the image recognition model is overly sensitive to input perturbations, it might misidentify a large truck crossing an intersection as sky, leading to incorrect driving decisions.

Ideal classification models should satisfy the Lipschitz continuity condition, meaning that minimal input changes should only lead to limited output changes:

‖f(x+δ)-f(x)‖ ≤ L‖δ‖

Mathematical expression meaning:

‖model(input+small change) - model(input)‖ ≤ L × ‖small change‖

L is the "sensitivity coefficient," smaller L is better.

The failure of Lipschitz continuity causes input space to exhibit strong anisotropy (i.e., sensitivity in different directions varies dramatically). Imagine standing in complex terrain:

    • Natural perturbation directions (L≈1): Like walking on a gentle slope, moving 1 meter changes elevation by 1 meter, movement is safe and controllable
    • Adversarial perturbation directions (L≫1, e.g., L=10³): Like standing at a cliff edge, moving 1 centimeter might result in a 100-meter fall

This geometric structure makes it difficult for data augmentation based on uniform sampling to cover high-risk areas, as these areas have extremely low probability in natural data distribution but are "close" in Euclidean distance. For example:

    • Natural direction: Not sensitive to perturbations like lighting changes, blur, etc. (L≈1) ➔ Model can correctly handle everyday image variations
    • Adversarial direction: Specific minor perturbations cause dramatic changes (L=10³) ➔ Like applying "magic noise" to images, causing model misclassification

The Danger:

    • Exploited by attackers: Finding high-L directions to create adversarial examples is like knowing cliff locations and specifically targeting vulnerable points
    • Difficult to defend: Regular training covering all directions is prohibitively expensive, like requiring hikers to adapt to all terrain types, which is unrealistic

IV. The Mathematical Chasm Between Interpolation and Extrapolation

Interpolation Success vs. Extrapolation Failure

Deep learning models perform excellently on interpolation tasks but often fail in extrapolation tasks. This is not coincidental but determined by the essence of statistical learning:

    • Interpolation: Predicting points within the support set of the training data distribution, equivalent to filling gaps in known regions
    • Extrapolation: Predicting points outside the support set of the training data distribution, equivalent to exploring unknown regions

The success of modern deep learning largely depends on the assumption that "training distribution ≈ testing distribution." When this assumption is broken, extrapolation problems become severe, and model performance deteriorates dramatically.

Differential Geometric Explanation of Extrapolation Failure

Imagine you are a geographer drawing terrain maps:

    • Input space (M): The entire Earth's surface, containing plains, mountains, canyons, and various terrains
    • Data distribution (P_data): Regions explored by humans (cities, roads, farmland, etc.)
    • Classification model (f): Maps drawn based on terrain features (marking where forests, deserts are)
    • Decision boundaries: Transition zones between different terrains (e.g., transition between forest and grassland)

Tangent Space: Trends in terrain changes in explored areas. For example, in plains, slopes are gentle in east, west, north, and south directions (corresponding to natural perturbation directions).

The normal bundle refers to directions perpendicular to explored areas, such as suddenly appearing cliffs.

Key problem: Maps are accurate in explored regions but fail in unknown cliff areas.

When moving in unknown cliff areas, test data falls in the normal bundle of the training data distribution, and model generalization performance drops dramatically. This situation can be characterized by the following inequality:

∇ₓ log P_data(x)·δ > κ

Mathematical expression meaning:

(Terrain steepness) × (Movement direction) > (Map boundary blurriness)

Where κ is the curvature radius of the decision boundary, comparable to the width of the transition zone between forest and grassland on the map; δ is the perturbation vector, i.e., the direction of movement.

∇ₓ log P_data(x): "Terrain steepness" of data distribution

    • In frequently visited human areas (like cities), terrain is gentle (small gradient)
    • In uninhabited areas (like deep sea), terrain is steep (large gradient)

It is impossible to effectively cover unknown cliff areas through conventional training data augmentation because they have extremely low probability in the training distribution. Conventional data augmentation is like exploring in known areas and will not actively explore cliff directions because (1) the probability is extremely low: normal people don't deliberately jump off cliffs; (2) the cost is prohibitively high: exploring all dangerous directions requires infinite resources.

Consequence: When map users accidentally walk to the edge of a cliff, the navigation provided by the map fails; the map cannot predict whether you will fall off the cliff or discover a new continent.

Beyond Data-Driven Artificial Intelligence

The limitations of deep learning are not temporary technical difficulties but methodological boundaries determined by its "data-driven" nature. Relying solely on statistical patterns in data makes it difficult to achieve true causal understanding, out-of-distribution generalization, and reliable security guarantees.

One future direction may be to combine data-driven learning with structured prior logical symbolic systems, creating hybrid systems that can both leverage massive data and possess causal reasoning capabilities.

 

 

【Related】

深度学习的局限性研究综述

在人工智能快速发展的今天,深度学习大模型已成为推动技术革新的核心引擎。然而,在这些耀眼成就的背后,深度学习也面临着一系列根本性的局限,这些局限不仅是技术实现上的挑战,更是其方法论本质所决定的。

本文探讨深度学习除了黑箱以外的核心局限性,并分析它们的数学根源。

请参照机器自动生成的研究报告 o3 deep research: 深度学习局限性研究报告,本文不是在该研究报告基础上修正的版本,而是笔者综述调研同时进行的平行版本。因此,不敢说一定更好,虽然我花了不少时间核对、查验、精简、修正,道理上应该靠谱一些,至少可读性更好(?)。

一、数据驱动的"原罪":统计学习的哲学困境

相关性与因果关系的混淆

深度学习模型本质上是高维概率密度估计器,它的核心目标是通过参数θ找到条件概率分布P(y|x;θ)的最佳近似。模型通过学习大量的训练数据,试图捕捉数据中的大大小小的统计规律,并将其泛化到未知数据。然而,这种统计学习范式决定了一个根本性问题:模型学习的是P(y|x)而非P(x→y),即统计相关性而非因果关系。

举个简单例子,假设一个医疗AI系统在训练数据中发现,某种皮疹与疟疾诊断高度相关(可能因为采集数据的地区同时存在蚊虫滋生问题)。模型会建立"皮疹→疟疾"的伪因果关系,而忽略温度、湿度等真实致病因素。再如,模型可能学习到“公鸡打鸣”与“太阳升起”之间的强相关性,但这并不意味着公鸡打鸣导致了太阳升起。

这种"因果错置"导致模型在新环境中表现不佳:

    • 在没有蚊虫问题的地区,模型可能过度诊断疟疾
    • 面对新型传染病,模型可能将其误判为已知类别
    • 当诊断环境变化时,模型性能会显著下降

信息瓶颈与压缩失真

根据信息瓶颈理论,神经网络在训练过程中需要执行一种特殊的信息压缩:丢弃输入X中与预测Y无关的信息,同时保留所有相关信息。数学上表达为最大化:

I(Z;Y) - β·I(X;Z)

其中Z是中间表示,I表示互信息,β是权衡系数。

当训练数据不足或有偏时,这种压缩过程会出现严重问题:

    1. 丢弃真实因果信号(如医学图像中丢弃细胞形态学特征)
    2. 保留伪相关信号(如将医院墙面色调作为诊断依据)

这种"有损压缩"的本质导致模型在新环境中往往抓住了错误特征。实际上,当H(Y|X)被错误最小化时,模型建立的是数据缺陷驱动的虚假信息通道,而非对现实的准确映射。

二、自然数据的低维流形假说

机器学习理论中有一个经典假设:自然数据位于高维空间的低维流形上。以简单的三维空间中的二维流形为例,它就形似卷起的纸张,虽然数据点存在于3D空间,但内在结构是2D的。流形具有光滑性与连续性的局部欧几里得性:流形任意点的邻域可映射到低维欧几里得空间。例如,人脸旋转角度变化时,图像在流形上连续滑动,不会突变。

基本概念

    • 高维空间:指维度远大于3的数学空间,例如一张100x100像素的图像存在于10,000维空间中(每个像素为一个维度)。
    • 低维流形:嵌入在高维空间中的连续、光滑的低维结构。例如,三维空间中的二维曲面,或万维空间中的几十维结构。例如,784维像素空间中,数字"2"的所有写法构成约10维流形(控制笔画粗细、倾斜、弧度等)。

自然数据为何形成低维流形

自然数据(如视频、图像、语音、文本)看似蕴含着高维特征,实则受物理规律和语义约束,呈现低维特性:

    • 物理约束
      一张人脸照片的参数受限于骨骼结构、光照角度、表情肌肉运动等,实际自由度可能不足50维。
    • 语义约束
      文本数据中,语法规则和语义相谐性将看似无限的词汇组合限制在有限的意义空间内。其他模态数据也是如此,同样存在原子性单元(tokens)之间相互关系的约束。

降维与特征提取

模型的信息“压缩”实际上是降维与特征提取的过程。例如,卷积神经网络(CNN)的层级结构逐步剥离冗余维度,逼近数据流形本质。浅层提取边缘(局部线性结构),深层组合成物体部件(全局流形结构)。流形学习(Manifold Learning)意味着显式恢复数据的内在低维结构。

以3D物体识别为例
物体在3D空间中的平移、旋转形成6维流形(3个平移+3个旋转)。当相关视频图像数据嵌入到高维像素空间中以后,理想的3D物体识别就是降维到其6维流形,通过特征抽取识别物体。

三、对抗样本:分布边界的脆弱性

对抗样本是指通过对原始输入样本进行微小的扰动,就能使深度学习模型产生错误输出的样本。例如,一张微调过的熊猫图片会被AI以99%的置信度识别为乌龜。

对抗样本的存在揭示了数据流形的结构性缺陷,挑战了上文的传统流形假说,揭示了这一假说的脆弱性:

    1. 自然数据流形存在大量"孔洞":未被训练数据覆盖的区域
    2. 流形边界存在高曲率区域:微小扰动即可跨越类别边界

ImageNet包含128万张标注图像,但这些数据仅覆盖了自然图像空间的极小部分。理论上,高分辨率彩色图像的可能性组合数远超天文数字,而虽然自然图像受物理规律约束,实际有效空间大幅减少,但仍远未被现有数据集充分覆盖。这种数据稀疏性是深度学习模型易受对抗样本攻击、难以泛化到极端场景的根本原因之一。

这种稀疏覆盖使得攻击者可以在决策边界附近找到脆弱点。例如,在一张熊猫图片中加入一些精心设计的噪声,人眼几乎无法察觉,但却可以使图像识别模型将其误判为烏龜。

对抗样本不是随机的,而是系统性地利用了模型决策边界的几何结构。一张熊猫图片被识别为烏龜,不是因为随机噪声,而是因为噪声被精确添加到决策边界的最短路径方向。

李普希茨连续性的失效

李普希茨连续性是衡量函数对输入变化敏感程度的一个指标。深度网络的李普希茨常数(L值)越大,表示模型对输入的扰动越敏感。实际深度网络的 L 值在对抗方向上可达 量级,这意味着即使微小的扰动也可能导致模型输出发生剧烈变化。例如,自动驾驶系统中的图像识别模型如果对输入的扰动过于敏感,就可能将前方横穿路口的大卡车误识别为天空,从而导致错误的驾驶决策。

理想的分类模型应满足李普希茨连续条件,即输入的微小变化只能导致输出的有限变化:

‖f(x+δ)-f(x)‖ ≤ L‖δ‖

数学表达含义:‖模型(输入+小改动) - 模型(输入)‖ ≤ L × ‖小改动‖
L是"敏感系数",L越小越好。

李普希茨连续性失效导致输入空间呈现强烈的各向异性(即,不同方向上的敏感度天差地别)。想象你站在一片复杂地形中:

    • 自然扰动方向(L≈1):如同缓坡行走,移动1米海拔变化1米,行动安全可控
    • 对抗扰动方向(L≫1, 例如 L=10³):如同悬崖边缘,移动1厘米可能坠落100米

这种几何结构使得基于均匀采样的数据增强很难覆盖高风险区域,因为这些区域在自然数据分布中概率极小,但在欧氏距离上却很"近"。例如,

    • 自然方向:对光照变化、模糊等扰动不敏感(L≈1)
      ➔ 模型能正确处理日常图片变化
    • 对抗方向:存在特定微小扰动导致剧烈变化(L=10³)
      ➔ 如同在图片上施加"魔法噪声",使模型错判

各向异性的危险

    • 攻击者利用:找到高L方向制作对抗样本
      就像知道悬崖位置后,专攻脆弱点
    • 防御困难:常规训练覆盖所有方向成本过高
      如同要求登山者适应所有地形,不现实

四、内插与外推的数学鸿沟

内插成功vs外推失败

深度学习模型在内插(interpolation)任务上表现出色,但在外推(extrapolation)任务上往往失效。这不是偶然现象,而是其统计学习本质决定的:

    • 内插:预测落在训练数据分布支撑集内的点,相当于填补已知区域的空白
    • 外推:预测落在训练数据分布支撑集外的点,相当于探索未知区域

现代深度学习的成功很大程度上依赖于"训练分布≈测试分布"这一假设。当这一假设被打破时,外推问题严重,模型的表现会急剧恶化。

外推失效的微分几何解释

从微分几何视角看,可以将输入空间视为黎曼流形(M,g),分类模型f:M→ℝ^C将数据点映射到类别空间。

想象你是一位绘制地形图的地理学家:

输入空间(M):整个地球表面,包含平原、高山、峡谷等各种地形

数据分布(P_data):人类已探索区域(城市、公路、农田等)

分类模型(f):根据地形特征绘制的地图(标注哪里是森林、哪里是沙漠)

决策边界:不同地形的分界线(如森林与草原的过渡带)

切空间(Tangent Space):已探索区域的地形变化趋势,例如在平原地带,东西南北方向坡度平缓(对应自然扰动方向)。所谓法丛区域(normal bundle)指的是垂直于已探索区域的方向,例如突然出现的悬崖。

关键问题:地图在已探索区域表现精准,但对未知悬崖区域失效。

在未知悬崖区域移动时,测试数据落在训练数据分布的法丛区域,模型泛化性能急剧下降。这种情况可以用以下不等式表征:

 ∇ₓ log P_data(x)·δ > κ

数学表达含义:(地形陡峭度) × (移动方向) > (地图边界模糊度)

其中κ为决策边界的曲率半径,好比地图标注的森林与草原的过渡带宽;δ为扰动向量,即移动的方向。

∇ₓ log P_data(x):数据分布的"地形陡峭度"

      • 在人类常去区域(如城市),地形平缓(梯度小)
      • 在无人区(如深海),地形陡峭(梯度大)

无法通过常规训练数据增强来有效覆盖未知悬崖区域,因为它们在训练分布中概率极低。常规数据增强如同在已知区域做探索,不会主动探索悬崖方向,因为(1)概率极低:正常人不会故意跳崖;(2)成本过高:探索所有危险方向需要无限资源。

后果:当地图使用者意外走到悬崖边时,地图提供的导航失效,地图无法预测你会掉下悬崖还是发现新大陆。

结论:超越数据驱动的人工智能

深度学习的局限不是技术实现上的暂时困难,而是其"数据驱动"本质所决定的方法论边界。单纯依靠数据中的统计模式,难以实现真正的因果理解、分布外泛化和可靠的安全性保障。

一个未来方向可能是将数据驱动学习与结构化先验逻辑符号系统相结合,打造既能利用海量数据又具备因果推理能力的混合系统。

 

【相关】

 

o3 deep research: 深度学习局限性研究报告

立委按:这是 OpenAI o3 deep research 生成的研究报告,一字未改。可能尚存幻觉类错误,仅供参考。

我自己驱动的相同综述方向的人工版本是 深度学习的局限性研究综述,可以比对参照。不一定比此版更好。

本文将整理一篇深入分析深度学习局限性的研究报告,涵盖泛化能力、对抗样本、因果推理、黑盒问题,并结合数据驱动方法论的挑战、安全性问题和数学根源展开探讨。 分析统计学习的哲学困境、信息瓶颈理论、拓扑学视角的对抗样本解析、微分几何视角下的外推问题,以及数据缺陷的量子化表达。同时,探讨现有应对策略及其局限性,并展望未来可能的发展路径。

1. 深度学习的泛化能力与局限性

深度学习模型的核心优势在于对复杂数据模式的泛化能力。通过对大量样本的训练,深度神经网络能够学习高维特征表示,并在测试集上取得优异表现。这种泛化能力使其在图像识别、自然语言处理等任务上超越传统方法。然而,这种成功主要局限于训练数据分布内的情形,当面对更广泛的情境时,模型表现出一系列局限性。

相关性与因果关系的混淆:深度学习模型倾向于利用数据中的相关性来做出预测,却缺乏辨别因果关系的能力 () ()。它们可以在海量数据中发现高度相关的特征模式,但无法确定哪些因素是真正的因果因素。例如,模型可能将巧合当作关联,著名的案例如Google流感趋势因过度拟合搜索频率而产生误判 ()。实际上,神经网络无法区分关联与因果,常常对统计上显著却非因果的模式赋予意义,这会导致所谓的“愚蠢的洞察” () ()。正因如此,在复杂系统中缺乏因果推断能力会严重限制模型的预测可靠性 ()。

对抗样本脆弱性:深度模型被发现对对抗样本非常敏感。对抗样本是指在原始输入中加入人类几乎察觉不到的微小扰动,就能使模型信心十足地给出错误输出的输入 ()。例如,只需对一张图像像素做细微修改,就可能令模型将熊猫误识别为长臂猿,而人眼几乎看不出差别 ()。 (Adversarial example using FGSM  |  TensorFlow Core)上图演示了对抗样本攻击:原始图像$x$是熊猫(模型置信度57.7%),加入放大系数$\epsilon=0.007$的微小扰动$\text{sign}(\nabla_x J(\theta, x, y))$后,得到对抗样本$x+\epsilon,\text{sign}(\nabla_x J(\theta, x, y))$,模型被误导将其分类为长臂猿(置信度99.3%)。产生对抗扰动的一种常见方法是快速梯度符号法(FGSM),其公式为:$x_{\text{adv}} = x + \epsilon \cdot \text{sign}(\nabla_x J(\theta, x, y))$,表示沿损失函数对输入梯度的正方向施加微小步长$\epsilon$ (Adversarial example using FGSM  |  TensorFlow Core) (Adversarial example using FGSM  |  TensorFlow Core)。对抗样本现象凸显了深度模型在输入空间局部扰动下的非鲁棒性,表明它更多是根据浅层相关特征作决策,而非抓住人类理解的语义要点 ()。

黑盒性质:深度神经网络往往被视为黑盒模型,缺乏可解释性 () ()。模型内部的高维参数和非线性使人类难以理解其决策依据。实际上,网络只是将输入映射为数字并拟合统计相关性,它无法提供人类可理解的决策理由 ()。研究表明,模型的可解释性往往和灵活性呈反比,而神经网络是灵活性极高的模型,因此其内部机制难以解释 ()。这种黑盒特性意味着我们难以信任深度模型去完成高风险决策任务,例如医疗诊断或自动驾驶中的生死抉择 ()。同时,由于内部机制复杂且缺乏模块化结构,深度模型也很难调试和验证,这为实际部署带来安全隐患 ()。

数据依赖与需求:深度学习在很大程度上是一个数据驱动的范式。深度神经网络对大规模标记数据的依赖程度极高 ()。没有大量多样的训练数据,网络难以学习到稳健的模式。这导致在数据匮乏的场景下,深度学习往往表现不佳。例如,人类可以通过一两次示范就学会新任务(一次学习),但神经网络通常需要成千上万的样本才能勉强泛化 () ()。如果训练数据分布存在偏差或盲区,模型很容易记忆训练集而缺乏真正的理解 ()。正如有研究指出的:“这些模型表面上表现出对任务的理解,其实只是记住了海量数据,在训练数据覆盖不到的地方就会失败” ()。因此,深度学习革命在某种意义上是由“大数据”推动的,当缺乏大数据时,这种方法就陷入困境。

综上,深度学习模型在训练分布内展现了强大的泛化性能,但其对相关性依赖、对抗攻击脆弱、内部不可解释以及对数据的高度需求,构成了其显著的局限。这些问题为我们在更广泛、更复杂的现实环境中应用深度学习敲响了警钟。

2. 数据驱动方法论的挑战

深度学习崛起于数据驱动的统计学习范式,本质上可被视为一个高维的概率密度估计器。模型通过在训练集上最大化似然或最小化误差来捕获输入与输出之间的映射关系。然而,这种纯关联式的学习方法在哲学和实践上都面临挑战:

  • 统计学习的哲学困境:相关不等于因果。深度模型所学到的是训练数据中输入与输出的联合分布或条件分布,并没有内置因果推理机制 () ()。它在本质上是一种复杂的函数拟合,追求在样本内的准确性,却无法保证在介入干预下依然有效。这就像是模型在“盲目”地记录现象,而不理解“为什么”。当数据中存在混杂因素时,模型可能错误地将伪相关当作因果规律。正如上一节提到的例子:在有偏数据集里,模型看到沙漠背景经常伴随骆驼,就误以为沙漠是骆驼出现的原因 (〖深度学习〗因果推断与机器学习的高级实践 | 数学建模_问题根因 分析 机器学习-CSDN博客)。实际中,“沙漠”和“骆驼”只是相关而非因果,模型缺乏常识因此产生了误因果推理。这种哲学困境表明,纯数据驱动的方法难以获得对环境的深层理解。
  • 信息瓶颈理论的启示:信息瓶颈理论认为,一个好的模型应当在保持对输出预测有用信息的同时压缩无关的输入信息。在深度学习中,隐藏层可以被看作输入信息到输出信息的“瓶颈”。研究发现,深度神经网络的训练过程可能包含两个阶段:先是拟合训练数据,尽可能记住输入细节;随后进入压缩阶段,有意或无意地丢弃与输出无关的冗余信息 (Anatomize Deep Learning with Information Theory | Lil'Log)。这种压缩有助于提升泛化能力,因为模型专注于关键信息而忽略噪声。信息瓶颈观点为泛化提供了理论解释:模型最终学到的是关于输出的充分简洁表示,而非输入的完整细节。如果一个模型无法有效压缩信息,仍记忆了大量与任务无关的细节,它在新样本上表现往往较差。这一定程度上解释了为何适当的正则化和表示压缩有利于泛化。
  • 训练数据缺陷导致伪相关:数据驱动方法严重依赖于训练数据的质量和分布假设。如果训练数据存在偏差或瑕疵,模型就会学到伪相关,并在推理时做出错误因果假设。例如,如果狗的图片大多在草地背景,模型可能将“绿色草地”作为识别狗的特征之一。结果是,一张只有草地没有狗的图片也可能被模型高置信度地预测为狗 (〖深度学习〗因果推断与机器学习的高级实践 | 数学建模_问题根因 分析 机器学习-CSDN博客) ()。这就是训练数据中的偏差导致模型学到了错误关联。在现实中,数据常常存在偏倚(例如采集自有限的环境或存在标签噪声),深度模型缺乏自我校正机制,难以分辨哪些特征是偶然相关的。研究者已经观察到,深度模型有将统计上显著却无因果意义的特征据为己用的倾向 ()。这不仅会导致模型在无偏数据上性能下降,还可能产生不公平或不可靠的决策。
  • 外推问题(分布外无能为力):深度学习模型对分布外数据(OOD)表现不佳是一个众所周知的挑战。当输入分布发生轻微变化,或遇到训练集未覆盖的情形时,模型往往束手无策 () ()。神经网络本质上擅长插值(在训练分布范围内进行预测),但在外推(超出已知分布范围进行预测)方面几乎是“绝对失败” ()。正如文献所指出:“在意料之外的新情况或极端条件下,深度模型表现会急剧恶化” ()。这源于模型只能从有限的数据近似真实函数,在超出经验数据范围时,没有依据进行可靠推断 ()。现实世界往往是开放环境,充满了复杂和未见的情境。没有无限的数据去覆盖所有可能,深度学习在开放世界中无法保证性能 ()。例如,一个在晴天公路图像上训练的自动驾驶模型,可能无法应对雪天或泥泞道路,因为这些是训练中未出现的“未知领域”。这种分布外泛化无能限制了深度学习部署在变化环境中的可靠性。

总而言之,当前的数据驱动深度学习方法存在明显的局限。它们在本质上是一种统计关联的学习:捕捉了高维数据中的模式,却缺乏因果推理和开放环境适应能力。信息瓶颈等理论为提升泛化提供了方向,但仍不足以解决由于数据缺陷和分布变化带来的挑战。未来的方法需要在纯关联学习之外,引入因果推断、先验知识和更强的模型假设,才能克服这些方法论上的瓶颈。

3. 对抗样本的数学解析

深度神经网络的对抗脆弱性可以从拓扑学、分析学和微分几何等角度加以理解。这些理论视角揭示了模型决策边界和数据结构的内在缺陷,为对抗样本的产生提供了数学解释。

3.1 拓扑视角:数据流形的结构性漏洞

高维输入数据通常假定分布在一个低维流形上。也就是说,真实样本只占据了输入空间中的一个局部子流形。然而,分类模型的决策边界需要在整个高维空间上划分类别区域。拓扑学角度表明,当数据流形嵌入在高维空间中时,其共维数(codimension)很高,围绕流形会存在大量“空白”区域。在这些流形之外的方向上,模型的决策边界缺乏约束,容易被攻破 (On the Geometry of Adversarial Examples | OpenReview)。正如一项几何分析指出的:对抗样本是深度模型决策边界在数据流形附近不正确分类的自然结果 (On the Geometry of Adversarial Examples | OpenReview)。由于训练时模型只需在流形上正确分类数据,它可能仅在流形表面学得很好,而对于流形附近的点(只差一点点就偏离了训练分布)分类却是任意的 (On the Geometry of Adversarial Examples | OpenReview)。这一结构性漏洞意味着:攻击者可以沿着垂直于数据流形的方向轻微移动样本,使其仍然在原始样本的邻域中(人眼看来几乎没变),却因脱离流形而落入决策边界另一侧。换言之,数据流形犹如悬浮于高维空间中的“岛屿”,四周充满了模型未曾见过的区域,对抗攻击正是利用了这些区域的漏洞。流形结构越是弯曲、高维,留给攻击者可利用的“缝隙”就越多,使得生成对抗样本成为可能 (On the Geometry of Adversarial Examples | OpenReview)。

3.2 李普希茨连续性失效:局部稳定性问题

理想情况下,分类函数应该是足够平滑的,对输入的小扰动保持稳定。然而,深度神经网络通常缺乏全局的李普希茨连续性约束,其输出对输入变化非常敏感。当网络在训练数据上高度拟合时,在某些方向的梯度会变得很大。这意味着存在较大的局部李普希茨常数——输入的一微小变化可以引起输出置信度的巨大变化,从而跨越决策边界。研究已表明,仅修改图像的几个像素就可能导致DNN完全错误地分类,这强调了此类模型局部稳定性的缺失 (Frontiers | Multivariate Lipschitz Analysis of the Stability of Neural Networks)。形式上,如果一个模型$f(x)$的李普希茨常数$L$非常大,那么$|x'-x|$虽很小,但$|f(x')-f(x)|$可能超过判别阈值,导致类别变化。对抗样本正是利用了这一点:通过沿着梯度方向施加精心设计的微小扰动,攻击者使模型输出发生非线性放大,从而产生错误分类。直观来说,深度网络在输入空间形成了复杂的山谷和峰峦,对抗扰动就像在谷底推了一把,看似平静的输出瞬间跃上海拔。稳定性精确拟合间存在矛盾:理论和实证结果都指出,提高模型对对抗扰动的鲁棒性常常要以牺牲部分标准精度为代价 (Frontiers | Multivariate Lipschitz Analysis of the Stability of Neural Networks)。这被视为深度学习中的一种基本权衡:追求对训练数据的极致拟合(高精度)会导致决策函数过于陡峭,从而难以兼顾对输入噪声的稳定性。这种李普希茨连续性的失效解释了为何神经网络在非常局部的范围内缺乏鲁棒性,也指导我们通过控制梯度范数(例如谱范数约束)来提升模型稳健性。

3.3 微分几何视角:测地线攻击路径与决策边界曲率

从微分几何的角度,可以将输入空间视为带有测度的流形,分类决策边界则是嵌入其中的一个超曲面。测地线攻击路径指的是在输入空间中,连接原始样本与目标对抗样本的最短路径。如果模型足够鲁棒,那么在原始类别流形内沿任意短路径都不应越界;但实际情况是,攻击者可以找到一条极短的路径穿过决策边界,将样本送入错误类别。这条路径往往偏离数据流形,抄近道绕过了模型对流形内数据的防御。决策边界的曲率在其中扮演重要角色:如果边界在样本附近高度弯曲或复杂起伏,那么存在局部区域使得很小的扰动即可达到另一侧类别。研究发现,通过对抗训练等方法增强鲁棒性,会显著降低决策边界在输入空间的曲率,使其更加平滑 ([PDF] Robustness via Curvature Regularization, and Vice Versa)。也就是说,脆弱模型的决策边界可能是“皱巴巴”的,充满高曲率的小曲面,导致分类区域犬牙交错;而鲁棒模型的边界更趋于平滑和笔直,需要更大的扰动才能跨越 ([PDF] Robustness via Curvature Regularization, and Vice Versa)。在微分几何上,可以将对抗扰动视作在决策边界法向方向上的微小位移。对抗攻击等价于找到一条绕过边界的捷径,而边界曲率越大,这条捷径越短。比如,当决策边界在样本点附近形成一个凸起,攻击者沿垂直于边界方向前进一点点就跌下凸起进入另一侧分类区域。这解释了测地线极短且几乎贴着数据流形表面的攻击路径是如何存在的。此外,高曲率还意味着不同方向上的鲁棒性各异,模型在某些特征方向上特别脆弱。综合来看,微分几何视角揭示:深度模型决策边界的形状不够平滑规整,存在曲率过大的薄弱环节,这使得对抗样本能够以最小的“能量”越过边界成功欺骗模型。

通过以上拓扑、分析和几何视角的解析,我们更全面地理解了对抗样本形成的原因:高维数据流形之外的大量空间给了攻击以可乘之机,模型的局部不稳定和决策边界弯曲则决定了这些攻击可以以何等微小的代价奏效。这些理论洞见也为提升模型鲁棒性指明了路径,例如通过流形约束、梯度正则和边界平滑等手段来弥补先天的结构缺陷。

4. 安全性问题与防御方案

深度学习模型的对抗脆弱性和不可解释性带来了严重的安全隐患。针对这些问题,研究者提出了多种防御策略。然而,每种方案都有其局限性,需要辩证地加以理解。

对抗样本攻击的防御策略大致可分为以下几类:

  • 对抗训练:将经过算法生成的对抗样本加入训练集中一同训练模型,使模型学会识别并抵抗这些微扰 (Adversarial Attack and Defense: A Survey)。这是目前最主要的防御手段之一,通过在训练阶段模拟攻击来增强模型鲁棒性。对抗训练在小规模数据集上显示出显著效果,但其局限在于对数据和计算量要求更高,而且在大规模数据集(如ImageNet)上训练和调参非常困难 (Adversarial Attack and Defense: A Survey)。即使经过对抗训练,模型的防御也不是牢不可破——往往攻击者稍作调整就能再次骗过模型 (Adversarial Attack and Defense: A Survey)。此外,对抗训练还可能降低模型对干净样本的精度,这体现了鲁棒性与准确率间的权衡。
  • 鲁棒优化:从优化的角度,将训练目标改为极小极大问题,提升模型在最坏情况下的性能。这与对抗训练本质相同,即在损失函数中加入对扰动的最大化过程,寻找模型决策在局部的最坏情况并据此更新参数。一些改进的方法如PGD(投影梯度下降)对抗训练、TRADES等,都属于鲁棒优化范畴。它们通过更强的攻击迭代或修改损失项来提高鲁棒性。然而,这类方法经常面临计算成本高昂的问题,而且当扰动范围增加或攻击方式改变时,模型鲁棒性可能急剧下降 (Adversarial Attack and Defense: A Survey)。鲁棒优化也难以防御分布外或物理世界中的攻击(如真实场景的光线变化、打印再拍摄攻击),因为这些超出了简单范畴内扰动的假设。
  • 正则化与随机化方法:通过在训练时加入各种正则项或在预测时对输入/模型进行随机扰动,来平滑模型决策边界,提高鲁棒性。例如,梯度正则化方法在损失中惩罚输入梯度的大小,使模型学习到更平缓的函数;随机噪声注入输入转化(如输入随机压缩、平移)在预测阶段扰乱潜在攻击者的信息。同样地,防御蒸馏(distillation)曾被提出通过压缩软标签知识来增强模型稳定性。这些方法有时能在非适应性攻击下减少对抗样本成功率,但很多被证明属于**“梯度掩蔽”**(gradient masking)技巧 (Towards Understanding and Improving Adversarial Robustness of Vision Transformers)——它们并未真正提高模型本质鲁棒性,而是通过隐藏有用梯度信息来暂时阻碍攻击。当攻击者认识到防御策略并进行相应调整后,这些防御常被攻破 (Towards Understanding and Improving Adversarial Robustness of Vision Transformers)。因此,仅依赖正则和随机手段往往不能提供持久可靠的安全保障。

尽管上述防御策略层出不穷,深度模型的安全性仍然令人担忧。这些防御的局限性在于:首先,大多数防御只针对已知的特定攻击,在遇到新型攻击或适应性攻击时失效。例如,一些防御通过让梯度不可导或不可用来阻止攻击,但改进的攻击(比如通过梯度估计或期望重写技术)仍能突破。其次,防御往往带来性能开销。对抗训练会降低模型对正常样本的精度,复杂正则项增加了训练难度,有些防御还需要额外的推理步骤。再次,许多防御缺乏理论保证,我们无法证明模型在某扰动范围内一定安全,只能不断地通过各种攻击来检验。事实上,近年来多个声称成功的防御在更强的白盒攻击下纷纷被攻破,表明安全对抗是一个动态的攻防军备竞赛

即便如此,这些研究为未来指明了改进方向。例如,对抗训练的发展催生了混合对抗训练特征层对抗训练等更强方法;鲁棒优化激发了认证鲁棒性研究,尝试从数学上证明模型对一定范围扰动是安全的;正则化手段则逐步与架构设计结合,出现了诸如利用随机平滑获得置信区间的方案等。总的来说,目前没有万无一失的防御——每种方法都有局限,但组合多种策略或探索全新思路可能带来突破。

5. 理论分析与未来发展

面对深度学习当前的局限性,研究者从更深层的理论角度分析问题,并探索未来的发展路径。下面讨论几个具有前瞻性的方向:

数据缺陷的量化表达:对于深度模型因数据导致的泛化问题,有学者借鉴物理概念提出了类似**“正交灾难”“不确定性原理”的观点加以描述。正交灾难指的是在高维空间中,不同样本或特征方向往往近似正交,导致模型难以在各方向上同时保持良好性能——在一个方向上精细拟合数据(降低误差),可能会牺牲在另一个正交方向上的泛化,从而陷入维度灾难的困境。这可以类比于量子多体系统中的正交性灾难:状态空间维度巨大,以致一个微小扰动就使系统基态与原本几乎正交,重叠率骤降。对应到深度学习,微小的分布变化可能令原模型与新形态的“真实函数”几乎无重叠,需要完全重新学习,这解释了模型对分布变化如此敏感的原因。同时,不确定性原理被用来类比深度模型中精度与鲁棒性**的不可同时最大化 (On The Uncertainty Principle of Neural Networks)。有研究提出,网络对输入的识别能力和对扰动的抗噪能力是一对互相制约的“共轭变量” (On The Uncertainty Principle of Neural Networks)——提高对特征的敏感度(提升精度)会降低对梯度扰动的鲁棒性,反之亦然 (On The Uncertainty Principle of Neural Networks)。这种观点将深度学习的权衡提升到原理层面,提示我们在设计模型时必须接受某种形式的折衷,如同测不准原理限制同时精确测定粒子的位置和动量一样。对这些现象的量化分析,能够加深我们对模型固有局限的理论理解,为突破现有瓶颈提供指引。

因果介入学习:鉴于深度学习混淆相关性与因果性的缺陷,融入因果推理被认为是未来的重要方向之一 () (〖深度学习〗因果推断与机器学习的高级实践 | 数学建模_问题根因 分析 机器学习-CSDN博客)。因果介入学习主张在模型中显式地考虑干预和反事实推断,让模型不仅“知其然”还要“知其所以然” (〖深度学习〗因果推断与机器学习的高级实践 | 数学建模_问题根因 分析 机器学习-CSDN博客)。具体途径包括:借助因果图谱和结构方程模型,将领域知识融入网络;在训练过程中对输入进行干预操作(如打破某些相关性,模拟因果试验),迫使模型区分直接原因和伴随因素;开发新型损失函数,使模型对因果不变特征的预测更优(如因果不变风险最小化)。已经有大量研究致力于因果表征学习,希望学习到的中间表示能对应真实的因果因素 (〖深度学习〗因果推断与机器学习的高级实践 | 数学建模_问题根因 分析 机器学习-CSDN博客)。通过因果介入,模型有望获得更稳定的泛化性能更强的可解释性,例如在面对分布变化时,只要因果机制不变,模型决策就应当不变。这对于实现真正可靠的人工智能至关重要。目前,包括科技巨头在内的很多研究团队都在积极探索将因果推断融入深度学习的方法 (〖深度学习〗因果推断与机器学习的高级实践 | 数学建模_问题根因 分析 机器学习-CSDN博客)。尽管这仍处于早期阶段,但它为克服关联学习的瓶颈提供了有力方向。

微分流形增强:上一节讨论的对抗漏洞表明,需要从数据流形的结构入手增强模型鲁棒性。未来模型或训练策略可能显式地考虑流形约束几何信息。一种思路是令模型的表示空间本身构建为一个更合理的流形,使得类内样本分布在紧致光滑的流形上、类间有明显间隔,减少不确定区域。例如,利用流形正则化,在训练时惩罚模型在流形邻域内的输出变化,鼓励决策边界顺着数据流形表面而非横切通过 (Manifold-driven decomposition for adversarial robustness - Frontiers)。又或者,结合流形学习方法(如流形降维、自回归流形建模),先学习数据所在的低维流形结构,再在该流形坐标系中训练分类器,从而避免高维空间那些无效区域的干扰。微分几何还启发我们关注决策边界的平滑度:未来的训练可能直接以降低边界曲率为目标,形成更“平坦”的分类区域,提高对抗鲁棒性。此外,拓扑层面的分析(如利用代数拓扑的持久同调等)也可用于约束模型,使其决策边界拓扑结构与数据真实分类结构一致,不出现奇异的决策区域。从业界进展看,已经有一些针对特定任务的流形防御措施(如在人脸识别中将对抗样本投影回人脸图像流形)取得了积极效果。总体而言,将深度学习与微分流形/拓扑分析结合,有望打造出更理解数据几何结构、更稳健可靠的模型。

量子化正则化:这里的“量子化”并非专指量子计算,而是泛指离散化/量化技术对模型的正则作用。一方面,将模型权重和激活进行数值量化可以减少自由参数的表示能力,从而在一定程度上防止过拟合,提高泛化性能。这类似于把连续的参数空间用栅格划分,模型无法表示非常精细的差异,从而自然具有滤除高频噪声的效果。另一方面,量子力学中的某些原理也被借鉴来改进正则化手段。例如,有人提出利用量子态塌缩机制来随机正则网络权重,使模型在训练过程中跳出某些陷阱解;或者利用量子叠加/纠缠思想构造新的激活函数和正则项,迫使网络学到更具鲁棒性的表示 (Quantum adversarial machine learning | Phys. Rev. Research) ((PDF) Quantum adversarial machine learning - ResearchGate)。此外,真正的量子机器学习也在兴起,利用量子算法求解经典网络的优化问题、或构造量子神经网络等。如果将来量子计算机足够成熟,或许可以训练出内在就具有抗噪性的量子化模型(因量子系统天然服从不确定性原理约束)。当然,目前这些都处于探索阶段,但“量子化”思想提供了一种跳出现有框架限制的新视角,即从离散化与物理原理角度重新审视模型复杂度与泛化的平衡。

新型架构的实践进展:深度学习架构的革新也被寄予厚望以改进模型的局限性。以Vision Transformer (ViT)为代表的自注意力模型是近年出现的与卷积网络不同的新架构。ViT在图像领域不依赖卷积结构,而是采用全局自注意力机制,一开始人们希望这种架构能缓解CNN某些固有偏差(例如CNN偏重局部纹理)。实践表明,Transformer在某些方面展现出与CNN不同的泛化特性和鲁棒性。有研究指出,在采用对抗训练时,ViT在对抗攻击下的泛化性能可能优于同等条件下的CNN (Exploring Adversarial Robustness of Vision Transformers in the Spectral Perspective);但也有研究发现,Transformer在某些频率域扰动下甚至更脆弱 (Exploring Adversarial Robustness of Vision Transformers in the Spectral Perspective) (Exploring Adversarial Robustness of Vision Transformers in the Spectral Perspective)。总体来看,ViT等新模型并非对局限性免疫:它们仍需要大量数据预训练,在缺乏归纳偏置的情况下甚至更依赖数据;同时自注意力机制本身也会遭受对抗攻陷(如针对补丁的攻击)。不过,好消息是,ViT的出现拓宽了架构设计空间,启发了诸如混合架构(结合卷积和注意力)、更强归纳偏置的Transformer(如嵌入位置编码的先验)等探索。这些最新架构为研究模型结构与泛化/鲁棒性的关系提供了新的试验平台。例如,通过比较CNN和Transformer对抗扰动的反应,我们可以更深入了解是什么导致了模型的脆弱性,并据此改进架构设计。未来的模型或许会融合多种机制,既拥有卷积的局部稳定,又具备注意力的全局灵活,以在复杂任务中取得更好的稳健性和平衡性能。

总结展望:深度学习的局限性既源于算法范式(数据驱动的相关学习),也与工程实现(模型结构、训练数据)密切相关。理论分析为我们揭示了这些问题背后的深层原因,如信息瓶颈、维度灾难、对抗攻防中的基本权衡等。在未来的发展中,一个共识是:仅靠堆积数据和参数规模难以彻底克服当前瓶颈,我们需要在学习范式上有所突破。这可能意味着结合因果推理引导学习、融入物理世界的先验和约束、设计更具透明性和模块化的模型,以及跨越经典与量子的思维来正则化学习过程。当下的研究已经在朝这些方向前进,同时新的架构(如ViT)和训练策略也不断涌现,为改进提供了契机。可以预见,未来的深度学习模型将不再是纯粹的数据相关性黑盒,而将逐步朝着更懂因果、更几何鲁棒、更加可控可靠的智能体演进。在这个过程中,本文讨论的各方面局限性研究将持续发挥作用,指导我们迈向下一个人工智能阶段的里程碑。

参考文献:

【1】 Valerii Likholetov. Limitations of Deep Neural Networks. arXiv preprint arXiv:2012.15754, 2020: pp.3-4. ()

【2】 Valerii Likholetov. Limitations of Deep Neural Networks. arXiv preprint arXiv:2012.15754, 2020: p.7. ()

【3】 Valerii Likholetov. Limitations of Deep Neural Networks. arXiv preprint arXiv:2012.15754, 2020: pp.7-8. () ()

【4】 Valerii Likholetov. Limitations of Deep Neural Networks. arXiv preprint arXiv:2012.15754, 2020: p.5. ()

【5】 Valerii Likholetov. Limitations of Deep Neural Networks. arXiv preprint arXiv:2012.15754, 2020: pp.5-6. () ()

【6】 Valerii Likholetov. Limitations of Deep Neural Networks. arXiv preprint arXiv:2012.15754, 2020: p.6. ()

【7】 Valerii Likholetov. Limitations of Deep Neural Networks. arXiv preprint arXiv:2012.15754, 2020: p.10. ()

【8】 CSDN博文. 深度学习因果推断与机器学习的高级实践, 2024. (〖深度学习〗因果推断与机器学习的高级实践 | 数学建模_问题根因 分析 机器学习-CSDN博客) (〖深度学习〗因果推断与机器学习的高级实践 | 数学建模_问题根因 分析 机器学习-CSDN博客)

【9】 CSDN博文. 深度学习因果推断与机器学习的高级实践, 2024. (〖深度学习〗因果推断与机器学习的高级实践 | 数学建模_问题根因 分析 机器学习-CSDN博客)

【10】 Marc Khoury, Dylan Hadfield-Menell. On the Geometry of Adversarial Examples. ICLR 2019. (On the Geometry of Adversarial Examples | OpenReview)

【11】 Marouan Benidir et al. Multivariate Lipschitz Analysis of the Stability of Neural Networks. Frontiers in Signal Processing, 2022. (Frontiers | Multivariate Lipschitz Analysis of the Stability of Neural Networks)

【12】 Francesco Croce et al. Robustness via Curvature Regularization, and Vice Versa. CVPR 2020. ([PDF] Robustness via Curvature Regularization, and Vice Versa)

【13】 Zhen Xiang et al. On the Uncertainty Principle of Neural Networks. arXiv preprint arXiv:2205.01493, 2023: pp.6-7. (On The Uncertainty Principle of Neural Networks)

【14】 Hongshuo Liang et al. Adversarial Attack and Defense: A Survey. Electronics, 11(8):1283, 2022: pp.15-16. (Adversarial Attack and Defense: A Survey)

【15】 Samyak Jain et al. Towards Understanding and Improving Adversarial Robustness of Vision Transformers. CVPR 2024. (Exploring Adversarial Robustness of Vision Transformers in the Spectral Perspective) (Exploring Adversarial Robustness of Vision Transformers in the Spectral Perspective)

【16】 TensorFlow Tutorial: Adversarial example using FGSM. TensorFlow官方教程, 2022.

 

 

【相关】

深度学习的基石:多层感知机

一、单层感知机的致命缺陷

要理解多层感知机的突破性,我们先看一个经典案例:假设我们需要实现“异或”逻辑(XOR),定义如下:

| 输入A:0 | 输入B:0 | 输出:0 |
| 输入A:0 | 输入B:1 | 输出:1 |
| 输入A:1 | 输入B:0 | 输出:1 |
| 输入A:1 | 输入B:1 | 输出:0 |

当我们在坐标系中绘制这些点时,会发现正例(0,1)和(1,0)位于对角线两侧,形成一个典型的非线性可分问题。单层感知机的决策边界只能是直线,就像试图用一把直尺分开两堆交叉摆放的硬币——这是数学上证明不可能完成的任务(闵斯基1969年证明)。

二、解法:特征空间升维

关键思路:通过增加隐藏层,将原始二维输入投影到三维特征空间。

我们设计两个特殊神经元:

神经元H₁:激活条件 = 1*A + (-1)*B > 0.5
神经元H₂:激活条件 = (-1)*A + 1*B > 0.5

输入变换过程

当输入(1,0)时:

H₁:1*1 + (-1)*0 = 1 → 激活
H₂:(-1)*1 + 1*0 = -1 → 不激活

当输入(0,1)时:

H₁:1*0 + (-1)*1 = -1 → 不激活
H₂:(-1)*0 + 1*1 = 1 → 激活

当输入(1,1)时:

H₁:1*1 + (-1)*1 = 0 → 不激活
H₂:(-1)*1 + 1*1 = 0 → 不激活

此时特征空间变为:

| 原始输入:(0,0) | 隐藏层特征 :(0,0) |
| 原始输入:(0,1) | 隐藏层特征 :(0,1) |
| 原始输入:(1,0) | 隐藏层特征 :(1,0) |
| 原始输入:(1,1) | 隐藏层特征 :(0,0) |

神奇的事情发生了——原本线性不可分的问题,在特征空间中被转换为线性可分问题!

三、输出层

在输出层,我们只需一个简单的OR逻辑:

输出 = H₁ OR    H₂

此时只需一条直线就能完美分割正负例。这种「空间变换+线性分割」的思想,正是深度学习突破维度诅咒的武器。现代神经网络中,每个隐藏层都在进行更复杂的空间扭曲,最终在高维特征空间中用超平面分割数据。

四、数学本质:非线性变换

整个过程可视为:

f(X) = σ(W₂·σ(W₁X + b₁) + b₂

其中:

W₁是第一层权重矩阵 [[1,-1], [-1,1]]
b₁是偏置向量 [-0.5, -0.5]
σ是阶跃激活函数
W₂是输出层权重 [1,1]
b₂是输出偏置 -0.5

这个结构实现了:
1. 第一层:将输入空间扭曲为线性可分的新空间
2. 第二层:在新空间中进行线性分类

传统OR门的感知机表达式:

输出 = 1*H₁ + 1*H₂ - 0.5 > 0

每个输入的权重都是1,表示H₁和H₂同等重要
当任意一个输入为1时,加权和为1;两个都为1时和为2
设置阈值0.5(移项后表达式为加权和 > 0.5)
只要有一个输入为1(1 > 0.5),即触发激活
两个都为0时(0 > 0.5)不激活


用真值表验证公式的正确性:

H₁ H₂ 计算过程 结果
0 0 0+0-0.5 = -0.5 0
0 1 0+1-0.5 = 0.5 1
1 0 1+0-0.5 = 0.5 1
1 1 1+1-0.5 = 1.5 1

(注:在XOR场景中,H₁和H₂不会同时为1,最后一行为理论验证)

用Python实现这个经典XOR网络:

import numpy as np

# 定义网络结构
W1 = np.array([[1, -1], [-1, 1]])  # 第一层权重
b1 = np.array([-0.5, -0.5])        # 第一层偏置
W2 = np.array([1, 1])              # 输出层权重
b2 = -0.5                          # 输出层偏置

def perceptron(X):
    # 第一层计算
    h = np.heaviside(np.dot(X, W1) + b1, 0)
    # 输出层计算
    return np.heaviside(np.dot(h, W2) + b2, 0)

# 测试所有输入
inputs = [[0,0], [0,1], [1,0], [1,1]]
for x in inputs:
    print(f"输入{x} → 输出{perceptron(x)}")

输出结果:

输入[0, 0] → 输出0
输入[0, 1] → 输出1
输入[1, 0] → 输出1
输入[1, 1] → 输出0

六、历史意义与延伸

这个简单案例揭示了深度学习的核心思想:

- 层次化处理:如同视觉皮层V1→V2→V4的信息处理流程
- 分布式表示:单个概念由多个神经元协同表示
- 端到端学习:现代网络通过反向传播自动学习W,b参数

今天的Transformer架构依然延续这个基本原理,只是:

- 隐藏层数从2层增加到数百层
- 手动设计参数变为自动优化
- 阶跃激活变为ReLU等平滑函数
- 增加了注意力机制等复杂交互

理解这个案例,就掌握了理解深度学习的钥匙——任何复杂网络,本质上都是这个「俄罗斯套娃」结构的扩展与优化。

 

左脚踩右脚可以飞吗,谈交替使用监督微调和强化学习的后训练

交替使用监督微调(SFT)与强化学习(RL)的策略探讨

在大模型后训练中,像deepseek R1那样交替使用监督微调(SFT)和强化学习(RL),而非单一依赖 RL 或蒸馏,背后的核心逻辑如下。


1. 交替使用 SFT 和 RL 的根本动因

(1) 训练稳定性与策略纠偏

    • RL 的脆弱性
      强化学习高度依赖奖励函数设计,但在现实任务中,奖励信号往往稀疏(例如数学推理任务中仅有最终答案正确性的反馈)或含有噪声(如人类反馈存在标注误差)。如果长期仅依靠 RL,模型可能陷入局部最优,生成虽能获得高奖励却逻辑混乱的答案。
    • SFT 的锚定作用
      定期引入 SFT 训练,通过高质量数据(如人工修正的思维链或模型“拒绝采样”而过滤的思维链)校正模型生成分布,可以有效防止 RL 阶段过度偏离合理路径。例如,DeepSeek-R1 在第二阶段 RL 后,通过 SFT 数据,成功修复了模型在复杂不等式推导中出现的符号错误。

(2) 数据效率与知识复用

    • RL 的数据饥渴性
      生成有效的 RL 训练数据(如通过模型自身采样获得的推理轨迹)成本极高。以 Open-R1 项目为例,每天需用 512 块 H100 GPU 生成 18 万条轨迹,其中只有约 30% 能通过数学验证。【依据细节待查验】
    • SFT 的快速收敛优势
      在关键能力瓶颈期(例如模型无法处理多步逻辑组合时),直接注入少量精标的 SFT 数据(如 5000 条人工编写的分步解析)能迅速突破性能瓶颈,避免 RL 长时间的探索过程。R1第一步的冷启动即是如此。

(3) 防止灾难性遗忘

    • RL 的窄化效应
      当 RL 过度优化特定任务(如数学证明)时,模型可能会牺牲其他能力(例如常识推理)。有研究表明,纯 RL 训练的模型在 MATH 数据集上准确率提升了 5%,但在 TruthfulQA 上真实性得分下降了 8%。【依据细节待查验】
    • SFT 的全域校准
      通过混合多领域 SFT 数据(例如同时包含数学题和事实核查问答),可以有效维持模型的通用性。DeepSeek-R1 第三阶段的混合数据微调正是基于这一设计理念。

2. 为何不持续使用 RL 或仅用蒸馏?

(1) RL 的固有局限性

    • 奖励假设的不可靠性
      RL 假设奖励函数能够完全表征任务目标,但在复杂任务中,这一假设几乎难以成立。例如,代码生成任务若仅以单元测试通过率作为奖励,模型可能生成通过测试但存在安全漏洞(如缓冲区溢出)的代码。
    • 策略坍塌风险
      长期 RL 训练可能导致模型策略多样性丧失。在对话任务中,模型可能反复生成高奖励但公式化、缺乏创意的回答,从而损害用户体验。

(2) 蒸馏的适用边界

    • 表达能力损失
      蒸馏通过模仿教师模型的输出分布实现知识迁移,但这种方式往往会丢失隐式推理能力。例如,DeepSeek-R1-Zero 的蒸馏版本在多跳推理的 MATH 题目上性能较原模型下降了约 12%。【依据细节待查验】
    • 教师依赖陷阱
      蒸馏效果受限于教师模型的整体质量。如果教师模型存在系统性错误(如物理常识错误),学生模型难以自主纠正,而 RL 能够利用环境反馈及时修正此类错误。

3. 交替循环的深层价值

(1) 螺旋式能力进化

    • SFT → RL 的递进
      SFT 阶段提供了基本能力的锚点,RL 则在此基础上探索更优策略。例如,模型在 SFT 阶段学会标准数学符号的使用,随后通过 RL 发现了更简洁高效的路径。
    • RL → SFT 的修正
      RL 阶段暴露出的不足(如过度简化关键步骤)可以通过新一轮 SFT 注入数据进行修正。这种交替循环类似于人类“学习-实践-反思”的认知过程。

(2) 多目标动态平衡

    • 性能与安全性的博弈
      纯 RL 可能为追求高得分而牺牲安全性,例如生成偏激或不当内容。而定期使用 SFT 注入经过伦理审查的数据,可以动态约束模型输出,确保既有高性能又符合安全规范。
    • 通用与专用的适配
      交替训练使得模型既能通过 SFT 保持广泛适用性(如客服对话),又能通过 RL 深耕垂直场景(如医疗诊断中的检查项推荐),从而在多种任务上均表现出色。

总结:交替策略的系统性优势

    • 风险控制:通过 SFT 定期校准,规避了 RL 训练过程中可能出现的失控风险。
    • 资源优化:在 RL 数据生成成本与 SFT 标注成本之间取得了良好的平衡。
    • 能力完备性:既兼顾了 SFT 的模仿学习规范性,又融合了 RL 的探索学习创造性,最终实现了模型能力的稳健提升。

这种交替策略实际上是将“定向引导”与“自由探索”相结合,既避免了纯 RL 的“野蛮生长”,也超越了纯 SFT 的“照本宣科”,最终实现了模型综合能力的全面进化。同时,尽管蒸馏在某些场景下(如移动端轻量化)有其独特优势,但它并不能替代这种系统性的优化路径。

 

【相关】


o3 Deep Research: DeepSeek R1 多阶段训练流程问答解析

好的,我将对 DeepSeek R1 的整体训练过程进行研究,并重点分析强化阶段(第二、三、四阶段)的具体细节,包括 RL、SFT、CoT 的方法和策略。

报告将采用问答解析的形式,同时保持一定的技术深度,并确保可读性。还会在必要时提供与 GPT-4、Claude、Gemini 等模型的简单核心对比,以展示其独特性。

我会尽量参考 DeepSeek 官方网站的论文和技术资料,同时结合网络上的研究和学习经验进行综合分析。

DeepSeek R1 多阶段训练流程问答解析

Q1: DeepSeek R1 的整体训练包含哪些阶段,为什么采用多阶段策略?

A: DeepSeek R1 采用了四阶段的训练流程,包括两个强化学习(RL)阶段和两个监督微调(SFT)阶段 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)。这一多阶段策略旨在先通过少量数据稳定模型输出格式,然后大规模提升推理能力,接着扩展通用能力,最后对齐人类偏好,逐步打造出既擅长推理又安全实用的模型 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园) (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)。具体来说:

通过上述多阶段渐进式训练,DeepSeek R1 最终在推理能力上达到接近OpenAI o1系列闭源模型的水平,同时保持了输出的规范性和对用户需求的良好适应 ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning) (阅读 | DeepSeek-R1:怎么用强化学习把一个普通语言模型调教成推理高手?_腾讯新闻)。

Q2: 第二阶段的推理强化学习是如何实施的?训练是逐个问题进行还是批量进行?训练数据是否会保留?奖励机制如何设计?

A: 阶段2是针对推理能力的强化学习训练。在这一阶段,DeepSeek R1 采用了GRPO算法(分组相对策略优化)来高效地进行RL训练 ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning)。具体来说,对每个问题,不会只生成单一回答,而是从当前策略采样一组不同的回答,然后根据这组回答的得分情况来优化模型 ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning) ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning)。这种“按问题分组”的方式相当于批量生成和评价:每道训练题目产生多个解答,计算每个解答的奖励,并用组内奖励的相对差异(优势值)指导模型参数更新 ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning)。由于采用组内平均得分作为基准(baseline),GRPO 不需要额外的价值网络(critic),降低了大模型RL的开销 ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning)。因此,就单个问题而言是通过多次尝试来强化,但在实现中会并行处理多个问题批次,以加速训练。每轮生成的回答在用于计算梯度更新后并不长期保留,属于在线的RL采样;只有当阶段2训练收敛后,会使用最终的模型来批量生成数据供下阶段使用 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)。

奖励机制方面,DeepSeek R1 在此阶段设计了规则奖励,主要包括:

最终,以上各项奖励会加权求和形成总奖励 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)。模型通过最大化期望奖励来更新参数:正确且格式规范、语言一致的回答获得最高回报,从而模型逐步学会既推理正确表述规范地回答问题 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)。

值得一提的是,DeepSeek R1-Zero(没有冷启动微调的版本)在纯RL下已经自行涌现出了反思验证、超长链式推理等强大能力,但同时输出可读性差、语言混杂 (阅读 | DeepSeek-R1:怎么用强化学习把一个普通语言模型调教成推理高手?_腾讯新闻) (阅读 | DeepSeek-R1:怎么用强化学习把一个普通语言模型调教成推理高手?_腾讯新闻)。因此在 R1 中通过以上冷启动和奖励改进,显著改善了这些问题 (阅读 | DeepSeek-R1:怎么用强化学习把一个普通语言模型调教成推理高手?_腾讯新闻)。阶段2 的RL训练让模型的推理准确率在数学等任务上大幅提升(例如 AIME 数学竞赛准确率从15.6%提高到71% (阅读 | DeepSeek-R1:怎么用强化学习把一个普通语言模型调教成推理高手?_腾讯新闻)),为后续步骤打下强大的推理基础。训练过程中产生的大量问答尝试并未直接用于模型参数更新之外的用途,而是在训练完成后经过筛选用于下一阶段的数据集构建 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)。

Q3: 第三阶段为什么要用 60 万条推理再生数据和 20 万条非推理数据进行微调?这一混合微调策略有何作用?

A: 阶段3是承上启下的监督微调,目的是在保持高推理能力的同时扩展模型的通用能力 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)。之所以采用“60万推理 + 20万非推理”的数据组合,主要有以下考虑:

Q4: 第四阶段为何需要再次进行强化学习?这一阶段是如何结合人类偏好进行对齐的,人类偏好对齐有什么必要性?

A: 阶段4是DeepSeek R1的二次强化学习阶段,核心目的在于对齐人类偏好,进一步提升模型在实际应用中的安全性和实用性 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)。即使经过阶段2和阶段3,模型在推理和一般任务上已表现出色,但仍可能存在不符合用户期望的行为,例如回答不够礼貌有用,或在敏感问题上产生不安全内容。这正是当前尖端LLM都会面临的问题,需要引入人类偏好对齐(例如 OpenAI 的GPT-4通过RLHF过程进行对齐)。对于DeepSeek R1,这一阶段通过融合人类偏好相关的奖励信号来微调模型,使其行为更符合人类期望 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)。具体而言:

通过上述措施,阶段4 实现了模型行为和人类期望的深度对齐,相当于执行了一次RLHF式(基于人类反馈的强化学习)训练。 (阅读 | DeepSeek-R1:怎么用强化学习把一个普通语言模型调教成推理高手?_腾讯新闻)在对齐后,DeepSeek R1 兼具强大的推理能力和良好的安全性/有用性:既能给出复杂问题的正确解答,又能确保回答让用户容易理解、愿意接受,在敏感问题上遵循安全准则 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园) ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning)。这种人类偏好对齐对于模型大规模应用是必要的 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园)——它保证模型不会因为追求高推理准确率而忽略了与用户互动的品质,确保模型的高智商能够以让人类舒适的方式呈现出来。换句话说,经过阶段4,DeepSeek R1 不仅是“推理高手”,也是“贴心助手”。

Q5: DeepSeek R1 与 GPT-4、Anthropic Claude、Google Gemini 等顶尖模型有哪些核心差异?

A: DeepSeek R1 的训练路线与这些闭源大模型有一些独特之处,但总体目标相似(都追求强性能和对齐人类意图)。主要区别在于:

综上,DeepSeek R1 展现了一条与主流商用大模型不同但并行的研发路线:用较少人工介入、充分利用RL自我提升推理,再辅以必要的监督和对齐,来培养强大的通用AI。这为业界提供了新思路,也使研究者能够探究在不开天量数据集的情况下提升模型智力的可能 (The Illustrated DeepSeek-R1 - by Jay Alammar) (The Illustrated DeepSeek-R1 - by Jay Alammar)。各模型各有侧重,但目标殊途同归:让AI既“智商高”又“情商高”,能真正解决问题并让用户放心使用。

**参考文献:**

DeepSeek R1 官方论文 ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning) ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning)及技术报告、DeepSeek 官方博客和数据集说明 (DeepSeek-R1的四个训练阶段 - 蝈蝈俊 - 博客园) ([2501.12948] DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning),以及相关分析文章和讨论 (阅读 | DeepSeek-R1:怎么用强化学习把一个普通语言模型调教成推理高手?_腾讯新闻) (阅读 | DeepSeek-R1:怎么用强化学习把一个普通语言模型调教成推理高手?_腾讯新闻)。

上述内容综合了官方资料与社区解读,以问答形式呈现,希望对DeepSeek R1的训练策略有全面而清晰的说明。

 

后记

才试了一下 openai o3 最新推出的 deep research 功能,不能不说,作为研究工具,非常给力,完成后的成品具有直接发表的水平,想做一点后编辑都难。有点叹为观止的感觉,堪称完美。当然,现在各家头部模型都开始 offer 这种“深度研究”的功能了,这等于是平替了大多数咨询公司的研究人员的工作。即便是训练有素的数据分析和调研人员,多数人实际上做不了它这么全面和细致。最见功力的是它的引用的全面和细密。说话有根据,幻觉自然减少。

【相关】

Dilemma of RPA and Early-Stage LLM Co-pilot Entrepreneurs in the Age of Agent Tsunami

As large language models (LLMs) surge forward, LLM Agents are reconstructing the automation landscape at unprecedented speed. This revolution not only threatens traditional RPA (Robotic Process Automation, reliant on rule engines or small models) but also pushes early-stage co-pilot application builders to the edge of a cliff. At its core, this technological shift represents two fundamental disruptions: 
1. Natural language interaction overpowering low-code programming in complex, dynamic, unstructured data scenarios. 
2. General intelligence violently overshadowing shallow vertical solutions.

"Triple Disruption" of LLM Agents

1. Paradigm Shift: From "Low-Code" to "Emergent Intelligence"

- Traditional RPA: Engineers script step-by-step logic (e.g., UiPath’s drag-and-drop designer), akin to teaching robots to hop grids – brittle and error-prone.
- LLM Agent: Directly interprets human intent (e.g., "Extract invoice data from emails into the system"), autonomously decomposes tasks, and dynamically adjusts execution paths.
- Case Study: ChatGPT plugins already book flights or fetch data via API calls, while traditional RPA requires low-code scripting for equivalent functions.

2. Moat Erosion: Data Barriers vs. General Intelligence

Pre-LLM RPA Moats:
Industry know-how (e.g., nuances of financial reimbursement workflows) + custom deployment capabilities + template libraries.
Reality: Most RPA firms accumulated shallow industry exposure rather than deep vertical data expertise.

LLM’s Breaching Tactics:
- Digests unstructured documents (e.g., diverse invoice formats) via multimodal vision and computer use capabilities.
- Adapts to new workflows via zero-shot Chain-of-Thought (CoT) reasoning (e.g., interpreting vague commands like "Sync key contract terms to CRM").

Final Blow: As standardized scenarios get natively covered by leading LLMs (including reasoning models), RPA’s last defense – proprietary industry APIs – is being devoured by LLM vendors’ customization and privacy solutions.

3. Ecosystem Cannibalization: From "Tool Vendor" to "LLM-native Layer"

Early Co-pilot Traps:
Products like Character.ai (personalized chatbots) and Jasper (writing/marketing assistants) – essentially thin wrappers over base models – crumble when ChatGPT launches role presets or DALL·E 3 plugins.

Survivor Playbooks:
- Perplexity.ai: Carves a niche with real-time search + academic citations (fixing LLM hallucination).
- Cursor: Builds vertical moats via developer workflow integration (codebase semantics, AI pair programming).

Industry Upheaval in RPA

- UiPath’s stock plummets from 2021 highs; its "Autopilot" feature (English-to-automation) criticized as a "GPT-4 wrapper."
- Microsoft Power Automate integrates Copilot, generating cloud workflows from natural language prompts.
- Adept (AI-for-computer-actions startup) hits $1B+ valuation, directly threatening RPA’s existence.

Survivor’s Map: Niches Resisting the LLM Tide

1. Deep Verticalization
- Cursor: Dominates IDE ecosystems via VSCode extensions and developer workflow data.
- Harvey (legal AI): Trains on LexisNexis corpus + private deployment for compliance.

2. Real-Time Data Masters
- Perplexity.ai: Search engine-grade indexing + academic database partnerships.
- Hedgeye (finance): Aggregates Bloomberg/Reuters feeds + proprietary prediction models.

3. Hardware Fusion
- Covariant: Embeds LLMs into warehouse robotics, leveraging mechanical barriers.
- Tesla Optimus: Physical-world operation via embodied AI, evading pure-digital competition.

Agent Startup Pitfalls & Counterstrategies

Common Traps

- Thin Model Wrapping
Issue: Repackaging ChatGPT prompts as "AI customer service" adds no real value.
Fix: Develop domain-specific features (e.g., clinical decision support requiring privacy-sensitive data pipelines).

- Over-Reliance on Fine-Tuning
Issue: Claiming "medical LLM" after basic terminology tuning ignores the need for closed-loop clinical workflows.
Fix: Build proprietary data flywheels and scenario-optimized architectures.

- Ignoring Enterprise Needs
Issue: Overlooking security, SLA guarantees, and system integration.
Fix: Architect enterprise-grade frameworks for organizational deployment.

Differentiation Strategies

- Workflow Integration Specialists: Develop deep connectors for niche scenarios (e.g., legal document parsing).
- Human-AI Orchestrators: Design quality control layers and manual override mechanisms.
- Vertical Knowledge Engineers: Curate domain-specific benchmarks and evaluation protocols.

RPA’s Last Stand

While battered, RPA retains residual value in:

- High-compliance scenarios: Auditable/traceable workflows (e.g., financial regulations).
- Legacy system integration: Stability in outdated IT environments.
- Ultra-high precision demands: Deterministic execution for core systems (e.g., stock trading).


Challenges for Early Co-pilot Entrepreneurs

Two fatal flaws plague AI application startups: 
1. No proven scaled success cases – LLMs are barely 2-3 years old, leaving co-pilots (beyond chatbots) unvalidated for commercial viability. 
2. Vulnerability to LLM upgrades – Without exclusive industry data or customer channels, co-pilot startups risk being crushed by foundational model advancements.

The Inevitable Conclusion

LLM Agents are replaying cloud computing’s annihilation of on-prem servers: foundational capabilities get standardized (like AWS replacing data centers), while vertical opportunities spawn new giants (like Snowflake). RPA and generic Agent startups must either:
1. Become vertical domain experts, or
2. Master human-AI collaboration architectures

... or face obsolescence as LLM agents absorb 90% of automation value. The silver lining? This disruption will unlock an automation market 100x larger than the RPA era – but tickets are reserved for those who architect vertically fused, LLM-empowered solutions.

As Sam Altman warned: Avoid building what foundational models will inevitably swallow.

 

 

【相关】

RPA 赛道与大模型Copilots早期创业者的困局

在大模型技术狂飙的当下,LLM Agents(基于大语言模型的智能体)正以前所未有的速度重构自动化版图。这场革命不仅冲击着传统 RPA(机器人流程自动化)的生存空间,更将早期依赖规则引擎或小模型的RPA创业者以及co-pilot的大模型应用的早期创业者逼至悬崖边缘。这场技术迭代的本质,是在复杂、多变、非结构化数据处理的自动化场景下,自然语言交互对低代码编程的降维打击,更是通用智能对浅垂直场景的暴力覆盖。

一般而言,作为agent的早期形式,co-pilot创业的有两大问题:第一是没有成功案例可循,因为LLM才两三年,还没来得及给除了chatbot以外的copilot证明其商业闭环的机会。第二是co-pilot创业如果没有深厚的独家行业数据基础以及客户渠道,就非常容易把自己定位在大模型的迭代升级的路口上,被大模型升级所碾压。

一、LLM Agents 的 "三重碾压效应"

1. 技术路径的颠覆:从 "低代码" 到 "自然涌现"

- 传统 RPA:依赖工程师编写脚本或流程图(如 UiPath 的拖拽式设计器),需精准定义每一步操作逻辑,如同教机器人跳格子,容错率低。
- LLM Agent:直接理解人类意图("把邮件里的发票信息录入系统"),自主拆解任务链条,动态调整执行路径。
- 典型案例:ChatGPT 插件系统已能调用 API 完成订机票、查数据等操作,而传统 RPA 实现同等功能需低代码脚本。

2. 护城河的瓦解:数据壁垒 vs 通用智能

- 前大模型时代的 RPA 壁垒

行业 know-how(如财务报销流程的细微差异)+ 客户定制化部署能力 + 长期积累的模板库。

但多数RPA公司本来的业务就是深入各行各业办公室的小批次业务累积,而不是垂直行业的数据深耕,基本没有多少垂直行业的门坎。

- LLM Agent 的破壁逻辑

- 通过大模型视觉以及电脑使用(Computer Use)能力直接消化非结构化文档(如五花八门的发票格式)以及模拟人类使用网络(而不是调用API)
- 通过思维链(CoT)零样本学习适应新业务流程(如理解 "将合同关键条款同步到 CRM" 的模糊指令)
- 致命打击:当大部分标准化场景被头部大模型(包括推理模型)原生覆盖,RPA 仅存的护城河只剩特定行业的私有数据接口——而这块蛋糕正被大模型厂家的的定制化、私有部署以及隐私保护能力所蚕食。

3. 生态位的吞噬:从 "工具提供商" 到 "基础设施层"

- 早期 Copilot 创业者的困境:

- Character.ai(个性化对话角色)、Jasper(营销文案生成)等曾风光一时的产品,本质上是对基础模型能力的浅层封装。
- 当 ChatGPT 开放角色预设功能和 DALL·E 3 插件,这些 "中间件" 的生存空间被急剧压缩。

- 幸存者法则:

- Perplexity.ai 以实时搜索+学术级引用杀出血路(弥补了通用模型的事实性缺陷)
- Cursor 通过深度绑定开发者工作流(代码库语义检索、AI 结对编程)建立垂直壁垒

二、RPA 赛道的行业剧变

- UiPath 股价较 2021 年高点严重下跌,其推出的 Autopilot 功能( "用英语描述自动化流程")被用户吐槽为 "套壳 GPT-4"
- 微软 Power Automate 全面接入 Copilot,支持 "描述你想要自动化的任务" 直接生成云端工作流
- 硅谷明星创业公司 Adept(专注训练 AI 执行电脑操作)估值突破 10 亿美元,直接威胁 RPA 生存根基

三、幸存者地图:哪些赛道还能抵抗 LLM 洪流?

1. 重度垂直型

- Cursor 的代码助手:深度集成 IDE 生态(利用VSCode 扩展市场的高占有率),掌握开发者真实工作流数据
- Harvey(法律 AI):通过LexisNexis法律特有语料训练理解法律术语+私有化部署解决合规问题

2. 实时数据型

- Perplexity.ai:构建搜索引擎级索引体系+ 学术数据库独家合作
- Hedgeye(金融分析):聚合 Bloomberg/Reuters 实时行情+行业独家预测模型

3. 硬件耦合型

- Covariant 仓储机器人:将 LLM 与机械臂控制算法深度融合,硬件壁垒延缓大模型侵蚀速度
- Tesla Optimus:通过具身智能实现物理世界操作,暂时规避纯数字自动化竞争

四、Agent 创业的陷阱与对策

常见陷阱

    1. 简单封装大模型
      • 问题:仅对通用大模型进行表层封装,缺乏实质性增值,例如将 ChatGPT 的提示词模板包装成 "智能客服系统"
      • 修正:开发特定领域专用功能,针对垂直场景深度优化
    2. 过度依赖微调
      • 问题:认为对大模型进行简单微调就能构建竞争壁垒,例如微调行业术语就标榜 "医疗大模型",实则临床决策支持需要具有高度隐私敏感的“地下”数据综合能力
      • 修正:构建专有数据闭环和场景优化的工作流程,形成实质性差异
    3. 忽视企业级需求
      • 问题:不重视安全合规、SLA保障和系统集成
      • 修正:构建企业级功能框架,满足组织级部署要求

差异化策略

    1. 工作流集成专家
      • 聚焦特定工作场景深度集成
      • 开发专用连接器和数据通道
    2. 人机协作架构师
      • 设计高效的人机分工模式
      • 构建质量监控和人工干预机制
    3. 行业知识库构建者
      • 整合垂直领域专业知识
      • 开发领域特定的评估标准

RPA 的剩余价值: 虽然 LLM Agent 冲击巨大,但 RPA 并非完全没有生存空间。RPA 在以下方面具有剩余价值:

    • 合规性要求高的场景: RPA 流程的可审计性和可追溯性可能更符合某些行业的合规要求。
    • 与遗留系统的集成: 在某些遗留系统集成方面,RPA 可能比 LLM Agent 更成熟和稳定。
    • 超高精度和稳定性的需求: 在极少数对精度和稳定性要求极高的场景下,例如金融交易核心系统,RPA 的确定性执行可能更受青睐。

残酷结论

LLM Agents 正在重演云计算淘汰本地服务器的历史:通用能力标准化底层服务(AWS 取代企业机房),垂直场景留给细分玩家(Snowflake 在云上长成数据仓库巨头)。RPA 和早期 Agent/Copilot 创业者若不能快速转型为 "领域场景深耕者" 或 "人机协作架构师",必将成为大模型吞噬算力时扬起的尘沙。唯一的好消息是:这场碾压的终局将释放出比 RPA 时代大百倍的自动化市场——但入场券只留给能与 LLM 共舞的垂直场景产品架构师。

大模型创业需要避坑,首要的坑正如Sam所说,就是不要开发大模型边缘迟早会内化的能力。

 

【相关】

Understanding the Division of Labor Among Q, K, V in Self-Attention Mechanism

For those diving into self-attention mechanisms, the roles of Query (Q), Key (K), and Value (V) often spark confusion: Why must every token in a sequence generate these three distinct roles to capture contextual dependencies?To grasp how Q, K, and V matrices autonomously specialize through backpropagation, we must delve into the foundational logic of model training. This process mirrors the natural phenomenon of "ant colony division of labor": though initially identical, ants evolve into workers, soldiers, or reproducers through environmental feedback. Similarly, Transformer parameters self-organize via error-driven optimization.

I. The Driving Force: Loss Function as a Macro-Regulator

Suppose we are training a translation model, with the input sentence "猫追逐激光点", and the target output "The cat chases the laser dot." The following are the key steps in parameter differentiation:

1. Initial Chaotic State
- W_Q, W_K, W_V matrices are all randomly initialized
- At this point, the Q vector of "追逐" (chase) may have no correlation with the K vector of "激光点" (laser dot)

2. First Forward Propagation
- When calculating attention weights, "追逐" (chase) fails to associate with "激光点" (laser dot)
- This leads to an incorrect translation (such as outputting "The cat eats the laser")

3. Error Signal Feedback
The loss function calculates two key gradients:
- Content missing gradient: Need to strengthen the action association "追逐→chases"
- Object mismatch gradient: Need to establish the verb-object relationship between "追逐" (chase) and "激光点" (laser dot)

4. Parameter Differentiation Begins
- W_Q matrix receives the signal: Make the Q vector of verbs more attentive to action target features
- W_K matrix receives the signal: Strengthen the acted-upon object attributes in noun K vectors
- W_V matrix receives the signal: Preserve details such as mobility in nouns

🔥 Key Mechanism: The same error signal propagates through different computational paths, causing the update directions of the three matrices to differentiate.

II. Mathematical Principles of Parameter Differentiation

By breaking down the attention calculation process, we can see how gradients guide division of labor:

Attention Weight Calculation Paths

- Gradients for W_Q:
Mainly come from the similarity calculation between the Q of the current token and the K of contextual tokens, forcing W_Q to learn how to generate effective query features
(Example: Making the Q vector of a verb contain potential features like "needs to be paired with an object (transitive verb)"; Q resembles the encoding signal for potential sentence patterns in traditional linguistics, similar to Subcat)

- Gradients for W_K:
Also come from Q-K similarity calculation, but the direction is to optimize K features to be recognizable by Q
(Example: Making the K vector of nouns contain attributes like "can serve as an object of action (object noun)")

- Gradients for W_V:
Come from the final weighted sum, requiring V to retain sufficient information
(Example: The V vector of "激光点" (laser dot) needs to include details like "small, bright, movable")

Four Steps of Weight Calculation:

1. Q-K Dot Product: Measure relevance.
2. Scaling: Prevent gradient explosion.
3. Softmax: Normalize into probability weights.
4. Weighted Sum: Generate contextualized representations.

III. Structural Guarantees for Stable Division of Labor

Beyond gradient driving, model structure design also ensures that the division of labor remains consistent:

1. Isolation of Linear Transformations
- Q/K/V come from three completely independent matrix multiplications
(Unlike LSTM gating mechanisms that share parameters)
- Gradient updates for each matrix do not interfere with each other

2. Multi-Head Attention Mechanism
Using 8-64 independent attention mechanisms (multi-head attention) is like having a team of detectives investigating different directions: some focus on the timeline, others analyze character relationships, and finally, all relationship matching results are synthesized.

Different attention heads form a "division of labor":
- Head 1: W_Q¹ learns grammatical role matching
(Example: Matching the Q of a subject with the K of a predicate)
- Head 2: W_Q² learns semantic associations
(Example: Matching the Q of "bank" with the K of "interest rate")
- This multi-objective optimization forces parameters to specialize

IV. Empirical Validation: Concretization of Parameter Division of Labor

By visualizing the parameters after training, clear patterns of division of labor can be observed:

Case Study: Related Parameters for the Verb "吃" (eat)
- W_Q Matrix:
In the Q vector of "吃" (eat), high-weight dimensions correspond to features like "edible," "concrete object," etc.
- W_K Matrix:
In the K vector of "苹果" (apple), high-weight dimensions correspond to attributes like "food category," "solid," etc.
- W_V Matrix:
In the V vector of "苹果" (apple), high-weight dimensions include details like "color," "texture," "nutritional components," etc.

When calculating `Q(吃)·K(苹果)` (`Q(eat)·K(apple)`), strong attention weights are generated due to high activation values on the "edibility" dimension from both parties. Meanwhile, V(apple) carries the specific information needed for output production (such as knowing it's a fruit rather than a technology company when translating to "apple").

Key Conclusion: The Wisdom of Self-Organization
The essence of parameter division of labor in Transformers is the functional specialization that naturally evolves under the constraints of a unified objective function. The system does not need to preset division of labor details but spontaneously forms an efficient information processing system through repeated "trial-error-feedback" cycles with massive data. This self-organizing process driven by error is the source of the powerful representation capabilities of deep learning models.

[Addendum] A Deeper Interpretation of Q/K/V Relationships

Relationship Between Q and K
- Q is a specific perspective or projection of the K space
- Just like a book can be retrieved from different angles:
- Q1: Subject classification (K1: Literature/Technology/History)
- Q2: Difficulty level (K2: Beginner/Advanced/Professional)
- Q3: Writing style (K3: Theoretical/Practical/Case-based)

This is because Q "actively" seeks certain features associated with other tokens, while K is "passively" prepared to be matched by other tokens. K is like an index that needs to summarize all the main features of a token, but Q focuses on querying a specific feature.

This makes understanding multi-head attention more intuitive:

```
Each head learns a different projection perspective
Q1 = token * W_q1 # May focus on thematic relevance
Q2 = token * W_q2 # May focus on grammatical relationships
Q3 = token * W_q3 # May focus on semantic roles
```

It's like different facets of a high-dimensional space:
- Each attention head learns a specific "query perspective"
- These perspectives collectively build a complete picture of inter-token relationships

Division of Labor Between K and V
- K: Information's "retrieval representation"
- Contains various ontological features that might be queried
- Similar to a multidimensional tagging system for books
- V: Information's "content representation"
- Contains information that actually needs to be utilized
- Like the specific content of a book's text

A Concrete Example
Using the word "驾驶" (driving) as an example:

Different perspectives that multi-head attention might learn:
- Q1: Seeking action tools (highly relevant to "汽车" (car))
- Q2: Seeking action subjects (highly relevant to "司机" (driver))
- Q3: Seeking action modifiers (relevant to "快" (fast), "稳" (stable), etc.)

This understanding effectively explains:
1. Why Q/K separation is necessary
2. Why multi-head QKV mechanisms are needed
3. How the model automatically learns different types of contextual relationships

Continuity Between V and Token Representation
A token's V (Value) is most related to the token's initial embedding, as both represent the content and meaning of this token.
- Initial embedding: Represents the general meaning of the token learned in large-scale embedding training in advance, similar to looking up a dictionary
- Value vector: Can be seen as a continuation and update of this initial representation in a specific context

In other words:
1. Embedding is the "basic dictionary definition" of a token
2. Value is the "specific expression" of this definition in a particular context

Evolution of Token Represenation in the Model

As information flows through multiple network layers:

Initial embedding → Layer 1 Token → Layer 2 Token → ... → Final representation

During this process:
- Each layer's token representation carries increasingly rich contextual information
- While maintaining continuity with the original token meaning (residual connections can compensate if continuity degradation is a concern)
- This evolution is gradual, not disruptive

Essential Differences Between Q/K and V
- Q and K primarily serve the goal of "establishing relationships"
- Q and K extract query features and index features for matching
- Q and K are naturally more abstract and general than V
- V directly carries "concrete content"
- Contains actual information that the token needs to convey
- More specific, more detailed

Figuratively speaking:
- Q/K is like the retrieval system in a library
- V is like the actual content of books on the shelves

Conclusion: The Deep Wisdom of the QKV Mechanism

From the perspective of the entire model:
1. Initial embeddings enter the first layer
2. Each layer updates the next layer's token representation through attention mechanisms and feed-forward networks
3. The final layer's representation encompasses all contextual relationships and meanings, directly empowering the output

The QKV division of labor in self-attention mechanisms, seemingly simple yet embedding profound information processing philosophy: through carefully designed computational flows and gradient paths, the model naturally develops functional differentiation during the optimization process. This design philosophy of "emergent intelligence" has become a core paradigm in modern artificial intelligence.

It is precisely this capability for self-organization and self-evolution that enables Transformer models to capture complex and variable relationship patterns in language, laying the foundation for the powerful capabilities of large language models.

 

【相关】

Linguists Should Find Self-Attention Intuitively Familiar

Written for my linguistics and symbolic NLP peers — a reflection on my journey to leverage computational linguistics in undersranding modern AI LLM.

Breaking Through the Jargon Barrier

For linguists bewildered by large language models (LLMs), the confusion often stems from terminology and implementation details obscuring shared foundational principles. Let’s cut through the noise and focus on self-attention — the beating heart of the Transformer architecture.

As a computational linguist and lifelong NLP practitioner, I’ve spent years dissecting symbolic grammars and, more recently, tracking the rise of LLMs. Here’s my attempt to "translate" the core design of multi-head Query-Key-Value (QKV) mechanisms into a framework linguists already know.

QKV: A Linguistic Reinterpretation

Query as Subcategorization (Subcat)
First, I would like to point out, Query mirrors Subcat in symbolic grammar: the slots a head word "digs" for its dependents. Take a transitive verb (vt) as an example: it creates two syntactic "slots"—a noun subject (pre-verbal) and a noun object (post-verbal). Similarly, the predicate eat defines two semantic slots: an animate agent (e.g., animal) and an edible patient (e.g., food). These constraints — syntactic roles and semantic selection restrictions — are bread-and-butter concepts for linguists.

Key as Ontological Features
Key represents ontological attributes: nounhood, animacy, action, state, time, descriptive, etc.  Value is the filler—the "carrot" that occupies a slot. When I first read Attention is all you need, the QKV triad felt alien. No one explained that this was just dynamic slot-filling.

Why LLMs "Get" Language

LLMs thrive because their "slots" and "fillers" align perfectly across linguistic hierarchies. Every token carries QKV information because every word can both be a seeker (Query) and a target (Key/Value). When a Query (e.g., eat) finds a compatible Key (e.g., apple), their dot product sparks a high attention weight. The Value (the token’s semantic essence) is then passed forward, blending into the next layer’s representation of the token.

Contextual "Polygamy"
Tokens in the context window engage in group marriage, not monogamy. Each token 'flirts' with all others via Query-Key dot products. Relationships vary in intensity (weights), and the resulting "offspring"—the next layer’s tokens—inherit traits from multiple "parents" through weighted summation. Stronger relationships dominate; weaker ones fade. This crazy yet efficient "breeding" compresses linguistic structure into dense vector spaces, a process conceptually equivalent to parsing, understanding, and generation in one unified mechanism.

The Database Analogy (and Why It 'Misled' Us)

QKV borrows terms from database systems (Query for search, Key-Value for retrieval), but early attempts to map this to linguistics fell flat. We thought: "Databases? That’s just dictionary lookups — isn't it already handled by embeddings?!" The breakthrough came when we realized: Self-attention isn’t static retrieval—it’s dynamic, context-aware slot-filling.

For decades, we built bottom-up parsers using Subcat frames. Transformer layers do the same, but with vectors instead of symbolic representaions. See the 2 slides I made 3+ years ago when GPT3 playground was launched when I compared the parallel archtectures and approaches from two schools of AI, grammar school and multi-neural network school.  Symbolic grammars, though, despite their transparency, pale in scalability:
- Granularity: LLMs leverage hundred or thousand dimensional vectors; we relied on only hundreds of one-hot features.
- Generalization: Transformers parse text, audio, video—any modality. Symbolic grammars, at best, aspire to universal grammar across languages.

A Convergence of Paths

My colleague Lü Zhengdong once mapped the evolution of attention: 
Seq2Seq (Google Brain) → Auto-alignment (Mila) → Transformer (Google) → Pre-trained LMs → LLMs (OpenAI)...

To this, I chuckled: "You pioneers see the trajectory clearly. But for us symbolic refugees, diving into Attention is all you need felt like drinking from a firehose." Without fully understanding the historical context, the concepts overwhelmed us—until one day, it clicked: Subcat-driven parsing and self-attention are two sides of the same coin.

Symbolic methods are obsolete, yes—clunky, rigid, and modality-bound, with the only merit of full transparency of symbolic logic. Yet understanding their parallels to Transformers suddenly made LLMs feel familiar. The difference? Scale and ambition. Linguists seek cross-linguistic universals; AI aims for cross-modal universals.

Postscript: Simplifying the Transformer

The original Transformer paper (Attention is all you need) is not an easy-read at all, bogged down by encoder-decoder specifics for machine translation. Strip away the noise, and the core is simple:
1. Self-attention layers (dynamic slot-filling).
2. Feedforward networks (nonlinear transformations).

GPT’s decoder-only architecture reveals the essence: next-token prediction (NTP) is the key to general intelligence. The so-called "decoder" isn’t just about decoding or generation—it’s also analysis and understanding fused into one stream.

Closing Thoughts

Dr. Bai, Shuo once remarked:

Language processing demands a unified ‘currency’—a mechanism to reconcile syntax, semantics, pragmatics, and world knowledge. Only neural networks (imperfect as they are) managed to have achieved this, probabilistically. Attention is that currency.

He’s right.  Attention isn’t just a tool—it’s the universal metric we’ve sought all along.

 

【相关】

语言学家应该很容易理解自注意力机制

作为计算语言学家和NLP老司机,本篇是写给我的语言学老师和同学,以及符号NLP同行的,分享自己的心路历程,希望对大家有所启发。

如果语言学家以前觉得大模型烧脑和不解,那是因为窗户纸没有捅破,存在不同体系下的术语与机制细节的理解障碍,但底层逻辑并不乏不少共同的东西。本篇聚焦在大模型Transformer架构中的核心注意力机制的理解。

我出身计算语言学,这几年又一直在追踪大模型,可以“翻译”一下自注意力机制的核心设计多头的 QKV。

我们做符号文法的 早就该知道 Query 就是 Subcat,主导词为潜在结构“挖坑”用的,例如及物动词 (vt)就挖了两个坑:一个「名词」主语,一个「名词」宾语。主语、宾语是句法结构的角色要求,「名词」是对所要求对象的限制条件(更细致地,Subcat 还有其他限制条件,例如主语在vt前,宾语在 vt后,等)。具体到概念谓词“eat”,逻辑语义上也相应地挖了两个坑:一个是「动物」施事,一个是「食物」受事。「动物」(包括「人」)是逻辑语义结构中对施事角色的语义限制条件,「食物」是逻辑语义结构中对受事角色的语义限制条件。这些都是我们语言学家践行多年、耳熟能详的概念体系。

Key 就是本体特征, 例如,名词、物体、食物、动作、状态、修饰、时间等,Value 就是填坑的“萝卜”。可惜,初读论文「Attention is all you need」 ,被 QKV弄得晕头转向的时候,没有人指点迷津。

为什么LLM大模型吃透了语言,说话那么顺溜,原来各个层级的坑与萝卜,都是那么相配,天赐良缘。为什么每一个单词都有QKV信息,道理也简单,每一个词都可能在“求偶”,追求别人,也都可能被追求。追与被追发现非常谈得来的时候, QK相配,注意力权重大,于是结合,就是把身子(Value)献上;然后生子 ,就是创造下一层的 Token 表示。

有意思的是,上下文窗口里的 Tokens 是群婚制,不是一夫一妻制生孩子。一个 Token 与周围所有 tokens 谈恋爱 q k(i)点积,其他tokens(包括该 Token自己)都与该Token 有一腿,但关系强度不同(谈吹的tokens,权重为0)。该 Token与这种多边关系“杂交”生出的孩子是怎样的呢?加权求和。就是说孩子继承了母亲的很多特征,同时也继承了周围众父亲的特征。谁的特征在子代最彰显或较弱,完全决定于交情的深浅、关系的强度。每个token都是这样推陈出新,一代一代传下去。最后发现,这种群婚制对于信息压缩(理解、解析、生成)特别有效。真有意思。

QKV这些概念显然是从数据库技术拿来的,对于软件界一点都不陌生。但当年理解注意力机制的时候,还是遭遇很大的困惑,想不明白 语言解析与数据库啥关系。当时觉得扯上数据库,最多就是查词典相关,而查词典早就在词嵌入(embedding)编码阶段就完成了。自注意力的核心不是静态的查词典,而是动态的上下文理解。 当年因为想不明白为什么要套用数据库的信息查询和匹配的说法,只能把注意力机制泛泛理解为关注上下文。这也没错,但看不到 insights,也理解不了为什么这东西这么厉害,成就了大模型的超人语言能力。

经过很久终于豁然开朗:原来我们做了一辈子的 subcat-based bottom up parsing,跟 attention+feedforward 做的完全是一回事,一个原理,殊途同归(见下图:这是我在大模型GPT3 playground刚冒头时候做的一个对比,illustrate 当年意识到两条路线殊途同归时候的震撼)。只不过我们符号文法处理完全打不过它。一个是颗粒度没法比,人家的家底是几百上千维度的实数向量,加上各种投射以及非线性转换,我们才有最多几千个强行结构化的符号特征(one hot features)。另外,人家的泛化可以从文字解析,推广到任何模态信号的压缩和理解,我们的文法不具有任何的模态可推广性、可移植性,最多只是跨过了语言壁垒,文法追求可以适用于任何语言的 universal grammar。

我的主流弄潮儿的一位老友吕正东说:

在attention 的发展史上(so far),我看到多次颠覆式的创新, 从最早的 seq2seq (Google Brain) → auto alignment (Mila) → Tranformer (Google again) → pre-trained language model (?) → LLM (openAI )→ ...

我苦笑道:你是真正业内前沿,一路发展轨迹自然一目了然。你可能想象不出我们这些符号出身的人,突然被逼去研读这种经典论文(Attention is all you need)时候的困境。因为缺乏历史演进的知识垫底,一下子就被这些概念砸晕了。不知道经过多少次嘀咕、查阅,才慢慢明白:天下大势,冥冥之中,有万变不离其宗。原来,我们在符号文法摸索了一辈子的被证明最有效的谓词Subcat框架和自底而上的结构解析算法,底层逻辑与 transformer 及其自注意力机制不谋而合。 虽然符号技术过时了,也确实笨拙,除了符号逻辑的透明性外,没有多少其他长处,但现在理解深度学习大模型的原理和框架,由此骤然变得亲切了很多。只不过现在眼界开阔了,与信息论和计算理论更加靠近。(计算)语言学家一辈子的追求就是跨语言,而AI的追求更高一筹,是跨模态,无论音频、视频还是文字。

【后记】

大模型经典论文 Attention is all you need 不好读也有时代的原因,它提出的框架是直接应对RNN的短板和机器翻译的需求和验证。这就让它的核心部分被这些因素干扰而模糊了。框架看上去太复杂,encoder decoder 两大部分,还必须在encoder 到 decoder 之间做一种交叉对齐 ,但其实内核组块没有任何区别。这些对于理解 transformer 的通用性和原理,都是“噪音”。

transformer 主体简单极了,不过就是多层感知器,在每一层加了个自注意力而已。 到了GPT 发现 ntp(下一词预测)是打开通用智能的钥匙的时候,从框架角度就更简单了,decoder-only 足矣(说明:decoder 并不是名字所说的那样只做解码,它一样做分析和理解,这是由其核心组块决定的)。

老友看了我的transformer博客解说(Transformer 和注意力机制简介),说你这个太简陋了,连篇幅都比原论文短。

原文中有一些细节舍去了。
作者: 立委 (*)
日期: 2025/02/21 12:23:37

包括:

原架构是两大块:encoder + decoder

但实际上这两大块里面的组快都是完全一样的。而且,主流已经抛弃了 encoder,GPT 采用的就是 decoder-only 架构。

另外,位置编码是序列的一个因素,与处理过程解耦以后,位置编码有一套说法,怕干扰了主旨的理解,就点到为止了。

再有就是一些数学公式和实现细节,包括归一化、残差等。舍弃不影响对于 “注意力+神经网络” 这个核心主旨的理解。

所以通篇实际上就是一个理解重点:自注意力机制怎么work的,因为多层感知器是个 given,不是 transformer 的创新。

顺便一提,所谓 自注意力,国人喜欢顾名思义,以为是自己注意自己,感觉很蹊跷。其实自注意力是针对跨序列的交叉注意力而言的,自注意力是在同一层序列的上下文中注意所有的相关tokens(确实也包括它自己),是单层序列之内的事儿,这个“自”回指的不是token自己,而是token自己所在的那个窗口序列。交叉注意力说的是跨序列层的注意力,例如传统的神经机器翻译中,目标语序列针对源语序列的注意力。到了 GPT 的通用生成式AI(gen-AI)主流,没有跨序列的必要了,因为所有的 input 序列 和 output 序列,都被自回归“挤压”到同一层的序列去了。仅有的 output 就是 next token,其余一切tokens都连成一串了作为input的条件:everything is ntp。

以“中译英:我爱你” 的机器翻译为例,GPT自回归生成的序列是这样的:

Input                  Output
中译英:我爱你         I
中译英:我爱你 I       love
中译英:我爱你 I love  you

屠可伟老师的研究进一步验证了parsing与transfromer的可对齐性:

李老师,关于transformer自注意力机制和语言学的关系,我们前年有个工作,之前也和您提过:我们发现transformer自注意力机制与概率依存句法模型的近似推理计算图极为相似,局部几乎一模一样: Probabilistic Transformer: A Probabilistic Dependency Model for Contextual Word Representation

白硕老师说:

我对这个问题的观点:

1、语言处理的符号主义本身并没有一个基于第一性原理的强有力理论体系,最牛的乔姆斯基也没做到。

2、语言处理的完整方案必须包含一个词法、句法、语义、语用、常识、事理、逻辑各方面“角力”因素能够以可以“统一度量衡”的表达-竞争-筛选机制,这点,目前只有多层神经网络可以做到,虽然只是“概率性的”。

3、语言处理和知识处理的共性是滑动上下文内的key-value填充,也就是我们俗称的“哪些萝卜填哪些坑”,这个共性的需求,被一个共性的机制——注意力机制在很大程度上解决了。再单独、分别做语言层面的填充机制(什么成分做什么角色)或是知识层面的填充机制(什么槽位取什么值)已经失去意义。要么不做,要么统一做而且比注意力机制做得更好。没有其他的出路。

白老师所言极是。白老师说的“统一的度量衡”就是自注意力。

 

【相关】

Introduction to Transformer and Its Attention Mechanism

The Transformer architecture and its attention mechanism form the foundation of mainstream GPT large language models, making them extraordinarily important. Despite the abundance of explanations and popular science articles on this topic, many friends tell me they still find it bewildering or only partially understand it. Therefore, I've decided to write a couple of blogs to contribute my understanding.

As someone curious about mainstream AI, you've likely heard of the renowned Transformer framework and its "attention mechanism" that powers large language models, perhaps considering them mysterious concepts. You may have read the classic paper "Attention is All You Need," but still found it confusing or difficult to decode. Don't worry—this is completely normal, and most of us have gone through this stage! While the paper may be a bit mind-bending, its core logic isn't actually that complex.

To understand the Transformer architecture in AI large language models (LLMs), we need to break down its workflow. First, we should understand how large language models work and how they're trained. Base large language models gain knowledge from data through "self-supervised learning" using multi-layer neural networks. Self-supervised learning is a special type of machine learning that uses "masking" to generate supervision signals. While supervised learning typically uses human-annotated data with output targets, self-supervised learning requires no human annotation. Instead, it masks certain data points and trains the system to predict them (like "filling blanks" or "continuing sequences"), using the masked data as the correct answer and supervision signal. Mainstream GPT models mask the next word, training the system to predict it based solely on previous context (called "next token prediction")—this is the current paradigm for generative AI.

The Complete Process from Input to Output

1. Starting with "Dictionary Lookup": Tokenization and Embedding

To understand an entire input text for next token prediction, we first need to break it down into basic units, called tokenization, which converts text into a sequence of tokens (the smallest units of text). These tokens might be complete words (like "work") or subwords (like "un+believ+able").

Tokens are symbols, and computers struggle with direct symbol manipulation—they only work well with numbers. So we need to convert tokens into numbers.

Each token is converted into a numerical representation—a multi-dimensional vector—by looking up an embedding dictionary. Each token is transformed into a 300-1024 dimensional vector (imagine establishing feature representations for each word across many conceptual dimensions, such as: noun, singular, organization, finance, etc.). Embedding allows words to have computable semantic spatial relationships.

This multi-dimensional vector space acts like a "meaning space" where each token's vector defines its position. The distance between tokens across different dimensions represents their semantic distinctions. This aligns with our intuition: a word's meaning becomes apparent through comparison with other words.

These vectors aren't randomly generated but are numerically encoded representations trained on massive natural text corpora, providing the basic semantic information of tokens—their position in meaning space. For example, the vector for "bank" naturally sits closer to "money" and far from "trees." Similarly, the vector for "apple" might contain information about both "fruit" and "technology company."

Imagine trying to help a computer understand the sentence: "The cat sat on the mat."

Step one: Tokenization breaks this sentence into individual tokens: The+cat+sat+on+the+mat.

Step two: Dictionary lookup (Embedding) finds a numerical representation—a multi-dimensional vector—for each token.
"cat" -> [0.1, 0.5, -0.2, ...]
"sat" -> [-0.3, 0.8, 0.1, ...]
...

Simply put:
Tokenization breaks text into the smallest units (tokens) that computers can easily process and analyze.
Embedding converts these tokens into vectors that computers can easily calculate and combine.

Key point: The vectors obtained from the embedding dictionary are only the "initial meaning representations" of tokens, without considering their specific context. Decoding contextual meaning from vector representations is the task of the next steps, using the multi-layer neural networks + attention mechanism in the Transformer architecture.

The core modules of Transformer can be broken down into two parts:
1. Attention mechanism: Used to calculate the relevance between tokens and dynamically update token representations.
2. Neural network: Used to process information transformation between tokens.

The entire Transformer is stacked with multiple such blocks for transformation, and with each attention layer recalculating token representations, deepening understanding progressively.

2. Attention Takes the Stage: Updating Word Meanings Based on Context

Now we have a sequence of vectors, each representing the "initial meaning" of a token. But here's the problem: the same word can have different meanings in different contexts! For instance, "bank" can mean a financial institution or a riverbank.

The core of the Transformer architecture is the attention mechanism (self-attention), which serves to dynamically adjust the representation of each token based on context, reflecting its relationships with other tokens.

For example: In the sentence "I like to eat apples," "apple" and "eat" are highly correlated, so the model will rely more on the word "eat" to update the meaning of "apple," determining that "apple" here refers to fruit rather than a company.

How is this done?

The model calculates attention weights between each token and other tokens through QKV attention:
- Query: querying vector of the current token (e.g., "he")
- Key: key vectors of contextual tokens (e.g., "police," "witness")
- Value: The actual meaning after association

For example, through matrix operations, the model discovers that "he" is most strongly associated with "witness," so it updates the vector for "he" to carry information from "witness."

Calculating "relevance": For each token, we calculate its "relevance" with all other tokens in the sentence, assigning different "attention weights" (attention scores) to different tokens. This "relevance" can be understood as: how important are other tokens when understanding the meaning of the current token.
* For example, when understanding the word "sat," "cat" and "mat" are obviously more important than "the."

Weighted average: Based on the calculated "relevance" (i.e., token weights), we take a weighted average of the V vectors from all tokens in the context to obtain a new vector representation for this token. This new vector is the meaning representation of the current token in this specific sentence.
For instance, the new vector for "sat" will be more influenced by the vectors of "cat" and "mat," and less by the vector of "the."

Key point: The attention mechanism dynamically updates the meaning of each token by calculating the relevance between tokens. This update is context-based—the same token will have different representations in different sentences.

This way, each token's meaning is no longer fixed but changes dynamically based on the entire sentence's context. For example, in "I saw a bat," "bat" could refer to either a flying mammal or a sports implement, but the attention mechanism will combine the bigger context to infer its more appropriate meaning.

For details on how QKV works in the attention mechanism, please refer to the companion article "How to Understand QKV Division of Labor in Self-Attention Mechanism?"

3. The Transformer Backbone: Multi-layer Progressive Information Compression

The core building blocks of Transformer can be broken down into two parts:
Multi-head attention layer: Used to calculate relevance between tokens and dynamically update token representations.
Feed-forward neural network layer: Further process and transform information (compression, abstraction)

The entire Transformer consists of multiple such modules stacked together, with each layer recalculating token representations for deeper understanding. Depending on the number of blocks, the Transformer repeatedly performs this update process. Like humans pondering a text multiple times, each layer deepens the understanding of the text. Deeper layers may capture more complex semantic relationships.

Each Transformer block iteratively upgrades understanding, for example:
- Bottom layers: Capture local grammar (such as the contrasting relationship in "not...but...")
- Middle layers: Understand "who 'he' actually refers to"
- Top layers: Grasp the main theme of the entire text

The main features of Transformer
1. Parallel computation: Word order is decoupled from token processing, allowing parallel processing of all tokens (in contrast to the linear inefficiency of previous RNNs)
2. Hierarchical understanding: Progressive interpretation from literal meaning to deep intention, capturing patterns both large and small.

4. Output: The Model's Final Prediction

Transformer models can be used for various tasks. Different tasks have different forms of output.

GPT: Next Token Prediction
For mainstream GPT models, their ultimate task is to predict what comes next through "autoregressive" next token prediction (autoregression is the dynamic extension of previous context, recursively implementing word-by-word continuation). The model decides what content should logically follow based on the deeply understood context. This opened the path to general AI, as sequence learning has mastered the "code" for converting inputs to outputs for general tasks, but that's a topic for another article.

5. Summary

Tokenization and Embedding lay the foundation for computers to understand text, similar to looking up a dictionary.
Attention mechanism calculates relevance between tokens and dynamically updates token representations.
Transformer consists of neural network layers + attention layers, optimizing token representations layer by layer, covering various relationships at different levels.
The final output depends on the task. Translation models generate target language text. GPT is responsible for predicting the next token, ultimately evolving this simple prediction mechanism into a general-purpose large model capable of unlocking various tasks.

 

【相关】

Has Symbolism Been Sidelined for Too Long? Could Neural LLM terminate AI?

Though no one can predict the future, and though abandoning one of the two paths feels politically incorrect, we cannot rule out the possibility of such unipolar dominance.

As is widely known, AI has always been marked by the competition between two schools: symbolic rationalism and data-driven empiricism. Their fortunes have waxed and waned throughout history, but over the past 30+ years, the pendulum has shown no sign of swinging back toward symbolism.

Why?

The ongoing contemporary history of large language models is fascinating. Each time challenges and obstacles arise, the mainstream paradigm overcomes them from within. Whether this will continue remains to be seen, but the trend seems likely to persist.

When large language models (LLM) first emerged, people marveled at their capabilities. But soon, critiques arose: their simple "next token prediction" (NTP) objective and the statistical nature of their probabilistic models led many to conclude they were merely advanced statistical tools, like large parrots—lacking true "understanding."

Ilya Sutskever and Geoffrey Hinton had to step in repeatedly to explain: "Do not underestimate next token prediction. This is no mere statistical n-gram model from the past. It abstracts a system of understanding that integrates human knowledge. When next-token prediction grows increasingly accurate, deep comprehension of context becomes indispensable." Such explanations struggled to convince skeptics. Later, Ilya invoked Kolmogorov complexity as a theoretical foundation, but this framework remains esoteric and inaccessible to most audiences—even many PhDs and professors view it with bemused skepticism. Yet, no better explanation exists.

What ultimately dissolved the "statistical parlor trick" critique was firsthand experience. Users interacting with LLMs realized: these systems seem to genuinely understand. No matter how you phrase your queries, in any language, with nuance or subtext, large models grasp meaning more reliably than most humans.

With the "understanding" debate fading, critics shifted focus: "LLMs cannot reason."

As recently as last year, Yann LeCun cited this as one of his core arguments against the mainstream GPT-style LLM paradigm (advocating instead for vision-based world models as the true path). Many relished pointing out flaws—like LLMs failing at elementary arithmetic such as multi-digit multiplication.

But this critique no longer holds. With the advent of reasoning models like OpenAI’s "o-series" and DeepSeek’s "r-series," accusations of "no reasoning ability" have collapsed. Hardliners may still dismiss probabilistic reasoning as unstable, lacking the rigor of symbolic logic. Yet users deploying these models for mathematics, coding, or project planning overwhelmingly report breakthroughs. Large-model reasoning now rivals or surpasses human experts, approaching master’s or doctoral proficiency. Coding capabilities already exceed those of average engineers.  This is just the beginning.  It is well plausible that within a year or two, reasoning models could dominate Olympiad-level math or competitive programming.

Once again, barriers were breached through internal innovation—this time after large-model pretraining neared its limits. The core framework remains unchanged, though: reinforcement learning still relies on NTP for chain-of-thought (CoT) generation; reasoning models remain probabilistic. Symbolic AI contributed nothing. Symbols remain confined to input/output interfaces—even the "inner monologue" of CoT manifests as output tokens.

The sheer creative potential within this paradigm is staggering. Those of us from symbolic AI backgrounds once naively imagined that when neural approaches hit walls, our logic-and-grammar toolkit would ride to the rescue. Hybrid neuro-symbolic fantasies danced in our minds.

Zooming out, modern large models evolved from earlier statistical frameworks, with neural networks as a tributary. When those statistical models hit ceilings, breakthroughs came from within—via deep learning. Symbolism played no role.

A profound question arises: Why has the theoretically appealing vision of hybrid neuro-symbolic synergy remained an impractical or unnecessary dream?

Two possibilities stand out.

First, the data-driven empiricist approach possesses far greater resilience and potential than we imagined.

This hints at deeper truths. Artificial neural networks, inspired by biological brains, had languished for decades until the deep learning revolution. Over the past decade, their human-like (or superhuman) performances have forced us to confront a possibility: perhaps this is indeep how intelligence works. If artificial systems achieve human-level cognition through mechanisms mirroring our own biology—despite neuroscientists’ caveats about our limited brain knowledge—this alignment would powerfully validate the neural paradigm. Symbolic logic and statistical feature engineering, by contrast, are alien to biological cognition. Their limitations may stem from this fundamental mismatch. One might even argue that high-dimensional vector spaces in LLMs—where multimodal signals are embedded within neural frameworks—encode a "language of God," or the essence of universal information. Symbols, then, are mere human-imposed constructs, sensory accommodations divorced from reality’s substrate.

Second, when a paradigm harbors untapped potential, progress demands sufficient talent density to exploit it.

AI uniquely concentrates genius. Countless brilliant minds flock to this field, creating an intellectual critical mass unmatched in most domains.

With these conditions in play, we must never underestimate the internal momentum to break through barriers. AGI (Artificial General Intelligence) believers, via their "insane" grind, keep delivering results. Could they indeed be AI’s ultimate Terminators?

 

Addendum: Symbolic might just be "reduced" to a symbolic tool that may retain its irreplaceable cognitive value

yanyongxin:

What distinguishes humans from other animals is our evolved reasoning capacity. Though rooted in neurons, this ability represents a qualitative leap beyond mere "instinctive reactions." It abstracts object relationships, enabling multi-step reasoning that can be transmitted and memorized through linguistic symbol chains. Reasoning is inherently discrete—thus symbolizable—as a simulated system built atop neural architecture. This simulation likely requires structural differences in human neural systems compared to other animals.

The most striking contrast between reasoning systems and primal neural cognition lies in sustained deliberation. Unlike "muscle memory" or intuition, human reasoning varies dramatically. During my university years, I observed students who excelled at quick problem-solving yet froze when faced with complexity. Today's LLMs approximate the reasoning level of humanities undergraduates, but still lag behind trained STEM specialists—particularly in mathematics and physics. The essence of STEM disciplines lies in rigorously symbolizing real-world problems. Simulating such precision within biological neural systems demands rare opportunities (elite education), prolonged training, and specific neurostructural advantages ("talent"), all channeled through disciplined formalization. Yet achieving this capability bridges biology with mechanical rigor—enabling interfaces with tools like Mathematica.

This charts AI's next frontier: building superior logical simulation systems atop neural frameworks until seamless integration with pure symbolic tools is achieved. The brain's logical simulation system remains energy-intensive, error-prone, and costly to develop. Its key advantage? Seamless integration with underlying neural processes.

Li Wei: Well said.

Interfacing with symbolic systems manifests as tool use. For instance, when confronting complex math problems, instead of forcing probabilistic reasoning through natural-language chain-of-thought (CoT), LLMs should just generate code properly to invoke Mathematica. This tool-use capability is now defined as a fundamental trait of LLM-native agents—yet another innovation emerging from within the paradigm.

Thus, we see a clear evolutionary trajectory:

1. Traditional Statistical Models ("Artificial Idiocy"):
Failure: Little natural language understanding 
Solution: LLMs (e.g., ChatGPT)

2. Pretrained LLM: 
Failure: Lacking reasoning ability 
Solution: Reasoning-reinforced LLMs (e.g., OpenAI’s o1, DeepSeek’s r1)

3. Reasoning LLM:
Failure: Insufficient symbolic rigor 
Solution: LLM Agents (symbolic tool integration)

yanyongxin:

Traditional statistical models earned their "artificial idiocy" label because their parameter spaces and data structures proved inadequate to host the world models required for true language understanding.

 

【相关】

符号主义被打入冷宫太久了,难道神经是AI的终结者吗?

虽然没人可以预测未来,虽然抛弃两条路线的一条感觉政治不正确,但的确不能排除这种单极主义的可能性。

众所周知,AI自从诞生,就有符号理性主义和数据经验主义的两条路线竞争,以及此伏彼起来回震荡的历史轨迹,直到30年前,钟摆就再也没有回落到符号主义一边的迹象。

这是为什么?

看大模型的当代史(still on-going)很有意思。每一次遇到挑战和障碍,都是主流自己跨过去的。将来是不是还是如此,可以观望,但感觉大概率还会持续。

大模型刚问世,大家惊异于其表现,但很快就从它的简单的“下一词预测”(ntp,next token prediction)的目标函数以及它概率模型的统计特性,得出一个结论:这不过是高级的统计模型,大号鹦鹉而已,它并没有理解。

伊利亚和辛顿不得不站出来一再解释:不要小看 next token prediction,它绝不是以前统计时代的 ngrams,而是抽象了人类各种知识的理解系统。当下一词预测越来越准的时候,没有对上文的深入理解是不可想象的。这种解释并不容易说服人。后来伊利亚追溯到了 K氏复杂性理论,似乎有了拿得上台面的理论支撑。但这一套说法对于绝大多数受众,太过玄妙和高冷,甚至很多博士和教授,也一样是雾里看花,不得不半信半疑。但除此之外,其实也没有更好的理论解释。

最后解开这个质问心结(“大模型根本就没有真正理解,一切不过是统计”)的是无数人与大模型交互的切身体验。 自己的体验不会骗自己: 每一个玩过大模型的人现在都意识到,大模型真能听懂自己的话,无论你怎么说,无论你用什么语言,甚至你话语背后的机锋和细微之处,它也比多数人理解更到位。

好,理解的问题大家搁置一边了,现在很少人还质疑大模型理解能力了。但接着就是另一个问题: 大模型不会推理。

杨立昆去年还把这一条作为自己反对主流大模型路线的根本理由(并鼓吹他的以视觉为基础的世界模型才是真正的出路)。很多人曾津津乐道的是大模型不会多位数乘法这样的小学算术。

但这条理由现在不成立了。在主流业界推出了 OpenAI的o系列和 DeepSeek的r系列等推理模型的今天,这种大模型不懂推理的指责不攻自破。

极端批判派当然可以从概率模型的不稳定的角度,继续质疑其推理不是真正的推理,不具有符号推理的严谨性和确定性。但用过推理模型做数学、代码以及做项目计划的人,绝大多数不再被此困扰了,因为很明显,大模型推理正在超越人类,现在已经修炼到硕士或博士的水平,代码能力也已经超过了大多数码农。而这只是推理模型刚刚起步上线的阶段,再给一两年,推理模型成为奥数冠军或代码冠军,都不是不可想象的事儿。

Again,跳过这个障碍,仍然来自内部,是大模型预训练几乎撞墙后的又一次内部创新。基本性质和基础未变,强化学习还是靠 ntp 去生成思维链(cot,chain-of-thought),推理模型仍然是概率模型。符号AI并没有帮任何忙。符号的作用仍然局限在 input 和 output 两端,连所谓内心独白的思维过程 cot,也是以 output 形式表现的。

这种领域流派内部的创造性和潜力,让人瞠目结舌。以前我们出身符号流派的人老一厢情愿地想着,AI主流遭遇困难了,我们逻辑派、文法派可以出手帮忙了。各种结合符号AI与神经AI的幻想,在我们的心中激荡。

如果把回顾AI历史的眼光拉得更远,我们可以看到现代大模型的前身是当年的各种统计模型,而神经基本是其中的一个支流。当年的那些统计模型遭遇种种瓶颈或天花板,最后还是在内部被深度学习突破了,从来没有符号主义任何事儿。

一个值得深思的问题是:为什么两条路线融合互补的理论美好,一直都是不可实现或不必实现的梦想呢。

可能说明了两件事。

第一是这种数据经验主义的路线,的确具有极大的韧性和潜力,远超我们想象。

这种潜力应该有更深层的原因。众所周知,人工神经网络是受到人脑神经启发而来的一种模拟,停滞多年后爆发了深度学习革命。十几年前的这场革命给我们带来了一次又一次的震撼,这些亮丽的拟人或超人的智能表现,使我们不禁在想,人脑神经也许就是这么工作的,具有同样的原理。人工智能达到或超越人类智能,机理相同应该是最有力的一个支持(虽然脑科学总有人说,我们对大脑知之甚少,貌似有一种把大脑神经的工作机理神秘化的倾向)。其他的一切手段,例如符号逻辑的公式和算法、统计模型的 feature engineering,都不是从真正意义上模拟人脑神经的工作方式,也许这就是它们注定走不远的症结所在。甚至可以说,神经框架内的各模态信号编码嵌入后的高维向量空间的确就是上帝的语言,或宇宙信息的本质,而符号不过是迁就人类感官的表象而已,或者说是人类强加给世界的一种体系。

第二,当一种路线具有超出我们想象的潜力的时候,科技进步所需要的就是足够人才密度去挖掘这种潜力。

我们知道,AI 领域具有这种聚集天才的优势。无数年轻才俊、聪明的大脑被吸引到这个领域,其天才密度超过了大多数领域。

在这样两个条件都具备的时候,我们永远不要低估它突破各种瓶颈的内部力量。那些AGI(Artificial General Intelligence,通用人工智能)的信仰者们一直在疯狂内卷,同时也的确不断在交出自己的成绩单。他们可能是AI的终结者吗?

 

【外一篇:符号逻辑“沦落”为辅助工具还是有自己不可取代的智能补足作用的】

yanyongxin:人之所以区别于其他动物,是因为进化出了推理能力。这种推理能力虽然是建立在神经元上的,但跟单纯的“本能反应”有了质的飞跃。它有了对象关系的抽象,从而可以进行多步骤推理,从而可以以对象关系链——语言的形式传播和记忆。推理本质上是一个离散过程,因此是可以符号化的,是一个在神经元体系上建立出来的模拟系统。但这种模拟的可能,很可能要求神经元系统与其他动物有结构上的差异。

推理系统与原始神经元思维的最显著差异,就是可以长时间思考。而不是“肌肉记忆”、“直觉”。不同人之间的差异很大。大学期间,注意到有些学生遇到简单问题时反应很快,面对复杂问题时,给他多少时间也没用。现在的LLM大致达到了文科生的推理水平。但还与训练有素的理科生,尤其是数学、物理的理科生有差距。数理专业的特征,就是将现实世界的问题严格的符号逻辑化。要在人的神经元系统上模拟出如此严谨的符号逻辑系统是需要特殊的机会(好大学,好老师)、长期的训练、和特殊的脑结构(“天赋”)的,要遵循良好的规则化习惯。但达到这个能力,就可以与机械化的严谨逻辑系统接口了,可以使用 Mathematica 之类了。

这就是人工智能下一步的走向:在神经元上建立更好的逻辑模拟系统,直到能与纯符号逻辑工具无缝链接。人脑中逻辑模拟系统是一个高能耗、高错误率、高构建成本的系统。它的一大好处,是能够跟底层神经元系统无缝联结。

立委:说得很好。

与符号逻辑系统接口就是 tool use,例如,遇到复杂数学问题,不要用自然语言的思维链(cot)去强行推理来影响概率性推理结论,而是LLM自己写代码去 call Mathematica。现在这种 tool use 的能力被定义为 LLM-native agent 的根本特性(之一)。所以 这种能力也还是 from within。

所以 我们看到了清晰的演进路线:

1 传统统计模型人工智障 不理解自然语言
solution: LLM e.g. ChatGPT


2. pretrained LLM 缺乏推理能力
solution: reasoning LLM e.g. o1 / r1


3. reasoning LLM 缺乏严谨的符号逻辑能力
solution: LLM agent (interfacing symbolic tools)

yanyongxin: 传统统计模型之所以人工智障 不理解自然语言,是因为没有足够大的参量空间和足够复杂的数据结构,来容纳理解语言所必须的世界模型。

 

 

 

【相关】

 

 

Transformer 和注意力机制简介

transformer架构及其注意力机制是主流GPT大模型的基础,特别特别重要。虽然这方面的科普和讲解已经汗牛充栋,但还是有很多朋友跟我说一头雾水或雾里看花。所以下决心写了三篇科普系列,试图做出我的理解贡献。

作为对主流AI有好奇心的同学,你可能早就听说过大名鼎鼎的大模型的基本框架 transformer及其“注意力机制”,觉得它们是高深莫测的概念。 你也许也读过那篇经典论文 Attention is all you need,但还是感觉云里雾里。别担心,这很正常,我们多数人都经过这个阶段!这篇论文确实有点“烧脑”,但它的核心逻辑其实并不复杂。

要理解AI大模型的Transformer架构,就需要拆解其工作流程。

首先应该了解一下大模型的工作原理和训练方式。

基础大模型通过原始大数据的“自监督学习”(self-srupervised learning),利用多层神经网络,获得数据相关的知识。自监督学习是一种特别的监督学习,它利用“掩码”获得监督信号。我们知道监督学习的训练数据是标注了输出目标作为监督信号的学习,但自监督无需人类标注,而是在数据中遮盖了部分数据点,让系统学习预测它(“填空”或“接龙”),以被遮盖的数据点作为标准答案和监督信号。主流的GPT大模型的掩码就是遮盖住下一个词,让系统仅仅根据上文来预测它(叫 next token prediction),这是当前生成式AI的主流模型。

当我们输入一段文字时,模型首先要做的就是把它切分成一个个基本单位(词元),然后给每个词元找到它的"字典释义"(向量表示)。

从输入到输出的全过程

1. 从“查词典”开始:Tokenization 和 Embedding

要理解整个输入文本,首先需要拆分基本单元,叫做 tokenization(分词),即,将文本拆解成序列 tokens(词元,文本的最小单位),这些 tokens 可能是完整词(如"work")或子词(subword,如"un+believ+able")。

词元是符号,而计算机对符号难以计算,它只玩得转数字,所以需要把词元转成数字。

每个 token 都会通过查一种嵌入(embedding)词典,把词元符号转化成一个数字化表示:多维向量。每个Token被转换为300-1024维的向量(想象给每个词建立很多概念维度的特征表示,例如:名词,单数,机构,金融,......)。Embedding 让词语有了可计算的语义空间关系。

多维向量好比一个“意义”空间,每个token的多维向量定义了这个token在意义空间的位置;token与其他tokens在不同维度的距离,就是它们在意义上的区分。这符合我们的常识:一个词的意义可以在与其他词的比较中显现。

这些向量不是随机生成的,而是通过海量语料训练出来的数字化表示,提供了词元的基本语义信息,即词元在意义空间的位置——例如"银行"的向量天然接近"金钱",而与"树木"相距甚远。再如"苹果"这个词的向量,可能会包含"水果"、"科技公司"等多个方面的信息。

想象一下,你要让计算机理解一句话:“The cat sat on the mat”。

第一步:分词(Tokenization),先把这句话拆成一个个的 tokens:The+cat+sat+on+the+mat 。

第二步:查字典(Embedding), 给每个 token 找一个数字化表示,也就是一个多维向量。

“cat” -> [0.1, 0.5, -0.2, ...]
“sat” -> [-0.3, 0.8, 0.1, ...]
...
(注:实际向量维度更高且值为连续分布)

简单来说

Tokenization 将文本拆解成计算机容易处理分析的最小单位 token。
Embedding 把这些 token 转换成计算机容易运算组合的向量。

关键点: 嵌入词典得到的向量只是 token 的“初始意义表示”,它还没考虑这个token的具体语境。在向量表示中解码上下文意义是下面步骤的任务,用的就是transformer架构中的多层神经网络+注意力机制。

Transformer 的核心模块可以拆解为两部分:

    1. 注意力机制:用于计算 token 之间的相关性,并动态更新 token 的表示。
    2. 神经网络:用于处理 token 之间的信息转换。

整个 Transformer 由多个这样的模块堆叠而成,每一层都会重新计算 token 的表示,使得理解越来越深。

2. 注意力登场:根据上下文更新词义

现在,我们有了一串向量,每个向量代表一个 token 的“初始含义”。但问题来了,同一个词在不同语境下可能有不同的意思啊!比如,“bank” 可以是“银行”,也可以是“河岸”。

Transformer 架构的核心是 注意力机制(self-attention),其作用就是:根据上下文,动态地调整每个 token 的含义表示,反映与其他token的关系。

打个比方:在"我喜欢吃苹果"这句话里,"苹果"和"吃"的相关度很高,所以模型会更多地参考"吃"这个词来更新"苹果"的含义,从而确定这里的"苹果"指的是水果而不是公司。

怎么做呢?

模型通过QKV注意力计算每个词元与其他词元的注意力权重:
- Query:当前词元的特征向量(如"他")
- Key:上下文词元的特征向量(如"警察","目击者")
- Value:关联后的实际含义

    • 例如,通过矩阵运算,发现"他"与"目击者"关联度最高,于是更新"他"的向量,使其携带"目击者"的信息。

计算“相关度”: 对于每个 token,我们都要计算它和句子中 所有 其他 token 的“相关度”,给不同的词元分配不同的"注意力权重"(attention scores)。这个“相关度”可以理解为:在理解当前这个 token 的含义时,其他 token 有多重要。

    • 例如,在理解 "sat" 这个词时,"cat" 和 "mat" 显然比 "the" 更重要。

加权平均: 根据计算出的“相关度”(也就是词元的权重),把上下文中所有 token 的V向量 加权平均 起来,得到本token的一个新的向量表示。这个新的向量就是当前 token 在 这个特定句子 中的含义表示。

    • 比如,"sat" 的新向量会更多地受到 "cat" 和 "mat" 向量的影响,而较少受到 "the" 向量的影响。

关键点: 注意力机制通过计算 token 之间的相关度,实现了对每个 token 含义的 动态更新。这种更新是 基于上下文 的,同一个 token 在不同的句子中会有不同的表示。

这样,每个 token 的意义不再是固定的,而是会根据整个句子的上下文动态变化。例如,在 "I saw a bat" 这句话中,"bat" 可能是 "蝙蝠",也可能是 "球棒",但注意力机制会结合上下文来推测其在上下文中更合适的含义。

关于注意力机制中QKV如何分工和工作的细节,可参照姊妹篇《立委科普:如何理解自注意力机制中的QKV分工?》。

3. Transformer 主干:多层递进的信息压缩

Transformer 的核心组块可以拆解为两大部分:

    • 多头注意力层:用于计算 token 之间的相关性,并动态更新 token 的表示。
    • 前馈神经网络层:非线性特征转换,进一步压缩信息(抽象、泛化)

整个 Transformer 由多个这样的模块堆叠而成,每一层都会重新计算 token 的表示,使得理解越来越深。根据组块的多寡,Transformer 会反复进行这个更新过程。就像人类理解文章时会反复琢磨一样,每一层都在加深对文本的理解。越深的层次可能捕获到越复杂的语义关系。

每个Transformer组块都在迭代升级认知,例如:
- 底层组块:捕捉局部语法(如"not...but..."的转折关系)
- 中层:理解"他指代的真实人物"
- 高层:把握全文主旨

Transformer的最大特点
1. 并行计算:词序与token处理解耦,并行处理所有token(对比此前RNN的线性低效)
2. 层次化理解:从字面含义到深层意图的渐进式解读,捕捉大大小小的规律性。

与前Transformer的RNN相比,架构优势的工程化体现

特性 RNN Transformer
并行计算 序列依赖无法并行 全token并行处理
长程依赖处理 存在梯度衰减 直接全局注意力
训练效率 O(n)时间复杂度 O(1)层内时间复杂度
内存消耗 相对较低 随序列长度平方增长

4. Output:模型的最终预测

Transformer 模型可以用于各种各样的任务。不同的任务,输出(output)的形式也不同。

    • GPT:预测下一个词(Next Token Prediction) 对于主流 GPT ,其最终的任务是预测下文,通过所谓“自回归”下一词元预测实现(自回归就是动态扩展上文,递归实现一个词一个词的接龙)。模型会根据已经深入理解的上下文,来决定接下来最合理的内容应该是什么。这一路打开了通用AI的路,原理是序列学习学到了一种通用任务的输入转输出的“密码”,但这是另一篇科普的内容了。

5. 总结

    • Tokenization 和 Embedding 给计算机理解文本打下基础,好比查了词典。
    • 注意力机制 计算 token 之间的相关性,并动态更新 token 表示。
    • Transformer 由神经网络层 + 注意力层组成,层层优化 token 表示,涵盖不同层次的各种关系。
    • 最终的 output 取决于任务,翻译模型是生成目标语言文本。GPT 负责预测下一个 token,最终发现这个简单的预测机制自然进化成解锁了各种任务的通用大模型。

 

 

【相关】

立委科普:如何理解自注意力机制中的QKV分工?

这可能是开始学习自注意力机制的同学遇到的一个不容易理解的烧脑问题。

为了学习序列上下文的依赖关系,为什么序列中的每一个 token 都要派生出三个分工角色:Q(Query),K(Key),V(Value)?

要理解为什么每一个token派生出来的Q、K、V矩阵能通过反向传播自动分工,我们需要深入模型训练的底层逻辑。这个过程可以用「蚁群分工」的生态现象来类比:虽然所有蚂蚁最初都是相似的,但通过环境反馈和任务训练,它们会自发分化为工蚁、兵蚁、繁殖蚁等不同角色。Transformer的参数分化也遵循类似的自然演化规律。

一、分工的本质驱动力:损失函数的宏观调控

假设我们要训练一个翻译模型,输入句子为 "猫追逐激光点",目标输出 "The cat chases the laser dot"。以下是参数分化的关键步骤:

1. 初始混沌状态
- W_Q、W_K、W_V矩阵均为随机初始化
- 此时"追逐"的Q向量可能与"激光点"的K向量毫无关联

2. 第一次前向传播
- 计算注意力权重时,"追逐"未能关联到"激光点"
- 导致翻译结果错误(如输出 "The cat eats the laser")

3. 误差信号反馈
损失函数计算出两个关键梯度:
- 内容缺失梯度:需要加强"追逐→chases"的动作关联
- 对象错配梯度:需要建立"追逐"与"激光点"的动宾关系

4. 参数分化开始
- W_Q矩阵收到信号:要让动词的Q向量更关注动作目标特征
- W_K矩阵收到信号:要让名词的K向量强化被作用对象属性
- W_V矩阵收到信号:需要保留名词的可移动性等细节特征

🔥 关键机制:同一误差信号通过不同的计算路径反传,导致三个矩阵的更新方向产生分化。

二、参数分化的数学原理

通过拆解注意力计算流程,可以看到梯度如何引导分工:

注意力权重计算路径

- 对W_Q的梯度:
主要来自本token的Q与上下文中的K的相似度计算,迫使W_Q学习如何生成有效的查询特征
(例:让动词的Q向量包含"需要搭配宾语(及物动词)"的潜在特征;Q很像是传统语言学中潜在句型的编码信号Subcat)

- 对W_K的梯度:
同样来自Q与K相似度计算,但方向是优化K的特征可被Q识别
(例:让名词的K向量包含"可作为动作对象(可做宾语)"的属性)

- 对W_V的梯度:
来自最终的加权求和,要求V保留足够的信息量
(例:"激光点"的V向量需要包含「小、明亮、可移动」等细节)

权重计算四部曲

1. Q-K点积计算关联度
2. 缩放防止梯度爆炸
3. Softmax归一化得到概率权重
4. 加权求和生成语境化表示

三、分工稳定的结构性保障

除了梯度驱动,模型结构设计也确保了分工不会混乱:

1. 线性变换的隔离性

- Q/K/V来自三个完全独立的矩阵乘法
(不同于共享参数的LSTM门控机制)
- 每个矩阵的梯度更新互不干扰

2. 多头注意力机制

使用8-64组独立的注意力机制(多头注意力),就像侦探团分头调查不同方向:有的关注时间线,有的分析人物关系,最后综合所有关系的匹配结果。

不同注意力头形成「分工协作」:
- 头1:W_Q¹学习语法角色匹配
(例:让主语的Q匹配谓语的K)
- 头2:W_Q²学习语义关联
(例:"银行"的Q匹配"利率"的K)
- 这种多目标优化迫使参数必须专业化

四、实例验证:参数分工的具象化

通过可视化训练后的参数,可以观察到明确的分工模式:

案例:动词"吃"的关联参数

- W_Q矩阵:
在"吃"的Q向量中,高权重维度对应「可食用」「具体物体」等特征

- W_K矩阵:
在"苹果"的K向量中,高权重维度对应「食物类」「固体」等属性

- W_V矩阵:
在"苹果"的V向量中,高权重维度包含「颜色」「口感」「营养成分」等细节

当计算 `Q(吃)·K(苹果)` 时,由于双方在「可食用性」维度上的高激活值,会产生强注意力权重。而V(苹果)则携带了制作输出时需要的具体信息(如翻译成"apple"时需要知道这是水果而非科技公司)。

关键结论:自组织的智慧

Transformer参数分工的本质,是在统一目标函数约束下,不同计算路径自然演化出的功能专门化。系统不需要预先设定分工细节,而是通过海量数据中反复的"试错-反馈"循环,自发形成了高效的信息处理体系。这种基于误差驱动的自组织过程,正是深度学习模型强大表征能力的根源。

 

 

【外一篇】

Q/K/V的关系:一个更深入的解读

Q和K的关系

- Q 是 K 空间的一个特定视角或投影
- 就像同一本书可以从不同角度去检索:
- Q1主题分类(K1:文学/科技/历史)
- Q2难度等级(K2:  入门/进阶/专业)
- Q3写作风格(K3:理论/实践/案例)

这是因为Q是“主动”寻求某个与其他tokens关联的特征;而K是“被动”准备被其他tokens匹配的特征。K好比索引,需要概括token的所有主要特征,但Q则是专注于查询某个特征。

这样理解多头注意力就更自然了:

# 每个头学习到不同的投影视角
Q1 = token * W_q1 # 可能关注主题相关性
Q2 = token * W_q2 # 可能关注语法关系
Q3 = token * W_q3 # 可能关注语义角色

就像一个高维空间的不同切面:
- 每个注意力头学习到一种特定的"查询视角"
- 这些视角共同构建了token间关系的完整图景

K和V的分工

- K:是信息的"检索表示"
- 包含了各种可能被查询的特征
- 好比图书的多维度标签系统

- V:是信息的"内容表示"
- 包含了实际需要被利用的信息
- 就像书本正文的具体内容

## 一个具体例子
以"开车"这个词为例:

多头注意力可能学到的不同视角:
Q1:寻找动作的工具(与"汽车"高度相关)
Q2:寻找动作的主体(与"司机"高度相关)
Q3:寻找动作的修饰(与"快"、"稳"等相关)

这种理解很好地解释了:
1. 为什么需要Q/K分离
2. 为什么需要多头QKV机制
3. 模型如何自动学习到不同类型的上下文关系

最后,我们来进一步了解第三个关键角色 V

V与Token表示的连续性

一个token 的 V(Value)与该 token 的初始embedding最相关,因为表示的都是这个token的内容和意义。

- 初始embedding:代表词元在大规模预训练中学到的一般含义,好比是查了词典
- Value向量:可以看作是这个初始表示在特定上下文中的延续和更新

换句话说:
1. Embedding是词元的"基本词典定义"
2. Value是这个定义在特定语境下的"具体表达"

Value在模型中的演化

随着信息在多层网络中的流动:

初始embedding → 第1层Value → 第2层Value → ... → 最终表示

这个过程中:
- 每一层的Value都承载了更加丰富的上下文信息
- 同时保持着对原始token含义的连续性(若担心连续性衰减大,还可以用残差来弥补)
- 这种演化是渐进式的,而不是断裂式的

 Q/K与V的本质区别

- Q和K主要服务于"建立关系”(俗称“挖坑和填坑”)这一目标
- Q和K提取出用于匹配的查询特征和索引特征
- Q和K自然比V更抽象、更概括

- V则直接承载"具体内容"
- 包含词元需要传递的实际信息
- 更具体、更详细

形象地说:
- Q/K像是图书馆中的检索系统
- V则像是书架上的实际书籍内容

从整个模型的角度看:
1. 初始embedding进入第一层
2. 每一层都通过注意力机制加权求和以及前馈网络来更新下一层token表示
3. 最终层的表示涵盖了上下文的全部关系和意义,直接赋能输出

 

【相关】

True Story Behind DeepSeek's Success: AI Learning to Think Slowly Without Human Supervision

*Edited transcript from InfoQ's second DeepSeek series livestream featuring Dr. Wei Li, former VP of Engineering at Mobvoi's Large Language Model team, discussing R1 Zero's innovative contribution to democratizing reasoning models.*

DeepSeek's Greatest Achievement: Making Everything Transparent

InfoQ: "DeepSeek adheres to a pure reinforcement learning approach, but the industry often refers to RL as 'alchemy' - how did they make this process controllable and accessible? What's innovative about their reasoning paradigm?"

Dr. Li:** The reinforcement learning for reasoning models has long been an industry challenge. About six months ago, when Ilya and others declared the end of the pre-training era, it signaled that simply scaling up pre-trained models was no longer sufficient for performance improvements. The delayed release of GPT-5 is another indicator of pre-training's decline. As a result, the industry began seeking new growth paths, with on-the-fly reasoning models gaining momentum among leading teams until OpenAI released O1, the world's first reasoning large language model. DeepSeek's R1 then followed with its breakthrough success.

From the mysterious Q-Star project (reportedly causing dramatic internal conflicts at OpenAI) to the release of O1, reasoning models have been widely recognized as a new paradigm in AI. The core of this paradigm is enabling models' "slow thinking" capability, or System 2 as it is called, using reinforcement learning to enhance model intelligence in complex tasks. However, all of this was closed-source. OpenAI even deliberately created mystique around their chain-of-thought content. Apart from a few top players like Google and Anthropic quietly exploring and tracking this field, other teams knew very little about it.

DeepSeek's greatest achievement lies in making everything about LLMs transparent. They open-sourced their models and detailed technical papers, and weren't afraid to expose their thought of chains (CoTs) in the system. Through pure reinforcement learning, they proved that even without process control data, result-based control alone could achieve top-tier reasoning model performance. This breakthrough was like piercing through a paper window, showing the industry a feasible path to democratizing reinforcement learning.

InfoQ: The innovation in reasoning paradigm sounds abstract. Could you provide an example?

Dr. Li:** R1's paper is outstanding, arguably one of the finest in the large model field. It consists of two parts: one focusing on Zero research, which presents remarkable achievements in pure reinforcement learning for reasoning; the other detailing the practical R1 system, a top-tier production reasoning model. For R1's development, they considered practicality, balancing comprehensive performance, safety, and various practical considerations, detailing a four-stage training pipeline as best practice to help other teams understand and replicate their success.

The most brilliant part is the Zero research. Zero proved a revolutionary point: contrary to traditional beliefs (or OpenAI's implied stance that reasoning requires step-by-step supervision), process supervision isn't actually necessary. Using only the final result against the "gold standard" as a supervision signal is sufficient to train the "slow thinking" process required for reasoning models.

This is Zero's greatest highlight and the origin of its name - it draws inspiration from AlphaZero's spirit. AlphaZero historically pioneered complete independence from human game records or experience, achieving zero human supervision reinforcement learning through self-play generated process data (state+move+score triplets). Similarly, DeepSeek's Zero research demonstrates that in reasoning tasks, models can autonomously generate internal process data - Chain of Thought (CoT) sequences - without human annotation.

Specifically, reasoning models initially focused on mathematics and coding because these domains have standard answers. Macroscopically, this is typical end-to-end supervised learning, as both input (math/coding problems) and output (answers/execution results) are fixed and known. However, the process from input to output is highly complex with significant information gaps, requiring a CoT bridge. Just as humans need to break down problems and think step by step when facing difficulties, models need this process too. DeepSeek's research found that models possess the ability to learn this deep thinking process autonomously if given sufficient time and space.

InfoQ: Dynamic reasoning paths sound like AI "drawing mind maps" - but how do you prevent it from going off track? Like suddenly writing poetry while coding?

Dr. Li:** Based on current evidence, this possibility is virtually non-existent or negligibly low. Before DeepSeek published their results and research details, many were puzzled about this point: wouldn't deep thinking go haywire with only result supervision and no process supervision? Without large-scale reinforcement learning experiments, this was indeed a significant concern. It's like flying a kite - you're holding just one string while letting it soar freely, worried it might nosedive.

These concerns proved unnecessary. The reason it doesn't go off track is that all this reasoning reinforcement learning, including self-generated reasoning CoTs, is built upon existing top-tier models (like V3). These models have already mastered coherent expression through massive data learning. This coherence implies orderliness, which, while not equivalent to pure logic, prevents completely unreasonable deviations. It is observed that fluent human speech typically reflects organized thinking.

InfoQ: On another note, compared to OpenAI's O1, DeepSeek R1 has another notable highlight in applying reasoning CoTs to language generation and style imitation. Could you elaborate on this?

Dr. Li:** When O1 was released, everyone knew it demonstrated significant improvements in mathematics and coding abilities, as standard tests revealed higher performance levels. What people didn't realize was that this reasoning ability, or "slow thinking" capability, excels not only in domains requiring strict logical reasoning but can also shine in traditional language tasks.

By nature, language ability has been a strength of large models - everyone knows they generate very fluent text, more native than natives. By the time we reached models like 4o or V3, their writing was already quite smooth, seemingly leaving little room for improvement. However, when asked to write classical poetry or imitate Lu Xun's writing style, previous models fell short. R1 solved these challenges. From a social impact perspective, this is actually quite remarkable and particularly noticeable.

Honestly, not many people are deeply concerned about mathematics or coding, although we know coding is a major direction for the coming years and automated programming can change the world. Everything in IT ultimately comes down to software; the digital world is built on software. If software development can transition from manual coding to model-assisted or even model-autonomous programming, this will greatly increase productivity. While this is visible to all, it's not as intuitive for ordinary people who more often face tasks like writing compelling articles.

When R1's humanities capabilities were discovered, not just geeks or software developers saw the benefits of reasoning models - ordinary people were excited too. Suddenly, anyone could claim to be a poet, writer, advisor or philosopher - the impact was tremendous. This wasn't felt with o1, perhaps because OpenAI didn't realize or at least didn't focus on this aspect of reasoning models. But while working on code and mathematical reasoning, DeepSeek must have internally realized that this "slow thinking" mechanism could also significantly improve writing abilities, especially in classical Chinese.

Everyone knows Chinese data isn't as rich as English data, so while previous models could write beautiful English poetry, they struggled with Tang poetry. This might be because Chinese data was insufficient in quantity or quality, preventing models from learning adequately. We always felt this was unfortunate - models would sometimes rhyme correctly, sometimes not, sometimes add or miss characters, not to mention tonal patterns to follow. DeepSeek clearly put effort into this area; their data quality must be significantly higher than industry standards.  More significantly, they know how to transfer the CoT ability from science and technology to language and literature.

InfoQ: If you were to recommend a DeepSeek module most worth replicating for programmers, which would it be? Like those "Aha moments" claiming to replicate R1 for tens of dollars?

Dr. Li:** If I were to recommend a DeepSeek module most worth replicating for the programming community, it would be the Zero research-related components. This replication isn't about achieving comprehensive capabilities but rather verifying Zero research's key revelation - that machines can indeed autonomously learn. This is what OpenAI kept under wraps; perhaps they had figured it out earlier but chose not to disclose it.

Now, we've seen quite a number of different teams claimed to have reproduced R1's reflective capabilities with minimal resources. This isn't just an interesting experiment; more crucially, it marks the democratization of reasoning models. Previously, people didn't understand how reasoning models worked, only knowing that vast amounts of process data were needed for models to learn slow thinking. This was considered an almost insurmountable barrier because process data is hard to obtain, and reinforcement learning's instability and high data requirements confused and challenged many programmers.

But now, we know we can bypass this most difficult process data requirement and reproduce this "Aha moment" with limited resources, proving that slow-thinking capabilities can be learned autonomously by models. Based on this premise, if you're a domain expert, you might wonder: could these techniques achieve significant improvements in your field? This is entirely possible. Even the most powerful models (like V3 or 4o) only achieve 60-70% accuracy in specific scenarios without optimization, and experience tells us that without at least 80-85% accuracy, you can't launch a truly valuable system in real-life applications.

That is to say, between a large model's out-of-box results and actual valuable application deployment, there's a gap. Previously, our only method was collecting domain data for fine-tuning (SFT). Now, we have another path RL: following the reasoning model approach, letting systems fully utilize slow thinking capabilities during the reasoning phase to improve data quality to acceptable or even exceptional levels. This path seems to have been opened.

However, my programmer friends tell me that in their comparison experiments between fine-tuning (SFT) and DeepSeek-style reinforcement learning (RL), while RL indeed outperforms SFT, the computational cost for RL training is still far higher than SFT. The superior performance makes sense because SFT data is always very limited, while successfully reinforced RL self-generated data can far exceed SFT data volume.

InfoQ: Some say large models represent "brute force aesthetics," but OpenAI's former Chief Scientist and co-founder Ilya says pre-training has reached its limit. How do you view this? Is the emergence of reasoning models just adding another scaling law to brute force aesthetics?

Dr. Li:** This is more about a shift in technical focus and a paradigm change in technical innovation. Large models involve three major components: first, pre-training, which builds foundational capabilities by learning basic patterns from massive data; second, post-training, initially mainly fine-tuning - OpenAI early on used some reinforcement learning (like RLHF) for human preference alignment, but by Meta's time, they even abandoned typical PPO style RLHF for simpler DPO, as they, like many others, struggled with it. Finally, there's the reasoning phase, where models interact with users real-time after deployment.

The current situation with high-quality natural data is that pre-training has nearly exhausted all available quality resources. The industry began to notice data growth challenges, making performance improvements increasingly difficult. GPT-5's delayed release, reportedly yielding limited returns despite massive computational investment, suggests pre-training may have indeed hit a wall.

This led the industry to explore alternative AI growth curves. Reinforcement learning-based reasoning models emerged at center stage in this context: pure reinforcement learning should be added to post-training. Previous reinforcement learning relied on human preferences, but this time it's about giving models more thinking time before reaching answers, learning underlying chain of thought (CoT). While V3 was already doing well, it didn't cause as much social sensation until R1 appeared. DeepSeek truly broke through after the Chinese New Year, becoming the most discussed public topic and causing excitement and shock overseas. R1 and O1 represent a new paradigm. Before R1, only OpenAI's O1 existed as a reasoning model, seemingly unreachably advanced, with would-be-followers unsure how to follow. However, R1 not only reproduced O1's capabilities but did so with greater transparency and clarity. This contrast further highlighted R1's importance as an open-source model leader.

InfoQ: At first glance, DeepSeek seems like an engineering masterpiece. Why did it cause such global sensation? Its user acquisition speed (100 million in a week) surpassed ChatGPT's nuclear moment? What's its historical significance?

Dr. Li:** From my personal experience and observation, ChatGPT's explosion was a landmark event in large model development. Research insiders were following large models before ChatGPT, at least since GPT-3. When GPT-3's Playground appeared, we were already immersed in it, sensing an approaching storm. But from society's perspective, ChatGPT truly shocked everyone, exceeding all expectations, like an AI nuclear explosion.

I believe R1's emergence is the second major shock after ChatGPT. Of course, between ChatGPT and R1, other influential models appeared, like 4o - another remarkable milestone. While ChatGPT 3.5 was already so impressive, 4o proved it could be even better. Then came Sora, bringing shock with video capabilities in multi-modal LLMs. I personally also greatly appreciate Suno, the music model, making me feel like I could become a musician overnight.

If I were to rank them, R1's impact is second only to ChatGPT, perhaps even exceeding 4o and Sora's sensational effects. R1's impact feels similar to ChatGPT's initial appearance, creating the same addiction. While ChatGPT was groundbreaking and R1 a follower, albeit with innovative highlights sometimes surpassing previous models (like in classical poetry and style imitation), achieving such global impact as a follower is truly miraculous.

In terms of practical effects, R1's productization was amazingly successful. Gaining hundreds of millions of users in a week, it far broke ChatGPT's record and elevated society's AI awareness. Furthermore, regarding geopolitical influences on technology access, many domestic users had long desired access to the world's most advanced models like GPT series, Claude, or Gemini but often couldn't reach them. R1's appearance eliminated these concerns about domestic and international restrictions, contributing to its rapid global popularization.

InfoQ: What's your vision of AI programming's ultimate form? Is it programmers telling AI "make me a TikTok," and it outputs deployable code and operations plans?

Dr. Li:** There are always two types of people: skeptics and optimists. People like Ilya believe Artificial General Intelligence (AGI) is imminent and Artificial Super Intelligence (ASI) isn't far away, so the biggest concern now, according to him, is ensuring superintelligence safety.

Anthropic's CEO Dario predicts that within 3-5 years, large models will achieve real breakthroughs - not just the current impressive demonstrations, but revolutionary changes in societal productivity. Fundamentally, they're talking about AI's ability to scale replacement of both physical and intellectual human labor.

However, while large models are buzzing now, their practical applications haven't reached the level of the previous generation's mobile platforms. Previous super apps like Meituan, Didi, Xiaohongshu, and TikTok transformed major aspects of our daily lives, from basic necessities to communication and entertainment, maximally shortening the distance between suppliers and customers - value everyone of us feels daily. While playing with large models is interesting, their practical value at the lifestyle level isn't yet obvious;  at best we're still on the verge of the coming AI application explosion.

Notably, DeepSeek's emergence has lowered large model application barriers, paving the way for scaled applications, though we haven't yet entered the era of true application explosion.

What will it look like when AI applications truly explode? I believe the ultimate goal, by nature of AI, is for LLMs to comprehensively replace humans in both intellectual and physical labor. Signs of large models impacting white-collar workers are already undoubtedly evident, with even programmers not an exempt. In physical labor, embodied intelligence is developing rapidly, with both humanoid robots and mechanical hands gradually replacing human physical work.

Of course, this brings side effects, like massive job displacement. How society adapts to this state of greatly developed productivity, but this is another discussion topic. But looking at AI's nature and ultimate goals, AI development could have two milestones: first, when it can replace 50% of human work, allowing half of society to maintain a decent, free life through social programs perhaps like Universal Basic Income (UBI) - this might mark the arrival of AGI (Artificial General Intelligence); second, when it replaces 90% of human work, possibly signifying the emergence of ASI (Artificial Super Intelligence) - a kind of technological utopia (or 'communism') in some sense.

These two milestones are my own verifiable definitions of AGI and ASI.  I do not agree with the idea that while old jobs are replaced, more new jobs will be created by AI.  It just does not make sense as any new jobs are also a mixture of human labor, destined to be replaced soon by super intelligence if they do emerge for time being.

This vision of AI's future development shows how DeepSeek's innovations in reasoning models might be just the beginning of a much larger transformation in how we think about work, society, and human potential in an AI-driven world.

 

 

【相关】

DeepSeek爆火真相:不靠“人盯”, 让AI自己学会慢思考

本文整理自InfoQ策划的DeepSeek系列直播第二期节目——DeepSeek爆火背后DeepSeek,纯强化学习路线到底有何不同。在直播中,出门问问大模型团队前工程副总李维博士聚焦推理范式的创新,分析了R1 Zero 对推理模型平民化的创新贡献。他提到,DeepSeek通过开源和透明化,证明了不需要过程监督,仅通过结果控制就能训练出优秀的推理模型,这大大颠覆了传统认知以及OpenAI 所暗示的需要在每一步监督推理强化学习的观点。

 

DeepSeek 的最大功绩在于将这一切透明化

InfoQ:“DeepSeek坚持纯强化学习路线,但业界常说RL(强化学习)是‘炼丹’”——他们如何让这个过程可控和“平民化”?有什么"推理范式的创新"?

李维博士:实际上,推理模型的强化学习一直是业界的难题。大约半年前,IIya 等人宣称预训练时代已经结束,这意味着单纯依靠预训练模型的规模扩展来提高性能已经难以为继。GPT5迟迟不能上线也是预训练式微的一个迹象。因此,业界开始寻找新的增长道路,推理大模型在头部团队开始暗流涌动,直到 Open AI发布全球第一个推理大模型O1. 紧接着就是DeepSeek的R1出圈,这就是deepseek爆火的背景。

从 神神秘秘、据传引发了OpenAI宫斗的Q-Star 项目开始到 o1 大模型的推出,推理大模型被AI主流广泛公认为新的范式。这种范式的核心是开启模型的“慢思考”能力,即所谓 System 2,利用强化学习提升模型在复杂任务中的智能程度。然而,这一切都是闭源的,OpenAI 甚至故意制造了一些神秘感,遮掩其思维链的内容。除了少数头部玩家如 Google 和 Anthropic 在背后悄悄探索追踪外,其他团队对这一领域知之甚少。

DeepSeek 的最大功绩在于将这一切透明化。它的模型和详尽的技术论文全部开源,甚至也不怕露怯,在系统里公开了思维链的所有内容。它通过纯粹强化学习,证明了即使没有过程控制数据,仅通过结果控制也能达到头部推理大模型的水平。这就好像是捅破了一层窗户纸,让业界看到了强化学习平民化的道路。

 

InfoQ:推理范式的创新听起来很抽象,能否举个例子?

李维博士:DeepSeek 的R1论文非常出色,堪称大模型领域中的一篇佳作。论文分为两部分:一部分是关于 Zero 的研究,这是纯粹的强化学习推理方向的成果,非常精彩;另一部分则是基于 Zero 研究成果的实用系统 R1,这是一个真正上线的头部推理大模型。在开发 R1 时,需要考虑实用性,包括综合性能、安全性以及各种实用考量等,因此论文中详细介绍了四阶段训练的最佳实践(best practice),帮助其他团队理解和复制这一成果。

论文最精彩的部分还是 Zero 的研究。Zero 的研究证明了一个颠覆性的观点:与传统认知(或 OpenAI 所暗示的需要在每一步监督推理强化学习的观点)不同,实际上并不需要过程监督。仅通过最终结果(即“黄金标准”)作为监督信号,就能训练出推理大模型所需的“慢思考”过程。

这是 Zero 的最大亮点,也是其名称的由来——它借鉴了 AlphaZero 的精神。AlphaZero 在人工智能历史上开创性地完全不依赖人类棋谱或经验学习,而是通过自我对弈的再生的过程数据(即:棋局状态+落子+评分的三元组步骤数据),实现了零人类监督的强化学习,并最终完全碾压了人类顶尖棋手。DeepSeek 的 Zero 研究也是如此,它表明在推理任务中,模型可以自主生成内部的过程数据,即思维链(CoT,Chain of Thought)序列,而无需人类标注。

具体来说,推理模型最初以数学和代码为对象,因为这些领域本身就存在标准答案。从宏观上看,这其实是一种典型的端到端监督学习,因为输入端(数学题或代码题)和输出端(答案或代码运行结果)都是固定的、已知的。然而,从输入到输出的过程非常复杂,信息差很大,这就需要一个“思维链”作为桥梁。就像人类遇到难题时需要分解问题、逐步思考一样,模型也需要这样的过程。DeepSeek 的研究发现,模型本身具有自主学习这种深度思考过程的能力,只要给予足够的时间和空间。如果没有这个空间,模型就只能直接从问题跳到答案,信息鸿沟大,随机性就强,成绩好不了。

DeepSeek 的解决方案是通过设计一个简单模板引导模型进行思考。具体说,就是在传统的监督数据 question+answer里面人为增加了一个标签[think]: question+[think]+answer, 通过强化学习的方式,模型会自主填空,再生过程数据 question+cot+answer,以此迭代学习,cot中就自动出现了反思、自我校正等过程。这表明,只要给予模型思考的空间,它就能自主生成思维链。非常奇妙!

 

给模型留够充分的自主学习空间

InfoQ:动态推理路径听起来像AI自己“画思维导图”——但如何避免它中途跑偏?比如写代码时突然开始写诗?

李维博士:从目前的情况来看,这种可能性几乎不存在,或者概率极低,可以忽略不计。在deepseek公布他们的结果和研究细节之前,大家确实对这一点感到困惑:只靠结果监督,没有过程监督,深度思维不会乱套吗。在没有真正进行大规模强化学习实验之前,这确实是一个很大的疑问。就好比放风筝,你只牵着一根线,让风筝在天上自由飞翔,你会担心它会不会一头栽到地上。

现在看来是过虑了。它不会走偏的原因在于,所有这些推理的强化学习,包括自主生成的推理思维链的数据,实际上都是建立在原有的头部大模型(如V3)的基础上的。这些大模型在海量数据的学习过程中,已经很好地掌握了如何把话说得顺溜。这种“顺溜”的背后是条理性。虽然不能说它完全等同于逻辑性,但至少不会偏离到完全不合理的情况。就像一个人说话很顺畅,背后的思想相对来说也是有条理的。

所以,模型在原有大模型的基础上生成数据,经过筛选和强化学习迭代,会越来越条理化。这种思考方式本身是由大模型自然生成的,再加上有选择机制在不断强化过程中让它越来越符合条理地导向正确答案。

话说回来,在研究人员真正做出成果之前,大家心里还是充满了怀疑和疑问,不知道让机器模拟学习人类的高阶智能这条路是否真的能走通。如果是一个能力弱的小模型,这条路是否能走通就很难说了。但V3本身是一个很强大的基座模型,在此基础上让模型自己生成思维链,虽然这些思维链并不总是很有条理,但并不影响最终结果。因为这是一个以结果为导向的强化学习过程,只要坚持用正确和错误的结果来控制强化学习过程,即使思维链中有时会出现一些偏差,但总体目标是一致的,最终还是能学到推理高难度题目的能力。

再从更大的角度来看,我们发现当大模型发展到一定程度时,日常人类的数据已经基本用尽,高品质的数据也所剩无几。要进一步提升能力,就必须依靠模型自己生成数据。说到底,AI发展到现在,需要AI自己反哺自己才能进一步提升

在过去很长一段时间里,很多人对这一点存在疑问,担心模型自己教自己会导致退化,或者即使是一个好的模型教一个差的模型,也会有天花板。但现在回过头来看,再生数据的重要性越来越大。不仅是推理模型,就连多模态大模型也是如此。以Sora为例,我们知道视频和语言之间的自然对齐数据非常少,很难找到大量对视频情节进行详细讲解的数据。为了实现视频和语言的对齐,Sora选择了再生数据的道路,用自己的模型对整个的视频训练数据集进行了非常详细的标注。再生数据助力,Sora成为了第一个爆款的视频大模型。如今,国内的视频大模型也已经迎头赶上,如快手的可灵和字节的即梦,甚至比Sora还要更强一些,这背后也离不开再生数据的作用。

 

InfoQ:另一方面,与 OpenAI 的 o1 相比,DeepSeek R1 还有一个显著亮点是将推理思维链应用到了语言文字的创作和风格模仿能力上,这一点可以详细介绍一下吗?

李维博士:o1 出来时,大家都知道它在数学和代码能力上有了显著提升,因为标准测试显示它达到了一个更高的水平。但大家没有意识到的是,这种推理能力,或者说“慢思维”能力,不仅仅在需要严格逻辑推理的领域表现出色,它在传统的语言文字创作方面同样可以大放异彩。

传统上,语言文字能力一直是大模型的强项,大家都知道大模型生成的语言非常流畅。到了像 4o 或 V3,它们写文章已经很顺了,似乎提升空间不大。然而,当要求模型写一篇古典诗歌,或者模仿鲁迅的文风时,之前的模型还做不到。直到 R1 推出,这些问题都得到了解决。从社会效应来看,这其实是非常厉害的。

老实说,真正关心数学或代码的人并不多,虽然我们知道代码是今后几年的一个大方向,自动编程能改变世界。所有 IT 方面的东西归根结底都是软件,数字世界是由软件构成的。如果软件能力可以从手工编写变成模型辅助,甚至模型自主编写,这将极大地提高我们的生产力。这是大家都能看到的,但对普通老百姓来说却没有那么直观,因为他们面对的更多是写文章如何出彩这类任务。

R1 的文科能力被大家发现后,不仅仅是极客或者做软件应用的人看到了推理模型的好处,普通人也为之奔走相告。一旦上手,任何人都可以成为诗人、文学家、哲学家,这种震撼是非常大的。在o1 出来时,大家没有这种感觉,可能是因为 OpenAI 没有意识到,或者至少没有聚焦这一点。但 DeepSeek 在做代码和数学推理时,内部肯定已经意识到,这种“慢思维”在文字能力方面也可以提升一大步,尤其是在中文领域。

大家都知道,中文的数据相对没有英文那么丰富,所以之前大模型写英文诗可以写得很漂亮,但写唐诗就不够好。这可能是因为中文数据要么量不够,要么品质不够,导致模型学习得不够到位。我们一直觉得这是一个遗憾,模型写诗有时押韵,有时不押韵,有时多一个字,少一个字,更不用说平仄,总是有问题。DeepSeek 在这方面肯定下了功夫,其数据品质一定比行业标准更高、更好。

但大模型光有数据还不够,另一条腿是推理时间的计算量。在用户实际使用时,增加计算量和思考时间,我们发现模型的文字能力显著提升了层次,这给大家的震撼非常大。思维链是模型“慢思考”的一个特征。一开始,我们可能想当然地认为,逻辑思维是它的核心,思维链就是要非常严谨地符合逻辑的每个步骤,以确保在数理化和代码中表现出色。

但我们根本没想到,在文学创作这种领域,并不需要严谨的逻辑思维,它更多的是要有想象力,需要反复斟酌和修改。比如你要写一篇非常漂亮的文章,或者模仿一种风格,你需要考虑的方面很多,写古风诗词要考虑押韵、平仄、用词,考虑如何用古典文字表达现代概念等。为了写出一篇好文章,你需要周密地计划,这本质上是一种“planning”,而不仅仅是狭义的“reasoning”。可见,慢思维背后的真正价值在于为最终结果做铺垫,制定计划和反复修正。无论任务是文科还是理科,只要是高难度的任务,都需要这种“planning”的时间,就像我们打草稿、反复校改一样,这些都是思维链的用武之地。

 

InfoQ:思维链机制具体是如何产生的?

李维博士:DeepSeek 之所以能够产生复杂的思维链,背后是因为它是基于头部大模型V3训练的,而 V3 所涵盖的知识比我们任何个体所了解的都要广博得多得多。在这基础上,关键点是要给模型留下空间,让它有自主学习的机会。作为设计者或开发者,需要设计出这样的空间,让模型自己去填补、去学习。DeepSeek 就是这样实现的。它设计了一种格式,在输入问题question和输出答案answer之间,它留下了一个“思考”的空间,用标签 [think] 来标记: question+[think]+answer。这个 think 标签就是准备要学      思维链(cot) 的, 虽然开始为空,Zero 的 research 表明:只要留下think的标签,就给LLM自主填补cot 留下了空间。此后他们“啊哈”地惊喜发现,越来越条理化的cot 居然在 GRPO 组内选优的强化学习迭代算法的指引下,就自主学出来了。啥也不用做,模型就是自己要思考,而且能思考。LLM really wants/tends to think and think deep if given a chance.  比如,它可能会在推理过程中发现自己前面的某个结论与已知事实不符,于是就会自我纠正,说:“不对,这里可能有偏差。”这种反思和自我纠正的能力,是模型在学习过程中自然形成的。可以想像研究者当时的兴奋之情, 简直就是上帝给他们面授了天机。不但他们“啊哈”, 我们读论文追踪他们的人也感觉开了天目,不可思议,但 it just works。Zero research 的美丽就是没有人工的过程数据的任何干预,完完全全的纯强化出来的奇迹。

从信息论的角度来说,思维链降低了困惑度(perplexity),搭建了从难题到答案之间的桥梁,使得得出正确结论的可能性增大,从而提高了模型的智能。

 

推理模型已经进入“平民化”时代

InfoQ:如果让您给程序员推荐一个最值得复现的DeepSeek模块,会是哪个?比如各种声称几十美元复制R1的Aha moment?

李维博士:如果让我推荐程序员群体最值得复现的 DeepSeek 模块,大概会是与 Zero 研究相关的部分。这种复现并不是从全面能力上,而是证实了 Zero 研究中揭示的关键点——机器确实能够自主学到反思能力或慢思维推理。这是 OpenAI 一直遮掩不让人知道的,也许他们早就悟出来了,但就是不公开。

现在,我们看到至少有五六组不同的团队,用很少的资源就复现出了 R1 的这种反思能力。这不仅是一个有趣的实验,更关键的是,它标志着推理模型已经进入“平民化”时代。以前,大家不知道推理模型是如何工作的,只知道需要大量的过程数据,模型才能学会慢思维。这被认为是一个难以跨越的门槛,因为过程数据很难获取,而且强化学习的不稳定性高、对数据要求也高,所以很多程序员觉得这条路很难走。

但现在,我们知道可以绕过这个最繁难的过程数据,通过有限的资源复现这种“Aha moment”,证明慢思维能力是可以让模型自主学出来的。基于这个前提,如果你是一个行业专家(domain expert),在自己的项目或应用领域中,你会想:是否可以用这些技术在你的领域实现大幅提升?这是完全可能的。因为即使是最强大的大模型(如 V3 或 4o),在具体场景中如果不经过优化,也只能达到 60%~70% 的正确率,而在 real life应用场景中,经验告诉我们没有 80% 或 85% 以上的正确率,根本无法上线一个真正有价值的系统。

从大模型的“开箱即用”(out-of-box)结果到真正能投入应用并产生价值,中间存在一个差距。以前,我们想到的唯一方法是收集领域数据进行微调。但现在,我们多了一条路:顺着推理模型的思路,让系统充分发挥推理阶段的慢思维能力,从而提升数据质量到可接受甚至出彩的程度。这条路似乎已经打通了。

不过,我的码农朋友告诉我,他做了一个微调(SFT)与deepseek式强化学习(RL)的对比实验,发现RL的确强过SFT,但RL训练目前的计算代价还是远远大于SFT。效果好于SFT可以理解,因为SFT的数据总是非常有限的,而RL自主再生的数据成功强化的话,会远远大于SFT数据。

仔细看 R1 的设计,它是一个实用系统,不像 Zero 那么纯粹。Zero 是一个研究项目,旨在证明可以排除人类干预来构建推理模型。但 R1 是为了实际应用,所以它结合了微调和强化学习:遵循他们自己创新的SFT+RL+SFT+RL的四阶段训练的pipeline。它在第一阶段是微调,使用了 2,000 条左右的人类过程数据来提高效率,他们称为“冷启动”。强化学习之后,又加入了微调和最后的偏好强化学习,以确保合适的数据配比和能力平衡,以及与人类偏好的对齐。这种设计是经过深思熟虑,可能经过了很多尝试和调整,最终呈现出的一个最佳实践。

虽不好说R1 的这种设计一定就是绝对的最佳方案,但它确实提供了一个很好的思路:现在我们有两个工具——SFT 和 RL。如果能够将这两个工具很好地结合起来,互相补充,那么在实际应用场景中,我们就能构建出更好的系统。

从更广泛的意义上说,DeepSeek 的出现不仅是因为各种原因而短暂火爆,它更重要的作用是极大地加速了大模型向应用领域发展的速度。这对整个行业来说是一个巨大的利好刺激。

 

InfoQ:有人说大模型是“暴力美学”,但OpenAI 的前首席科学家、联合创始人 IIya 说预训练到头了,怎么讲?推理模型出现的背景就是增加了又一个暴力美学的scaling law 吗??

李维博士: 这更像是技术聚焦点的转移和技术创新的范式转变。大模型涉及三大块:首先是预训练,这是大模型的基础能力,从海量数据中学习基本规律;其次是后训练,最初主要是微调,OpenAI 早期也用了一些强化学习(如 RLHF)来对齐人类偏好,但到了 Meta 时,他们甚至放弃了典型的RLHF,代之以更简单的DPO,因为与很多人一样,他们玩不转。最后是推理阶段的工作,即模型上线后与用户交互的阶段。

这三个阶段理论上都可能找到资源投入与性能提升之间的正相关S曲线,即scaling laws的某种表现函数。在过去,预训练是最受重视的部分,大家认为只要数据量不断加大、模型规模足够大,能力就一定持续提升。

LLM Scaling的底层逻辑是什么?为什么到了千亿tokens这种以前难以想象的数据规模,大模型依然显得"吃不饱"?为什么从千亿扩展到万亿tokens,scaling law依然有效?

这个现象的关键在于LLM是序列学习(编码)和序列推理(解码)的系统。序列本身是一维的,但序列中蕴含的patterns和规律性却是高维的。举个例子:即使是简单的"猫追老鼠"这样的序列,背后可能涉及物种关系、捕食行为、空间运动等多个维度的知识。这种多维知识表现在序列层面,就会发生天然的组合爆炸。对大数据的"大胃口"正是应对这种组合爆炸的有效策略。

 

然而,人类自然产生的高质量数据是有限的。预训练已经几乎吃尽了现有的高质量自然数据。业界开始意识到数据增长的困扰,性能提升也变得困难。GPT-5 难产,据传投入大量算力却收效有限,这表明预训练可能遭遇了瓶颈

于是,业界开始探索另外的AI智能增长曲线。强化学习的推理模型就是在这种背景下走到主流舞台的中心:应该在后训练中加入纯粹的强化学习。以前的强化学习依赖人类偏好,但这次是让模型在得出答案之前有更多思考时间,学习背后的规律。V3 已经做得很好,但当时除了业界并没有在社会上引起太大轰动。直到 R1 出现,deepseek 才真出圈了,成了春节后最受关注的大众话题,在海外也引发了热议和震惊。R1 代表了一种新的范式。在 R1 之前,只有 OpenAI 出了 o1 这种推理模型,给人一种高不可攀的感觉,大家不知道如何跟进。然而,R1 不仅复现了 o1 的能力,还更加透明、清晰。这种反差进一步凸显了 R1 作为开源大模型引领者的重要性。

 

未来脑洞

InfoQ:DeepSeek 乍看就是工程上的极致化,为什么会引起全世界的轰动?它的获客速度(一周上亿)超过了 ChatGPT 核爆的时候?它的历史地位到底如何?

李维博士:从我个人的体会和感受来说,大模型的发展历程中,ChatGPT 的爆火是一个标志性事件。其实我们业内人在 ChatGPT 出现之前就开始关注大模型了,至少从 GPT-3  开始吧。当时 GPT-3 的 Playground 出现,我们乐在其中,就已经感觉到一场风暴要来了。但从整个社会的感知来看,真正引发全社会震动的还是 ChatGPT 的出现,它像核爆一样震撼了我们,超出了所有人的预期。ChatGPT 出来,我们就陷入了一种痴迷的状态。

R1的 出现,我认为是继 ChatGPT 之后的第二个重大震撼。当然,在 ChatGPT 和 R1 之间也出现了一些有影响力的大模型,比如 4o,它也是一个了不起的里程碑。我们当时觉得 ChatGPT 已经很好了,3.5 版本已经很出色了,但 4o 的出现证明了它还可以更好。我们一直在案头使用它。再后来出现了 Sora,这种视频大模型也给人带来了震撼。我个人还特别喜欢一个叫 Suno 的音乐模型,它在音乐创作方面表现出色,让我觉得自己仿佛一夜之间就能成为音乐家,想写什么歌就写什么歌,还能配上自己的视频。这些模型都给人带来了不同阶段的震撼,但都没有 R1 这么强烈。

如果让我排序的话,我认为 R1 的震撼力仅次于 ChatGPT,甚至超过了 4o 和 Sora 所创造的轰动效应。R1 的震撼感有点类似于当年 ChatGPT 刚出现时的感觉,让人痴迷。ChatGPT 是开天辟地的大模型,R1 总体上是一个追随者,尽管它有很多创新亮点,有些方面甚至超越了之前的模型,比如在古典诗词创作和文风模仿方面。作为追随者,能在太平洋两岸乃至全球引起如此大轰动,是奇迹般的成就。

从实际效果来看,R1 的产品化非常成功。它在一周内就获得了上亿客户,远远打破了 ChatGPT 所创造的记录,提升了整个社会对 AI 的感知度。此外,从地缘政治对技术应用的影响来看,国内很多用户一直渴望使用全世界最先进的大模型,比如 GPT系列、Claude 或 Gemini,但常常够不着。而 R1 的出现,让人们不用担心国内外的限制。这些也都是促成R1 快速普及的因素。

 

InfoQ:您理想中AI编程的终极形态是什么?是程序员对着AI说“给我做个抖音”,它就直接输出可部署的代码+运维方案吗?

李维博士:总是有两类人怀疑派和乐观派。像 Ilya 这样的人,认为通用人工智能(AGI)已经迫在眉睫,超级智能(ASI)也在不远的未来,所以现在最大的问题是确保超级智能的安全性

Anthropic 的 CEO 预计,在未来 3 到 5 年内,大模型将实现真正的突破,不仅仅是目前让我们震撼的表现和demos,而是真正能在生产力上对整个社会带来革命性的改变。他们所说的,归根结底就是 AI 能规模化平替人类的体力劳动和脑力劳动。目前大模型虽然很热闹,但在社会生活中的实际应用还远未达到上一代移动互联网平台的水平。上一代的 super apps,比如美团、滴滴、小红书、抖音等,它们改变了我们日常生后的主要方面,无论吃穿住行还是通信和娱乐,它们最大程度缩短了供应商和客户之间的距离,这些价值我们每天都能感受到。而玩大模型虽然有趣,但在生活层面的实际价值还不明显,应用层面还处于爆发的前夕。

值得指出的是,DeepSeek 的出现降低了大模型应用门槛,为应用铺平了道路,虽然目前我们还没有进入应用真正爆发的时代。未来,当AI应用真正爆发时,会是什么时候、什么样子呢?我认为,最终目标是 AI 在脑力劳动和体力劳动中全面代替人类。大模型对白领阶层的冲击,迹象已经很明显,甚至连程序员群体都难幸免。体力劳动方面,具身智能发展也很快,无论是人形机器人还是机械手,都在逐步代替人类的体力劳动。

当然,这也会带来副作用,比如大量工作岗位消失,社会如何适应这种生产力大发展但缺乏工作岗位的状态,是另一个层面的讨论。但从AI本性和最终目标来看,AI 的发展可以有两个里程碑:一是何时能替代人类 50% 的工作,让社会只需要一半人工作,剩下的人通过基本收入保障(UBI)等方式维持一个体面的自由生活,在我看来这就是AGI到来的标志;二是何时能替代 90% 的人类工作,这可能算是所谓的超级智能(ASI)出现的时候,某种意义上的技术共产主义。

 

【相关】

Does the New Reasoning Paradigm (Query+CoT+Answer) Support a New Scaling Law?

— Reflections on LLM Scaling Laws and DeepSeek's R1

My friend Zhang Junlin's article "Looking at the Future of Scaling Laws through DeepSeek R1" has sparked interesting discussions among peers.

Core Insights from Initial Discussions

Professor Bai summarised the key highlights as follows:

Infinite stacking won't lead to infinite growth (physical laws don't support this)

Only S-shaped growth is possible, with diminishing returns inevitably appearing

The initial emergence of language capabilities relates to the density of linguistic knowledge in training data

The next growth phase represents a second S-curve, driven by common sense knowledge, which requires more computing power due to lower knowledge density

The third phase involves learning logical reasoning (Chain of Thought), where natural data has even lower density of such knowledge. Brute-force mining with computing power becomes inefficient, making reinforcement learning with synthetic data a more rational approach

As Dr. Lu points out: The term "Scaling Law" is becoming overloaded. While S-curves (nonlinear curves characterized by sigmoid functions) can describe technology adoption lifecycles, they typically occur in succession (one technology hits its ceiling, making way for another). Large language models' multiple "Scaling Laws" confirm this pattern, with some overlap between Test-Time and Post-Training "Scaling Laws".

The Nature of LLM Scaling

Let's examine the fundamental logic behind LLM scaling. First, it's crucial to understand that LLMs are not databases - they don't aim to memorize long-tail data details. Large model training essentially compresses big data, or more precisely, compresses the knowledge systems behind the data (including common sense and encyclopedic knowledge), focusing on capturing patterns and regularities of various patterns (what we call generalizations).

Conventional intuition suggests that as data scale increases, redundancy increases too. Regardless of filtering, cleaning, and deduplication, growing redundancy seems to imply diminishing returns. So why do large models still appear "hungry" even at the unprecedented scale of hundreds of billions of tokens? Why does the scaling law remain effective from hundreds of billions to trillions of tokens?

The key lies in LLMs being sequence learning and sequence decoding systems. While sequences are one-dimensional, the patterns and regularities behind are high-dimensional. For instance, even a simple sequence like "cat chases mouse" potentially involves multiple knowledge dimensions: species relationships, predatory behavior, spatial movement, actor-patient roles, etc. This multi-dimensional knowledge naturally leads to combinatorial explosion at the sequence level as information is flattened in language. The "appetite" for insatiable big data effectively addresses this combinatorial explosion. As long as there isn't complete information redundancy, additional diverse sequences will help models abstract data patterns more precisely.

The Two vs. Three S-curves Debate

Zhang Junlin observes that since OpenAI's O1, two other phases have gained recognition with their own Scaling Laws: the reinforcement learning Scaling Law (RL Scaling Law) for post-training, and the Inference Scaling Law (also called Test Time Scaling Law).

This raises a crucial question: Are there really three S-curves, or just two? How comparable is the reasoning model's S-curve to the pre-training S-curve?

While theoretically we can identify three phases:

Pre-training
Post-training (especially reasoning-focused reinforcement learning)
Inference phase

In practice, post-training and inference phases likely share a single S-curve; there aren't two independent growth curves.

DeepSeek R1's Insights: The Truth About "Slow Thinking"

Consider DeepSeek R1: users can activate "deepthink" mode to enable Chain-of-Thought (CoT) reasoning, but they can't actually control reasoning quality by increasing computation time. Why is this?

Let's examine a concrete example. When R1 solves a complex mathematical problem:

Traditional models might directly answer: "The result is 42"

R1 shows detailed reasoning: "Let's think step by step: 1) First consider... 2) Then we can... 3) Finally, we get 42"

While R1's response appears to demonstrate "slow thinking" (CoT), this reasoning process reflects actually a generation pattern fixed during training, not dynamic exploration of multiple potential reasoning paths during response time. In other words, CoT+answer might look like "slow thinking," but it doesn't fundamentally change the unidirectional next-token prediction paradigm. R1's CoT+answer creates an illusion of slow thinking, but the generative nature remains fundamentally the GPT "fast thinking" paradigm. At test time, unlike AlphaGo, the depth and scale of thinking isn't dynamically explored, though beam search, if applied, can provide implicit multi-path optimization internally.

Test Time Compute Constraints

The industry's buzz word "test time compute" refers to reasoning models requiring more online computational resources compared to traditional non-reasoning models. For example, R1 with CoT enabled might need several times more computation time than its base model V3 for the same problem. However, this increased computation results from behavior patterns acquired during training, not dynamically adjustable compute investment. Without controllable scalability in test time compute, we can't really talk about a test time scaling law.

A major difference between pre-training and CoT reinforcement learning lies here: pre-training scaling laws can remain stable long-term because once training completes, it doesn't significantly impact online response time - the generation mode remains a simple query+answer. Therefore, offline training for months is acceptable if the resulting model shows significant capability improvements. However, reasoning models' post-training CoT reinforcement learning differs - it cultivates models' habits of responding with slow thinking, changing the generation mode to query+CoT+answer. Extending the CoT isn't just about the cost of training resources and time; more critically, it reflects in extended test time compute for each query during deployment, severely delaying system response time. Users generally have limited tolerance for slow thinking computation time and delays during online system use.

The Sustainability Debate

OpenAI's Sam Altman and Anthropic's Dario might argue that for extremely complex problems (like proving the Riemann hypothesis or designing next-generation aerospace vehicles), even if a model needs a week of computation time, it's still a massive improvement over human teams requiring decades. However, this argument has two issues:

LLM feasibility for such super-complex problems remains far from validated

Extreme scenarios lack universality and can't serve as data points for sustainable scaling laws

This isn't to deny S-curves as effective models for describing scaling laws, nor to reject the rationality of S-curve stacking. The combination of pre-training and post-training growth curves (s1 and s2) might indeed reflect the overall relationship between resource investment and performance improvement. However, we should carefully examine whether CoT reasoning truly opens a sustainable scaling curve.

Conclusion: How Far Is the LLM Road to AGI?

If reasoning models' scaling laws lack sustainability, this raises a deeper question: Can we reach the promised land of Artificial General Intelligence (AGI) through these two scaling laws alone? Furthermore, is the technical ideal of Artificial Super Intelligence (ASI) - AI replacing human labor and dramatically improving productivity - truly feasible?

Current evidence suggests that while pre-training scaling laws have shown considerable sustainability, reasoning models' scaling laws may quickly hit practical constraints. This reminds us that the path to AGI/ASI likely requires more innovative breakthroughs, not just simple extrapolation of existing methods. In the next phase of artificial intelligence development, we might need to discover entirely new growth curves.

[#LLMs #ArtificialIntelligence #DeepLearning #AGI #ScalingLaws #MachineLearning]

 

【相关】

张俊林:从Deepseek R1看Scaling Law

Technical Deep Dive: Understanding DeepSeek R1's Reasoning Mechanism in Production

A detailed analysis of how DeepSeek R1's inference mechanism works in production, and how it differs from training-time reinforcement learning.

Training vs. Deployment: Key Questions

1. Training Phase (GRPO): Does the reinforcement learning mechanism generate multiple candidate CoT+answer sequences to optimize the policy and cultivate "slow thinking" habits?

- The answer is definitively yes.

2. Deployment Phase: Does R1 implicitly generate multiple paths during inference but only display one? If so, how does this mechanism compare to traditional ensemble methods?

3. Comparison with AlphaGo's MCTS: How does R1's mechanism fundamentally differ from Monte Carlo Tree Search?

1. Inference Mechanism in Production

DeepSeek R1's real-time reasoning can be characterized by two modes:

A. Implicit Multi-path Generation and Selection

- Generation: The model may implicitly generate multiple potential reasoning paths (CoT+Answers) during a single inference but outputs only one.

- Technical Implementation: Through decoding strategies (e.g., beam width adjustment), the model maintains multiple candidate sequences, ultimately selecting the highest-scoring path.

- User Experience: Users see only the final output, though internal multi-path exploration occurs.

- Efficiency Trade-off: Setting beam_width=1 (greedy search) defaults to single-path generation for fastest response; increasing beam width improves quality at the cost of latency.

B. Explicit Multiple Candidate Generation (Optional)

- API Control: The num_return_sequences parameter allows explicit generation of multiple candidates.

- Practical Application: While not enabled by default in the DeepSeek App, this functionality may be available through enterprise APIs or open-source implementations.

2. Training Phase: Cultivating "Slow Thinking"

A. Role of Reinforcement Learning

- Objective: GRPO algorithm trains the model to generate more detailed, logical reasoning steps (longer CoT) to maximize rewards.

- Mechanism: Training generates multiple candidate answers, with rewards evaluating both answer correctness and format correctness.

B. Driving Forces Behind CoT Growth

- Reward Design: Longer CoTs naturally emerge when they lead to better answers.

- Data Feedback: High-quality SFT data generated through rejection sampling enhances this pattern.

3. Comparison with Ensemble Methods

Similarities

- Multi-path generation conceptually similar to ensemble predictions

- Result filtering comparable to voting/weighted averaging

Key Differences

R1's implicit multi-path generation is fundamentally a dynamic decoding strategy within a single model, distinct from traditional ensemble's static combination of multiple models.

4. Fundamental Distinction from AlphaGo's MCTS

AlphaGo's MCTS

- Dynamic Programming: Builds search trees through simulation

- Online Learning: Adjusts search strategy based on real-time feedback

R1's Implicit Multi-path Generation

- Static Model: Fixed parameters during deployment

- No Reward Modeling: Path selection based on model probability rather than cumulative rewards

Key Insights

1. Training phase GRPO cultivates detailed CoT capabilities for effective single-pass inference.

2. Deployment allows flexible trade-off between single-path (for speed) and multi-path (for quality) generation.

3. While model parameters are fixed post-training, decoding strategies offer some runtime flexibility.

4. R1's multi-path generation fundamentally differs from both traditional ensembles and MCTS-style dynamic planning.

This architecture achieves a practical balance between efficiency and effectiveness for large-scale industrial applications, though it sacrifices some dynamic planning and global optimization capabilities.

#ArtificialIntelligence #MachineLearning #DeepLearning #LLM #DeepSeek

【相关】

DeepSeek 笔记:推理新范式 query+cot+answer 支持新的 scaling law 吗?

LLM的"大就是好"还能走多远?

——关于Scaling Law的一些思考

 

老友张俊林《从Deepseek R1看Scaling Law的未来》一文,引起老友热议。

白老师的推荐抽提是:

核心观点:

——无限堆叠不会无限增长(物理世界规律也不支持),只有S型增长,一个S曲线一定会出现边际效益递减。

初期语言能力的涌现,与语料数据中包含的语言知识密度有关。

接下来的增长实际上是第二根S型曲线,更多语料贡献的是常识性知识,常识知识密度不及语言知识密度,所以要更大算力才能涌现。

再接下来是逻辑知识(思维链)的学习。自然语料中逻辑知识密度更低,用算力野蛮淘金,吃力不讨好。所以,用逻辑知识密度更高的合成数据做强化学习,才能让第三个S曲线爬坡。这就顺理成章了。

鲁总评论说:Scaling Law 这个词现在有点滥用。S 曲线(Sigmoid函数刻画的非线性曲线)倒是可以描述技术的生命周期,但它往往是一个接下一个(一个技术遇到瓶颈,往往才有另一个技术的开始)。。。这个在ChatGPT刚出来时我们回顾过。大模型的这几个 "Scaling Laws" 也印证这一点 (Test-Time 和 Post-Training “Scaling Laws" 有点重叠部分):

创新就是从一个S曲线到另一个S曲线,well known results。这也是斯坦福大学那位鼓吹新能源、自动驾驶以及再生食品革命等科技乐观主义的教授(叫?)每次演讲必谈的技术革命的adoption曲线。他自称根据这个曲线,他在过去30年对于技术影响社会的许多预见都证明是对的,虽然每一次预见社会都会取笑他。 

回到LLM领域的 scaling law 话题。Scaling law本质上是一种经验法则,而经验告诉我们,大多数经验法则都符合S形曲线(或增量的正态分布)。具体到LLM,"大就是好"正是这种法则在遇到平台期或天花板之前的体现。这里的"大"指的是数据规模大、模型参数量大,缺一不可。模型规模不够大,数据再多也无法有效消化——这早已是业界共识。不过OpenAI早期的设计中过分强调模型规模的做法现在看来是一种误导,直到Chinchilla Scaling Law的提出,业界才形成了更合理的共识:数据规模和模型参数量需要保持适当的比例关系。

LLM Scaling的底层逻辑是什么?

首先要明确:LLM不是数据库,其目标不是记忆长尾数据的细节。大模型训练本质上是对大数据内容的压缩,换句话说,压缩的是数据背后的知识体系(包括常识、百科知识等),重点在于揭示大大小小的各种规律性(也就是所谓的泛化能力,generalizations)。

一般直觉会认为,数据规模越大,冗余也越多。无论如何过滤清洗和去重,冗余度随规模增长,似乎意味着可榨取的"油水"会越来越少。那么为什么到了千亿tokens这种以前难以想象的数据规模,大模型依然显得"吃不饱"?为什么从千亿扩展到万亿tokens,scaling law依然有效?

这个现象的关键在于LLM是序列学习(编码)序列推理(解码)的系统。序列本身是一维的,但序列中蕴含的patterns和规律性却是高维的。举个例子:即使是简单的"猫追老鼠"这样的序列,背后可能涉及物种关系、捕食行为、空间运动等多个维度的知识。这种多维知识表现在序列层面,就会发生天然的组合爆炸。对大数据的"大胃口"正是应对这种组合爆炸的有效策略。只要不是完全的信息冗余,增加的不同序列对模型抽象数据patterns通常都是有帮助的。

然而,人类自然产生的高质量数据是有限的。预训练已经几乎吃尽了现有的高质量自然数据。于是,业界开始探索另外的AI智能增长曲线。

从预训练到推理:两个还是三个S曲线?

张俊林指出:

OpenAI o1推出后,另外两个阶段不再孤单,也各自拥有了姓名,产生了各自的Scaling Law,对应后训练阶段的强化学习Scaling Law(RL Scaling Law)和在线推理阶段的Inference Scaling Law(也叫Test Time Scaling Law)。

这里值得探讨的问题是:到底是三个S曲线,还是两个?推理模型的S曲线与此前的预训练S曲线有多大可比性?

理论上确实可以分为三个阶段:

1. 预训练
2. 后训练(尤其是推理强化学习)
3. 推理阶段

这三个阶段理论上都可能找到资源投入与性能提升之间的正相关S曲线,即scaling laws的某种表现函数。但实际上,在当前部署的应用中,后训练和推理这两个阶段应该共享同一个S曲线,原则上不存在两条独立的增长曲线。

当然,如果用户利用提示词技巧来影响模型的test time,让它更深入的思考,这可能间接影响 CoT (ChainOfThought)的长度或深度。但那是 query 的改变,是 input context 的变化,感觉也不应该算作 test time compute 的独立的 s曲线。

另外,说推理模型这一波潮流是范式转变,开启了新的 RL/Test-time scaling law,总觉得有一点太言之凿凿了。直觉上,推理模型的增长曲线与此前的预训练 scaling law 的增长曲线,大概率没有直接的可比性。

Scaling law 说的 law,实际上我们都知道是所谓经验“法则”。经验需要足够的实践数据积累,才能总结出来。强化学习赋能的推理模型才刚开始,没有足够的经验数据刻画这是怎样的一种增长关系,能持续多久,是不是昙花一现,还是可以持续相当长的时候,等等。

持续时间不够长的 scaling,其实没有多少经验法则的意义。Anthropic CEO Dario 提到 deepseek 的时候说(大意), deepseek 显得这么亮眼其实是赶上了好时机,言下之意是运气的成分大于技术硬核实力和创新(滑稽的是,Anthropic 迄今没有能力推出任何推理模型,虽然R1以来,谷歌和国内都有推理模型的上线)。他说,推理刚刚开始,所以任何人走通了这条路,在这个初期阶段都会有一个大增长。譬如PhD段位的考试题,在没有推理模型的LLM中,可能分数很低,但一旦有了推理模型,有了所谓 test time compute 的 CoT,成绩就会直线上升,给人创造了奇迹的感觉。

现在是推理模型的早期,后去会如何呢?靠增加 test time compute,或不断延长 CoT,还会有多少增长空间?这个问题是现在进行时,貌似没有明确答案。但隐隐觉得,这个持续增长的时间或曲线,远不如预训练那样稳定和持续,进而其作为 scaling law 的说法不一定站得住。

这第二条反映 RL scaling law 的后训练智能增长曲线,不大好与 pretrain scaling law 相提并论,很可能并不是可持续的,也可能很快就遭遇制约因素的强烈反弹(见后“Test Time Compute 的制约”)。

DeepSeek R1的启示:慢思考的真相

以DeepSeek R1为例,用户可以选择"deepthink"模式来启动慢思考的chain-of-thought(CoT)推理,但实际上用户难以通过增加计算时间来提升推理质量。这是为什么呢?

让我们看一个具体例子。假设我们让R1解决一个复杂的数学问题:

- 传统模型可能直接给出答案:"结果是42"
- R1会展示详细的推理过程:"让我们一步步思考:1) 首先考虑...... 2) 然后我们可以...... 3) 最后得出结果42"

表面上看,R1的回答展现了"慢思考"(CoT)的特征,但实际上这个推理过程是模型在训练阶段就已经固化的生成模式,而不是在回答问题时动态探索多个可能的推理路径。换句话说,CoT+answer 看似是"慢思考"后的回答,但其实并不改变自回归 ntp(next token prediction)的单向序列生成定式。说白了就是,R1 的 cot+answer 给人慢思考的样子,但生成的本性还是GPT“快思考”范式。在 test time,思考的深度和规模不是动态探索,虽然可以用 beam search 进行内部的隐式多路径选优。

Test Time Compute 的制约

目前业界热议的"test time compute",指的是含有CoT机制的推理模型相比传统的非推理模型需要更多的在线计算资源。以V3/R1为例,处理同样的问题,启用CoT 的R1可能需要V3 n多倍的计算时间。但这种计算量的增加是模型训练后固化的行为模式导致的,而不是可以动态调节的算力投入。test time compute 没有可控的伸缩可能性,也就谈不上 test time scaling law。

预训练与后训练的CoT强化学习的一个很大的不同是:预训练 scaling law 可以长期稳定乃是因为一旦训练完成,不大影响在线响应的时间,生成模式就是简单 query+answer。因此预训练阶段离线训练几个月都是可以忍受的,只要训练出来的大模型能力有大的提升。但推理模型后训练阶段的CoT强化学习不同,它在培养模型在线回应慢思考的习惯,生成模式是 query+cot+answer。推理模型的 cot 拉长,不仅仅是训练的资源和时间的耗费问题,更主要的是它反映在部署推理阶段的 test time compute 的延长,严重拖延了系统的响应时间。而用户在线使用系统的时候,一般来说对于慢思考的计算量和耗费时间是有能够忍耐的上限的。

这就带来了一个关键问题:即使研究表明indefinitely 增加CoT的长度(相应增加在线计算时间)能带来持续的性能提升,符合某种 scaling law 的经验法则,这种增长也会受到推理阶段现实因素的制约。一般用户可能愿意等待5-10秒获得更好的答案,但如果需要等待几分钟乃至几小时,使用体验就会大打折扣,乃至不可接受。

Scaling Law的可持续性之辩

Open AI CEO Sam Altman 和 Anthropic CEO Dario 这些大佬可能会争辩说,对于极其复杂的问题(如证明黎曼猜想、设计下一代航天战机等),即使模型需要一周的计算时间,相比人类团队需要数十年的工作量仍是极大的进步。但这种论述有两个问题:

1. 这类超复杂问题的LLM可行性远未得到验证
2. 极端场景不具有普适性,难以作为可持续的scaling law 的数据点

当然,这并不是否认S曲线作为描述scaling law的有效模型,也不是否定S曲线叠加的合理性。预训练和后训练两个阶段的增长曲线(s1和s2)叠加确实可能反映了资源投入与性能提升的整体关系。但我们需要谨慎看待CoT推理是否开启了一个真正可持续的scaling曲线。

结语:通向AGI的道路还有多远?

如果推理模型的scaling law缺乏可持续性,这就带来了一个更深层的问题:仅依靠这两个scaling laws,我们能否达到通用人工智能(AGI)的理想彼岸?更进一步,让AI平替人类劳动、极大提升生产力的超级人工智能(ASI)的技术理想是否真的可行?

目前的证据表明,预训练scaling law确实展现了相当的持续性,但推理模型的scaling law可能会较快遇到现实约束。这提醒我们,通往AGI/ASI的道路可能需要更多的创新突破,而不仅仅是现有方法的简单外推。在人工智能发展的下一个阶段,我们或许需要寻找全新的增长曲线。

 

 

【相关】

张俊林:从Deepseek R1看Scaling Law

DeepSeek 笔记:R1 部署阶段的推理机制

1. 训练阶段的强化学习机制:GRPO是否通过生成多条候选答案(multiple candidate cot+answer sequences)进行策略优化(修改模型),使得模型养成慢思考的习惯?

这个答案是毫无疑问的 YES。

2. 部署阶段的推理机制:R1是否在生成时隐式生成多条路径,但仅展示一条?如果是,这种机制与集成(ensemble)方法有何异同?

3. 与AlphaGo的MCTS的区别:MCTS树搜索是否在推理时动态构建搜索树,而集成方法只是静态组合多个模型的输出?

1. 部署阶段的隐式多路径推理机制

DeepSeek R1 的部署阶段,其推理机制可以概括为以下两种模式:

(1) 隐式多路径生成与筛选

- 生成多条路径:模型在单次推理时,可能隐式生成多条潜在的推理路径(CoT+Answers),但仅选择其中一条输出。
- 技术实现:通过调整解码策略(如束搜索宽度 `beam_width`),模型在生成过程中维护多个候选序列(即多条路径),最终选择综合评分最高的路径。
- 用户感知:用户仅看到最终输出,但模型内部进行了多路径探索与筛选。
- 效率权衡:若设置 `beam_width=1`(贪心搜索),则退化为单路径生成,响应速度最快;增大 `beam_width` 可提升输出质量,但增加计算延迟。

(2) 显式多候选生成(需主动配置)

- API级控制:通过设置 `num_return_sequences` 参数,模型可显式生成多个候选答案(如5个),用户或下游系统可进一步筛选。
- 实际应用:DeepSeek App默认未开放此功能,但在企业API或开源代码中可能支持。

关键点
- 训练阶段的强化学习优化了模型的“单路径CoT生成能力”:通过GRPO训练,模型在单次生成时即可输出高质量的详细推理步骤(长CoT),无需依赖显式多候选生成。
- 部署时的多路径探索只是“锦上添花”:隐式多路径(如束搜索)或显式多候选生成可进一步提升输出质量,但非必需功能。

 

2. 训练阶段的“慢思考习惯”培养

(1) 强化学习的作用

- 目标:通过GRPO算法,模型学习生成更详细、更合理的推理步骤(长CoT)以提高奖励(如答案正确性)。
- 机制:训练时生成多个候选答案,奖励信号不仅评估最终答案正误,还隐式鼓励逻辑连贯的推理路径(如通过格式奖励)。

(2) CoT增长的驱动力

- 奖励设计:若长CoT更易得出正确答案(如分步解题减少错误),模型在策略优化中自然倾向于生成更长、更详细的步骤。Given room for [think], a reasoning model just wants/tends to think deep!
- 数据反馈:训练后期通过拒绝采样生成的高质量SFT数据,进一步强化这一模式。

结果:训练后的模型在单次生成时即可输出高质量的详细推理(即“慢思考习惯”内化)。

3. 与集成方法(Ensemble)的异同

(1) 相似性

- 多路径生成:隐式多路径探索(如束搜索)可视为同一模型生成多个潜在输出,类似集成方法中的多模型预测。
- 结果筛选:通过置信度选择最优解,类似于集成中的投票或加权平均。

(2) 核心差异

R1的隐式多路径生成本质是单模型内的动态解码策略,而传统集成依赖多模型的静态组合,二者在实现成本与多样性来源上存在根本差异。

4. 与AlphaGo蒙特卡洛树搜索(MCTS)的本质区别

(1) AlphaGo的MCTS机制

- 动态规划:通过模拟(Simulation)构建搜索树,评估每一步的长期收益(如胜率),动态选择最优路径。
- 在线学习:在推理时根据实时反馈(如对手落子)调整搜索策略,部分版本(如AlphaZero)甚至更新模型参数。

(2) R1的隐式多路径生成

- 静态模型:部署时模型参数固定,多路径生成依赖预训练的策略与解码规则。
- 无长期收益建模:路径选择基于模型自身的置信度概率,而非多步决策的累积收益。

(3) 差异

- R1的多路径生成是静态策略的有限探索,依赖训练阶段内化的CoT+answer的生成能力。
- MCTS是动态规划过程,通过实时模拟与评估实现长期收益最大化,属于在线决策优化。

 

5. 总结

- 训练阶段的目标:GRPO通过强化学习培养模型生成详细CoT的习惯,使得部署时单次生成即可输出合理答案。
- 部署阶段的灵活性:系统可选择单路径生成(快速响应)或多路径筛选(质量优先),后者类似轻量级集成。

- 训练完成后模型参数确实固定,但隐式多路径生成依赖解码策略(如束搜索宽度),用户可通过API参数调整,非完全静态。
- 与集成的实质差异:R1的多路径生成是同一模型的不同解码路径,而传统集成依赖多个独立模型,后者多样性更高但成本激增。

- MCTS的核心是动态搜索与长期收益建模,而非多模型预测的平均化。R1的隐式多路径更接近贪心策略的扩展,而非规划过程。

DeepSeek R1的部署机制通过训练阶段的强化学习内化“慢思考”能力,使其在单次生成时即可输出详细推理。隐式多路径生成(如束搜索)可进一步提升质量,但本质是同一模型的解码策略优化,与传统集成或AlphaGo的MCTS均有显著差异。这种设计在效率与效果间取得平衡,适配大规模工业应用需求,但牺牲了动态规划与全局最优的能力。

 

【相关】

Hallucinations in AI: Bug or Feature? A Deep Dive into DeepSeek-R1

Host: Hello everyone! Welcome to today's interview. Recently, there's been quite a buzz about AI "hallucinations," especially with DeepSeek-R1, which seems to have a higher hallucination rate than its predecessor, DeepSeek-V3. Today, we're joined by Dr. Li, a senior AI researcher. Welcome, Dr. Li!

Dr. Li: Hello, host! Hello, everyone!

Host: Let's start with the million-dollar question: Why do large language models "hallucinate"? Can you break it down for us in plain English?

Dr. Li: You see, large language models are like super-powered conversation completers. Give them the first half of a sequence, say, a question, and they'll predict the second half (say, an answer) based on their massive knowledge network. They learn like our brains do – they can't remember everything word-for-word, so they compress and generalize, grabbing the gist and finding patterns.

Here's a fun contrast: Ask them "How tall is Yao Ming?" and they'll nail it because that's such famous knowledge, this data point is practically carved in stone in their memory (represented in the model's parameter weights). But ask them "How tall is Old Wang from next door?" and they're stumped because they've never met Old Wang! But here's the kicker – they won't just say "I don't know." So what do they do? They "make up" a reasonable height based on what they know about the range of human heights. That's a hallucination for you!

Host: Wow, that's some impressive guesswork! But isn't this kind of making things up pretty problematic?

Dr. Li: Not necessarily! In a way, hallucination is imagination (for better or worse) – it's where creativity lies! Think about it: all those great literary works, artistic masterpieces – aren't they all flights of fancy, products of imagination? If everything had to match reality closely, art would just be photography, and where's the fun in that?

You know, Yuval Harari makes a fascinating point in "Sapiens" – humans became Earth's dominant species precisely because we could "tell stories," creating myths, religions, nations, and money – things that don't physically exist. These are all "hallucinations," but they're the driving force behind civilization!

Host: When you put it that way, hallucinations sound pretty important! But let's talk about DeepSeek-R1. Its hallucination issue seems quite serious.

Dr. Li: Indeed, it is! The academic consensus used to follow OpenAI's view that reinforced reasoning would significantly reduce hallucinations. I remember discussing this with a head honcho at an LLM unicorn who was particularly excited about reasoning's potential to curb hallucinations. But R1's performance threw us a curveball!

According to Vectara's tests, R1's hallucination rate is more than 3 times higher than its foundation model V3's – 14.3% compared to 3.9%. This definitely correlates with its prolonged "Chain of Thought" (CoT) enabled by reinforcemnnt learning for reasoning. R1 is absolutely brilliant at reasoning, math and coding, as well as poetry and storytelling, but this currently comes with the "side effect" of increased hallucinations in things like translation and summarization.

More specifically, there are several reasons for R1's increased hallucinations.

First, the standard hallucination tests use summarization tasks, something base models are already pretty good at. In this case, reinforcement learning can backfire – it's like using a cannon to swat a fly!

Second, R1's reinforced reasoning chains weren't specifically optimized for straightforward tasks like summarization, translation, or news writing that demand strict factual accuracy. Instead, it tries to add various layers of thinking to every task. Looking at its transparent CoT (ChainOfThought) printout, we see it tirelessly analyzing even simple instructions from multiple angles. This overcomplication of simple tasks can lead to deviations and hallucinations.

During R1's reinforcement learning for NLP-related tasks, it seems the model was rewarded more heavily for creativity, leading it to be more imaginative – and consequently more prone to straying from facts. For mathematical and coding tasks, R1's supervision came from gold standards (test answers or code test cases). But for humanities tasks, they used V3 or V3's reward model to judge quality, and the current system seems to clearly favor creativity.

Moreover, user feedback typically tends to focus and encourage creativity. Most people aren't sensitive to hallucinations, especially when they're wrapped in the model's smooth, fluent language. For most frontline developers, this kind of user feedback naturally pushes them to enhance creativity rather than tackle the thorny problem of hallucinations.

Host: So, you are saying that R1's hallucination problem rooted in its over-enthusiastic reasoning? What's the real relationship between reinforced reasoning ability and hallucinations?

Dr. Li: It's still a puzzle – there's not seem to be simple correlation. Look at R1, a leading reasoning model, versus Claude 3.5 Sonnet, a top non-reasoning model. Surprisingly, Sonnet still has a higher hallucination rate than R1! But when we compare R1 to its base model V3, we see clearly that adding reasoning significantly increased hallucinations.

It may well be about the model's "personality." R1, with its powerful reinforcement learning, loves "divergent thinking." Give it a simple prompt, and it'll spin out ideas like there's no tomorrow – its CoTs could run on like crazy! This suggests that while R1 was powering up its creativity, it inevitably amplified creativity's twin: hallucination.

As a model that excels in both STEM and humanities, R1 performs differently across tasks. In mathematics and coding, where more rigorous reasoning is required, there's little room for hallucination. But in language and creative tasks, especially in the summarization tests, hallucinations become more prominent. It's largely a side effect of R1's supercharged linguistic creativity.

Technically speaking, R1 automatically adds lengthy CoTs to simple user instructions, essentially complicating straightforward tasks. Its CoTs (like  internal monologue of an entity following instructions) change the conditional part of the autoregressive probability model before generating answers, naturally affecting the final output. Compare:

V3: query → answer
R1: query+CoT → answer

For tasks that V3 already handles well, like summarization or translation, any lengthy CoT guidance might lead to deviation or embellishment, creating fertile ground for hallucinations.

Host: So where do R1's hallucinations mainly occur?

Dr. Li: Think of R1's abilities as split between "arts" and "sciences." In "science" areas like math and coding, its logic is fairly strong and hallucinations are relatively rare. But in "arts" areas like language, hallucinations become more noticeable.

R1's most impressive achievement compared to the first LLM reasoning model O1 is successfully extending mathematical and coding reasoning capabilities into creative writing, especially in Chinese. The internet is full of R1's brilliant literary works. In terms of wordplay and literary prowess, it clearly surpasses 99% of humans – even graduate students in literature and classical Chinese professors sing its praises.

But watch what happens when you ask it to do a simple summary – it can't help but "get creative," often "inventing" details not present in the original text. It's like its "arts" abilities are too powerful, a case of "too much of a good thing."

Host: That's an interesting perspective. Do all language tasks require creativity?

Dr. Li: Language tasks actually fall into two categories: ones that need high creativity, like poetry and fiction writing, and ones that demand high factual accuracy, like news reporting, translation, or summarization. R1 excels at the former, which was likely the development team's focus, but this creates side effects in the latter as it is today.

It reminds me of the old Chinese saying about translation needing to be "faithful, expressive, and elegant" – achieving all three has always been challenging. We see many examples where elegance is prioritized over faithfulness, like the use of hyperbole in literary works. We also see the opposite, like Lu Xun's advocacy for so-called "rigid translation."

Interestingly, humans have always had double standards here, but we have a mental switch we can flip at will. When watching movies or reading novels, we flip towards creativity and don't fuss about factual accuracy. But switch to news channels, and we have zero tolerance for falsehoods.

Host: People tend to believe content that appears logically coherent and detailed, so the potential harm from AI hallucinations could be significant. What should we ordinary folks do about AI hallucinations?

Dr. Li: While many people are starting to notice and become wary of these hallucinations amid their amazement at LLM's creativity, most are still mesmerized by its creative brilliance. We need to increase public awareness of AI hallucinations. I suggest a two-pronged approach:

Stay Alert: Don't take everything the model says as granted, especially factual claims. Hallucinations most commonly occur with names, places, times, locations, and other entities or numerical data.

Cross-Verify: For important details, check original sources online or consult experts to see if the claims align.

Guide the Model: When asking questions, add constraints like "please stay faithful to the original text" or "please verify facts." This can at times help reduce hallucinations.

Embrace Creativity: If you're looking for inspiration or creative ideas, model hallucinations can be a delightful surprise!

Think of AI hallucinations as "possibilities in parallel universes." What it makes up might not be true in our world, but could be true in another! It's like how novelists write fictions – while it cannot stand fact checking, it's a kind of "artistic truth." Just like novels arise from life but transcend it, AI arises from data but transcends it. AI compresses data into knowledge and common-sense network, not necesarily true to individual facts – that's what databases are for.

Host: This reminds me of what people often say: AI models aren't just "talking nonsense" – they're "talking nonsense seriously"!

Dr. Li: Haha, that's exactly it! AI hallucinations are its "educated guesses," based on the massive knowledge and patterns it's learned. The hallucinations are by noway completely random – they have internal constraints that make them seamless and convincing, but also more deceptive. Newcomers to AI need to be especially careful not to trust everything at their face value.

For regular users, understanding the nature of hallucinations is needed. For example, when asking about well-documented facts like "How long is the Yangtze River?" models won't make mistakes because these facts are firmly encoded in their parameters. But ask about an obscure creek or fictional river, and the model will activate its "reasonable completion" mechanism and make something up.

Host: Following your logic, human language itself prepares for a breeding ground for hallucinations.

Dr. Li: You could say that. Language enabled humans to create things which do not exist in the physical world, such as myths, religions, states, corporations, currency, and abstract concepts like ideals and beliefs. Harari emphasizes in "Sapiens" that story-telling (i.e. typical hallucinations) were fundamental to civilization: language enabled human story-telling abilities. Hallucinations catalyzed civilization. Humans are the only entities capable of 'lying' (besides LLMs).

Host: What about the future? Is there a way to maintain creativity while reducing hallucinations?

Dr. Li: This is definitely one of the "ultimate challenges" in AI! People are working on various solutions, including:

More Refined Training: During training, treat different types of tasks differently, teaching the model when to be strict and when to be creative.

Task-Specific Fine-tuning/Reinforcement Learning can help balance this contradiction. Tasks like summarization, paraphrasing, translation, and reporting need special care because they require both some creativity (like style) and strict factual accuracy.

Specifically, R1's training pipeline has four stages: fine-tuning 1, reinforcement 1, fine-tuning 2, and reinforcement 2. Reinforcement 2 mainly focuses on human preference alignment. Currently, this process seems to favor creativity over faithfulness, which could be rebalanced later. Perhaps more importantly, in stage three (i.e. fine-tuning 2), we could strengthen constraints for different tasks – for example, increasing supervised data for summarization to encourage faithful, straightforward results.

Routing: In the future, there will be a "model dispatcher" that assigns different models based on task type. Simple tasks could go to V3 or use tools, while complex tasks requiring deeper thinking go to R1.

For instance, arithmetic tasks should just use simple code calculations, equivalent to using a calculator. That's not how it works now – yesterday I tested a nine-digit multiplication, and R1 spent over three minutes thinking, producing CoT that could stretch down the street, breaking down the reasoning step by step. While the answer was correct, using such computationally expensive CoT for arithmetic instead of a simple function call is unreasonable. A one-line calculation code would do the job – no need to waste so much computing resource and tokens on explicit reasoning. These are foreseeable routing improvements, especially in the age of AI agents which can use all kinds of tools or applications. R1's CoT does not need to handle everything – besides hallucinations, compute-burning CoT is also not environmentally friendly.

Host: Thank you, Dr. Li, for this fascinating discussion! Today's interview has given us a much deeper understanding of AI hallucinations.

Dr. Li: My pleasure! It's been great chatting with you!

 

【相关】

从R1幻觉谈起,大模型幻觉是缺陷还是创意火花?

主持人: 大家好,欢迎来到今天的访谈。最近,大模型的“幻觉”问题引发了热议,尤其是DeepSeek-R1,它的幻觉率似乎比自己的基座大模型DeepSeek-V3高不少。今天我们请到了资深AI研究员立委博士,来跟大家聊聊这个话题。立委,您好!

立委: 主持人好,大家好!

主持人: 老李,咱们先来个灵魂拷问:为啥大模型会“产生幻觉”?能不能用大白话给大家解释一下?

立委: 这可算是大模型的经典问题。其实啊,大模型就像一个“超级接话茬儿高手”,你给它上半句,它就根据自己学过的海量知识,预测下半句该说啥。它学东西呢,就像咱们人脑记东西一样,不可能每个字都记得清清楚楚,它会进行压缩和泛化,抓大意、找规律。

打个比方,你问它“姚明有多高”,它大概率不会错,因为这知识点太出名了,它记得牢。但你要是问“隔壁老王有多高”,它可能就懵了,因为它没见过老王啊!但它又不能不回答,咋办?它就得“脑补”,根据“一般人有多高”这个学到的概念,给你编一个数出来,这就是“幻觉”。

主持人: 哎呦,这“脑补”能力也太强了!胡编乱造,这幻觉也太糟糕了。

立委: 那可不一定!你看啊,某种程度上,幻觉就是想象力(褒贬不论),就是创意!你想想,那些伟大的文学作品、艺术作品,哪个不是天马行空、充满想象?要是啥都得跟现实一模一样,艺术就成了照相机了,那还有啥意思?

就像赫拉利在《人类简史》里说的,人类之所以能成为地球霸主,就是因为我们会“讲故事”,会创造出神话、宗教、国家、货币这些现实中不存在的东西。这些都是“幻觉”,但它们却是文明诞生和发展的原动力。

主持人: 听您这么一说,感觉幻觉还挺重要的。那咱们回到DeepSeek-R1,它的幻觉问题真的很严重。

立委: 是很严重。此前学界普遍认同OpenAI的说法,推理增强会明显减少幻觉。我曾与大模型公司的一位负责人讨论,他就特别强调推理对减少幻觉的积极作用。但 R1 的表现却给出了一个出人意料的答案。

根据Vectara的测试,R1的幻觉率确实比V3高不少,R1的幻觉率14.3%,显著高于其前身V3的3.9%。这跟它加强了的“思维链”(CoT)和创造力直接相关。R1在推理、写诗、写小说方面,那叫一个厉害,但随之而来的“副作用”就是幻觉也多了。

具体到R1,幻觉增加主要有以下几个原因:首先,幻觉标准测试用的是摘要任务,我们知道摘要能力在基座大模型阶段就已经相当成熟了。在这种情况下,强化反而可能产生反效果,就像用大炮打蚊子,用力过猛反而增加了幻觉和编造的可能。

其次,R1 的长思维链强化学习并未针对摘要、翻译、新闻写作这类相对简单而对于事实要求很严格的任务做特别优化,而是试图对所有任务增加各种层面的思考。从它透明的思维链输出可以看到,即便面对一个简单的指令,它也会不厌其烦地从不同角度理解和延伸。过犹不及,这些简单任务的复杂化会引导结果偏离发挥,增加幻觉。

DeepSeek-R1在文科类任务的强化学习训练过程中,可能对模型的创造性给予了更多的奖励,导致模型在生成内容时更具创造性,也更容易偏离事实。我们知道,对于数学和代码,R1的监督信号来自于这些题目的黄金标准(习题集中的标准答案或代码的测试案例)。他们对于文科类任务,利用的是V3或V3的奖励模型来判定好坏,显然目前的系统偏好是鼓励创造性。

另外,用户更多的反馈还是鼓励和欣赏见到的创造力,一般人对于幻觉的觉察并不敏感,尤其是大模型丝滑顺畅,识别幻觉就更加困难。对于多数一线开发者,用户的这类反馈容易促使他们更加向加强创造力方向努力,而不是对付大模型领域最头痛的问题之一“幻觉”。

主持人: 这么说来,R1 的幻觉问题是不是源于它过于"积极"的思维推理?但推理能力增强和幻觉之间到底是什么关系?

立委:这个关系很微妙,并不是简单的正相关或负相关。你看 R1 是头部推理模型,而 Claude 3.5 Sonnet 是头部的非推理大模型,但后者的幻觉率反而高于前者。可是当我们对比 R1 和它的基座模型 V3 时,又发现增加推理强化后幻觉确实显著增加了。

这事儿跟大模型的“性格”有关。R1这家伙,强化做得给力,特别喜欢“发散思维”,你给它一个简单的指令,它能给你想出一大堆东西来,思维链能绕地球三圈!这似乎说明 R1 在强化创造力的过程中,不可避免地增加了创造力的伴生品:幻觉。作为一个文理通吃的推理大模型,R1 在不同领域的表现并不一样。在数学、代码等需要严谨推理的领域,幻觉的空间很小。但在语言创作领域,尤其是现在被测试的摘要任务上,幻觉问题就明显得多。这更多是 R1 语言创造力爆棚带来的副作用。

具体从技术角度来说,R1 会为用户的简单指令自动增加很长的思维链,等于是把一个简单明确的任务复杂化了。你一个简单的指令,它也反复从不同角度理解和衍伸(CoT思维链好比“小九九”,就是一个实体遵从指令时的内心独白)。思维链改变了自回归概率模型生成answer前的条件部分,自然会影响最终输出。

V3: query --〉answer
R1: query+CoT --〉answer

对于 V3 已经能很好完成的任务,比如摘要或翻译,任何思维链的长篇引导都可能带来偏离或发挥的倾向,这就为幻觉提供了温床。

主持人: 那对于R1来说,幻觉主要是出在哪方面呢?

立委: 我觉得可以把R1的能力分成“文科”和“理科”来看。它在数学、代码这些“理科”方面,逻辑性很强,幻觉相对少。但在语言文字这些“文科”方面,幻觉就比较明显了。

比起O1,R1 最令人惊艳的成就,是成功将数学和代码的推理能力充分延伸到了语言创作领域,尤其在中文能力方面表现出色。网上流传着无数的R1精彩华章。舞文弄墨方面,它显然超过了99%的人类,文学系研究生、甚至国学教授也赞不绝口。

但你看,让它做个摘要,本来是很简单的任务,但它非得给你“发挥”一下,结果就容易“编”出一些原文里没有的东西。这其实是它“文科”太强了,有点“用力过猛”。

主持人:这个说法有意思。那么在具体应用中,语言任务是不是都需要创造力呢?

立委:语言能力其实可以细分为两类:一类需要高创造力,比如写诗歌、小说;另一类需要高度真实性,比如新闻报道、翻译或摘要。R1 最受称赞的是前者,这也可能是研发团队的重点方向,但在后者中就出现了副作用。

这让我想到中国古人说的"信达雅",自古难全。为"雅"牺牲"信"的例子我们见得很多,文学创作中夸张的修辞手法就是重要手段和例证。为"信"牺牲"雅"也有先例,比如鲁迅先生推崇的"硬译"。

有趣的是,我们人类在这方面其实一直是双标的,但我们心里有个可以随时切换的开关。看小说和电影时,我们把开关偏向创造性一侧,完全不会去纠结细节是否真实;但一旦切换到新闻频道,我们就对虚假内容零容忍。

主持人: 人对于逻辑看起来清晰自洽、且详细的内容,就会倾向于相信,所以大模型幻觉潜在的危害真地很大。那咱们普通人,面对大模型的幻觉,该咋办呢?

立委: 很多人在惊艳R1创造力的同时,现在开始慢慢注意到这个幻觉现象并开始警惕了。但更多人还是沉浸在它给我们带来的创造性的惊艳中,需要增强大众对模型幻觉的 awareness。我觉得吧,咱们可以“两手抓”:

保持警惕: 大模型说的话,特别是涉及到事实的,别全信,多留个心眼。最容易产生幻觉的地方是人名、地名、时间、地点等实体或数据。

交叉验证: 重要的细节,可上网查查原始资料或询问身边专家,看看说法是不是一致。

引导模型: 你可以在提问的时候,加一些限定条件,比如“请务必忠于原文”、“请核对事实”等等,这样可以引导模型减少幻觉。

享受创意: 如果你需要的是灵感、创意,那大模型的幻觉,会给你带来惊喜!

不妨把大模型的幻觉,看成是“平行世界的可能性”。它编出来的东西,也许在这个世界不是真的,但在另一个世界里,说不定就是真的呢!就像小说家写小说,虽然是虚构的,也是一种“艺术真实”。源于生活,高于生活。大模型是源于数据,高于数据。大模型压缩的是知识体系和常识,不是一个个事实,后者是数据库的对象。

主持人: 妙啊!您这说法,让我想起了大家常说的一句话:大模型不是在“胡说八道”,而是在“一本正经地胡说八道”。

立委: 哈哈,差不多就是这个意思!大模型的幻觉,其实是它“脑补”出来的,但它“脑补”的依据,是它学到的海量知识和规律。所以,它的幻觉,往往不是乱来的,有“内在的合理性”,这才丝滑无缝,假话说的跟真的似的,但同时也更具有迷惑性。初玩大模型的朋友,需要特别小心,不能轻信。

对于普通用户来说,理解幻觉的特点很重要。比如问"长江多长"这类有足够信息冗余的百科知识问题,大模型不会出错,这些事实是刻在模型参数里的。但如果问一个不知名的小河或虚构河流的长度,模型就会启动"合理补白"机制编造。

主持人: 按照您的说法,人类的语言本身就是幻觉的温床。

立委: 可以这么说。语言使得人类创造了神话、宗教、国家、公司、货币等非真实实体的概念,以及理想、信念等形而上的意识形态。赫拉利在《人类简史》中强调了幻觉对于文明的根本作用:语言的产生赋能了人类幻觉(“讲故事”)的能力。幻觉是文明的催化剂。人类是唯一的会“说谎”的实体 -- 除了LLM外。

主持人: 那么在幻觉的背后,大模型是怎么运行的呢?

立委: 幻觉的本质是补白,是脑补。

“白”就是某个具体事实,如果这个事实在训练数据中没有足够的信息冗余度,模型就记不住(零散事实等价于噪音)。记不住就用幻觉去补白,编造细节。

幻觉绝不是没有束缚的任意编造,大模型是概率模型,束缚就是条件概率中的前文条件。幻觉选择的虚假事实需要与补白所要求的value类型匹配,即符合ontology/taxonomy 的相应的上位节点概念。“张三”可以幻觉为“李四”,但不可以幻觉成“石头”。

所谓艺术真实是说,小说创作虽然可能背离了这个世界的事实,但却是可能的数字世界的合理想象。大模型的幻觉属于此类。

大模型的知识学习过程(训练阶段),是一种信息压缩过程;大模型回答问题,就是一个信息解码过程(推理阶段)。好比升维了又降维。一个事实冗余度不够就被泛化为一个上位概念的slot,到了生成阶段这个slot必须具像化补白。“张三”这个事实忘了,但【human】这个slot 的约束还在。补白就找最合理、与 slot 概念最一致的一个实体,于是“李四”或“王五”的幻觉就可以平替“张三”。小说家就是这么工作的,人物和故事都是编造的。无论作家自己还是读者,都不觉得这是在说谎,不过所追求的真善美是在另一个层面。大模型也是如此,大模型是天生的艺术家,不是死记硬背的数据库。“张冠李戴”、“指鹿为马”等在大模型的幻觉里非常自然,因为张和李是相似的,马和鹿也在同一条延长线上。在泛化和压缩的意义上二者是等价的,因此是合理的想象。

主持人: 未来有没有什么办法,能让大模型既有创造力,又少出幻觉呢?

立委: 这绝对是AI大模型领域的“终极难题”之一!现在大家都在想办法,比如:

更精细地训练: 在训练的时候,就对不同类型的任务区别对待,让模型知道什么时候该“老实”,什么时候可以“放飞”。

针对任务做偏好微调(finetune) and/or 强化(rl)可以减缓这个矛盾。 摘要、改写、翻译、报道这种任务需要特别小心和平衡,因为它既有一点再创造的需求(例如文风),又是本性需要内容忠实的。

具体说,R1训练pipeline是四个过程,微调1,强化1,微调2,强化2。强化2主要是与人类偏好对齐的强化。这个过程在创造力与忠实方面,目前看来倾斜于前者,后去可以再做平衡。也许更重要的是在阶段三的微调2中,针对不同任务加强约束,例如,增加摘要的监督数据,引导忠实平实的结果。

Routing: 以后可能会有一个“调度员”,根据任务的类型,安排不同的模型来处理。比如,简单任务交给V3或调用工具,慢思考的复杂任务交给R1。

例如,识别出算术任务,就去写个简单代码运算,等价于调用计算器。目前不是这样,我昨天测试一个九位数的乘法,R1 思考了三分多钟,思维链打印出来可以铺开来一条街,步步分解推理。虽然最后答案是对了,但算术问题用耗费太大的所谓 test time compute 的思维链(CoT),而不用 function call,完全不合理。一行计算代码就搞定的事,没必要消耗如此多的计算资源和tokens去做显式推理。

这些都是可以预见的 routing,尤其是在agent时代。 R1 CoT不必包打一切,而且除了幻觉,也不环保。

主持人: 感谢老李的精彩分享!今天的访谈让我们对大模型的幻觉有了更深入的认识。

立委: 不客气,很高兴和大家交流!

 

【相关】

Deepseek-R1 的幻觉率是 14.3% - 比其非推理前身 Deepseek-V3 高得多
榜单排名:https://github.com/vectara/hallucination-leaderboard