Sync KnowledgeBase notes from Nutstore WebDAV.
Replace demo notes with 146 vault notes and diagram assets; keep credentials only in local .env.
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 680 700" width="100%" role="img">
|
||||
<title>反向传播原理</title>
|
||||
<desc>反向传播将最终误差逐层分配回每个参数,告诉模型每个权重该怎么调</desc>
|
||||
<style>
|
||||
.th { font-family: -apple-system, sans-serif; font-size: 13px; font-weight: 500; fill: #26215C; }
|
||||
.ts { font-family: -apple-system, sans-serif; font-size: 11px; fill: #5F5E5A; }
|
||||
.tm { font-family: -apple-system, monospace; font-size: 10px; fill: #26215C; }
|
||||
.tc { font-family: -apple-system, sans-serif; font-size: 10px; fill: #888780; }
|
||||
.tb { font-family: -apple-system, sans-serif; font-size: 11px; font-weight: 500; fill: #26215C; }
|
||||
.tr { font-family: -apple-system, sans-serif; font-size: 10px; font-weight: 500; fill: #A32D2D; }
|
||||
.tg { font-family: -apple-system, sans-serif; font-size: 10px; font-weight: 500; fill: #0F6E56; }
|
||||
</style>
|
||||
|
||||
<text class="th" x="340" y="28" text-anchor="middle">问题:从错误到修正,中间差了最关键的一步</text>
|
||||
|
||||
<rect x="40" y="46" width="600" height="120" rx="10" fill="#FCEBEB" stroke="#F09595" stroke-width="0.3"/>
|
||||
|
||||
<text class="tb" x="340" y="72" text-anchor="middle">训练时你知道模型预测错了(Loss 很大),但问题来了:</text>
|
||||
|
||||
<text class="tr" x="80" y="98" text-anchor="middle">模型有几亿个参数,每个都对最终预测有贡献</text>
|
||||
<text class="tr" x="80" y="118" text-anchor="middle">你怎么知道哪些参数该调大、哪些该调小、各调多少?</text>
|
||||
|
||||
<text class="tc" x="80" y="144" text-anchor="middle">如果随机试 → 几亿个参数,每个试一次 → 永远训不完</text>
|
||||
<text class="tc" x="80" y="160" text-anchor="middle">如果只看最后一层的输出 → 前面的参数根本不知道自己的责任</text>
|
||||
|
||||
<text class="th" x="340" y="200" text-anchor="middle">方案:反向传播 — 沿着计算路径,把误差"回传"给每个参与者</text>
|
||||
|
||||
<text class="ts" x="340" y="222" text-anchor="middle">类比:团队项目搞砸了,但不需要开会扯皮——数学直接算出每人多大责任</text>
|
||||
|
||||
<rect x="40" y="240" width="600" height="170" rx="10" fill="#E6F1FB" stroke="#85B7EB" stroke-width="0.3"/>
|
||||
<text class="tb" x="340" y="264" text-anchor="middle">前向传播:产生预测和误差</text>
|
||||
|
||||
<rect x="70" y="278" width="80" height="32" rx="5" fill="#EEEDFE" stroke="#534AB7" stroke-width="0.5"/>
|
||||
<text class="tm" x="110" y="298" text-anchor="middle">输入 x</text>
|
||||
|
||||
<line x1="150" y1="294" x2="180" y2="294" stroke="#534AB7" stroke-width="1.5" marker-end="url(#af)"/>
|
||||
|
||||
<rect x="185" y="278" width="80" height="32" rx="5" fill="#E6F1FB" stroke="#185FA5" stroke-width="0.5"/>
|
||||
<text class="tm" x="225" y="298" text-anchor="middle">Layer 1</text>
|
||||
|
||||
<line x1="265" y1="294" x2="295" y2="294" stroke="#185FA5" stroke-width="1.5" marker-end="url(#af)"/>
|
||||
|
||||
<rect x="300" y="278" width="80" height="32" rx="5" fill="#FAEEDA" stroke="#854F0B" stroke-width="0.5"/>
|
||||
<text class="tm" x="340" y="298" text-anchor="middle">Layer 2</text>
|
||||
|
||||
<line x1="380" y1="294" x2="410" y2="294" stroke="#854F0B" stroke-width="1.5" marker-end="url(#af)"/>
|
||||
|
||||
<rect x="415" y="278" width="80" height="32" rx="5" fill="#EAF3DE" stroke="#3B6D11" stroke-width="0.5"/>
|
||||
<text class="tm" x="455" y="298" text-anchor="middle">...</text>
|
||||
|
||||
<line x1="495" y1="294" x2="525" y2="294" stroke="#3B6D11" stroke-width="1.5" marker-end="url(#af)"/>
|
||||
|
||||
<rect x="530" y="278" width="80" height="32" rx="5" fill="#F1EFE8" stroke="#888780" stroke-width="0.5"/>
|
||||
<text class="tm" x="570" y="298" text-anchor="middle">预测 y'</text>
|
||||
|
||||
<text class="tc" x="340" y="334" text-anchor="middle">↓ 对比真实答案 y ↓</text>
|
||||
|
||||
<rect x="250" y="346" width="180" height="32" rx="6" fill="#FCEBEB" stroke="#E24B4A" stroke-width="0.5"/>
|
||||
<text class="tr" x="340" y="366" text-anchor="middle">Loss = |y' - y|(误差)</text>
|
||||
|
||||
<text class="tc" x="340" y="398" text-anchor="middle">现在知道了"有多错",但不知道"每层各错多少"</text>
|
||||
|
||||
<rect x="40" y="418" width="600" height="170" rx="10" fill="#EEEDFE" stroke="#AFA9EC" stroke-width="0.3"/>
|
||||
<text class="tb" x="340" y="442" text-anchor="middle">反向传播:沿原路把误差分配回去</text>
|
||||
|
||||
<rect x="530" y="458" width="80" height="32" rx="5" fill="#F1EFE8" stroke="#888780" stroke-width="0.5"/>
|
||||
<text class="tm" x="570" y="478" text-anchor="middle">dL/dy'</text>
|
||||
|
||||
<line x1="525" y1="474" x2="495" y2="474" stroke="#534AB7" stroke-width="1.5" marker-end="url(#ab)"/>
|
||||
|
||||
<rect x="415" y="458" width="80" height="32" rx="5" fill="#EAF3DE" stroke="#3B6D11" stroke-width="0.5"/>
|
||||
<text class="tm" x="455" y="478" text-anchor="middle">dL/dW_n</text>
|
||||
|
||||
<line x1="410" y1="474" x2="380" y2="474" stroke="#534AB7" stroke-width="1.5" marker-end="url(#ab)"/>
|
||||
|
||||
<rect x="300" y="458" width="80" height="32" rx="5" fill="#FAEEDA" stroke="#854F0B" stroke-width="0.5"/>
|
||||
<text class="tm" x="340" y="478" text-anchor="middle">dL/dW_2</text>
|
||||
|
||||
<line x1="295" y1="474" x2="265" y2="474" stroke="#534AB7" stroke-width="1.5" marker-end="url(#ab)"/>
|
||||
|
||||
<rect x="185" y="458" width="80" height="32" rx="5" fill="#E6F1FB" stroke="#185FA5" stroke-width="0.5"/>
|
||||
<text class="tm" x="225" y="478" text-anchor="middle">dL/dW_1</text>
|
||||
|
||||
<line x1="180" y1="474" x2="150" y2="474" stroke="#534AB7" stroke-width="1.5" marker-end="url(#ab)"/>
|
||||
|
||||
<rect x="70" y="458" width="80" height="32" rx="5" fill="#EEEDFE" stroke="#534AB7" stroke-width="0.5"/>
|
||||
<text class="tm" x="110" y="478" text-anchor="middle">dL/dx</text>
|
||||
|
||||
<text class="tc" x="340" y="512" text-anchor="middle">Layer 1 的权重 W_1 只知道输入 x 是什么、Layer 2 传回来的 dL/dW_2 是什么</text>
|
||||
<text class="tc" x="340" y="528" text-anchor="middle">但 dL/dW_2 里已经包含了后面所有层的误差 → W_1 还是能收到正确的修正信号</text>
|
||||
|
||||
<text class="tb" x="340" y="556" text-anchor="middle">类比:</text>
|
||||
|
||||
<rect x="140" y="566" width="400" height="48" rx="6" fill="#26215C"/>
|
||||
<text class="tb" x="340" y="584" text-anchor="middle" fill="#fff">前向:原料流到各车间 → 做出来一个产品 → 质检发现有 10 个缺陷</text>
|
||||
<text class="tb" x="340" y="602" text-anchor="middle" fill="#fff">反向:从最后车间往回问 → "你造成的缺陷是 3 个" → "你造成 5 个" → "你造成 2 个"</text>
|
||||
|
||||
<defs>
|
||||
<marker id="af" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="5" markerHeight="5" orient="auto"><path d="M2 1L8 5L2 9" fill="none" stroke="#534AB7" stroke-width="1.2" stroke-linecap="round"/></marker>
|
||||
<marker id="ab" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="5" markerHeight="5" orient="auto"><path d="M8 1L2 5L8 9" fill="none" stroke="#534AB7" stroke-width="1.2" stroke-linecap="round"/></marker>
|
||||
</defs>
|
||||
|
||||
<text class="th" x="340" y="642" text-anchor="middle">反向传播对 GPU 意味着什么</text>
|
||||
|
||||
<rect x="40" y="658" width="600" height="34" rx="8" fill="#EAF3DE" stroke="#97C459" stroke-width="0.3"/>
|
||||
<text class="tg" x="340" y="680" text-anchor="middle">前向时必须存下每层的激活值(反向要用) → 这就是 O(n²) 显存的来源 → FlashAttention 等优化技术的动机</text>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.1 KiB |
Reference in New Issue
Block a user