R53.md · 可读全文
这里保留原文的中文、公式标记、代码和链接。可直接交给 Agent 读取,也可选取下方原文复制。此入口返回 HTML;原始 .md / .py 文件仍保留,完整候选包同时包含 UTF-8 原件。
# R53 · 其他现代部件,按位置形成阅读地图 归一化位置已经完整走过问题、改动与证据。其他现代部件先放回熟悉的算子位置,建立进一步阅读的入口。 <span id="r53-b0"></span> ## 状态 b0 按算子位置辨认RMSNorm、RoPE、SwiGLU与MoE;每项改变的是现有通路中的一个部分。 RoPE改变匹配中的位置关系,不替代mask给出的合法可见范围。 <span id="r53-b1"></span> ## 状态 b1 同图新增阅读问题:先定位改动与动机,再去原设置查代价和证据。名称本身不足以确定收益或实验指标。 ## 公式与算例详情 ### 在已知 block 上定位改动 R49 已比较归一化的位置;这里进一步区分各部件改变的对象。RMSNorm 省去均值中心化,SwiGLU 通过门控激活改造逐位置前馈层,RoPE 旋转 Q/K 的分量对,使相对位置进入匹配,MoE 则把部分前馈计算路由给专家。这些选择不是所有现代模型共同遵循的一张清单。 ### 对象与代价不能只靠名字判断 QK normalization 原论文采用逐头 L2 归一化与可学习缩放,处理的是匹配分数的尺度,不能直接等同于任意 RMSNorm(Q/K) 实现,更不是对词表概率归一化。RoPE 处理位置关系,不能替代因果 mask。MoE 的活跃计算、总参数存储和路由/通信成本应分别计算;一次激活少量专家并不表示全部成本同时下降。 学生讲义第六章 §6.15 按各原论文保留目标、代价与证据。选择变体时,应从当前模型的具体问题出发,说明改变哪个计算环节,再用同一任务与资源口径验证。 ### 参考与采用 - [On Layer Normalization in the Transformer Architecture](https://arxiv.org/abs/2002.04745):Pre-LN moves normalization inside the residual branch; paper analyzes initialization gradients and warm-up behavior. 复核位置:Primary abstract read. - [Root Mean Square Layer Normalization](https://arxiv.org/abs/1910.07467):RMSNorm drops recentering and rescales by root mean square, followed by learned scale: y_i=gamma_i*x_i/sqrt(eps+mean_j x_j^2). 复核位置:Primary abstract read; source-slide formula inspected at full size and checked mathematically. - [GLU Variants Improve Transformer](https://arxiv.org/html/2002.05202v1):SwiGLU FFN=(SiLU(XW_g) elementwise-multiplied by XW_u)W_d for beta=1; three matrices. A 2/3 hidden width relative to ordinary two-matrix FFN approximately matches parameter count. 复核位置:Full formula sections read: equations 5–6 and parameter/compute matching discussion. - [RoFormer: Enhanced Transformer with Rotary Position Embedding](https://arxiv.org/abs/2104.09864):Apply position-dependent rotations to Q/K so their inner product depends on relative position: (R_i q)^T(R_j k)=q^T R_(j-i) k. 复核位置:Primary abstract read; Q/K relative-rotation identity checked mathematically. - [Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer](https://arxiv.org/abs/1701.06538):Learned sparse gating activates selected feed-forward experts for each example/token, increasing parameter capacity with limited active expert computation. 复核位置:Primary abstract read. - [Query-Key Normalization for Transformers](https://arxiv.org/abs/2010.04245):Historical QKNorm L2-normalizes Q and K along the head dimension and uses a learnable scale instead of dividing by sqrt(d_k). 复核位置:Primary abstract read. 原课页采用记录:[M32 现代归一化与 FFN 变体](sources.html#M32)。页码均按PDF物理页计。 ### 继续学习 若某个现代部件的用途不清楚,读[在已经认识的 block 上读懂现代部件](https://codingai-lec05.pages.dev/course/knowledge/modern-transformer-parts.html)中对应的 RMSNorm、QK normalization、SwiGLU、MoE 或 RoPE 小节,与[部件位置与成本边界](lecture.html#read-R53)对照。[CLS 02](https://deepnote.com/workspace/ise3309jingao-5ba66b0a-4283-4f5a-ae06-3f68d3201e99/project/Fall-26-Lecture-05-841ec8e7-e352-4840-b628-d3742b03d6d0/notebook/CLS-02-Attention-Transformer-2d44adcb6f3d409aa7dfb25c21a748a3?utm_content=2d44adcb6f3d409aa7dfb25c21a748a3&utm_source=openai&utm_medium=mcp&utm_campaign=openaimcp&utm_term=get_notebook)同题段落解释选择理由,[LAB 03](https://deepnote.com/workspace/ise3309jingao-5ba66b0a-4283-4f5a-ae06-3f68d3201e99/project/Fall-26-Lecture-05-841ec8e7-e352-4840-b628-d3742b03d6d0/notebook/LAB-03-Transformer-9c5b3d45acdb438a8e7df1dc6cb97e40?utm_content=9c5b3d45acdb438a8e7df1dc6cb97e40&utm_source=openai&utm_medium=mcp&utm_campaign=openaimcp&utm_term=get_notebook) F 只能先核对前向路径;要决定投入,结合[两种时间尺度的路线判断](https://codingai-lec05.pages.dev/course/knowledge/architecture-choices-and-state.html)与[受约束的实验设计](experiments.html#r5-controlled)先指定瓶颈、控制条件及质量/资源指标。