2536c937e3
翻译自英文原版 maths-cs-ai-compendium,共 20 章全部完成。 第01章 向量 | 第02章 矩阵 | 第03章 微积分 第04章 统计学 | 第05章 概率论 | 第06章 机器学习 第07章 计算语言学 | 第08章 计算机视觉 | 第09章 音频与语音 第10章 多模态学习 | 第11章 自主系统 | 第12章 图神经网络 第13章 计算与操作系统 | 第14章 数据结构与算法 第15章 生产级软件工程 | 第16章 SIMD与GPU编程 第17章 AI推理 | 第18章 ML系统设计 第19章 应用人工智能 | 第20章 前沿人工智能 翻译说明: - 所有数学公式 $...$ / $$...$$、代码块、图片引用完整保留 - mkdocs.yml 配置中文导航 + language: zh - README.md 已翻译为中文(兼 docs/index.md) - docs/ 目录包含指向各章文件的 symlink - 约 29,000 行中文内容,排除 .cache/ 构建缓存
88 lines
5.6 KiB
XML
88 lines
5.6 KiB
XML
<svg width="700" height="320" xmlns="http://www.w3.org/2000/svg">
|
|
<text x="350" y="22" fill="#333" font-size="14" font-weight="bold" text-anchor="middle">Data Parallelism vs Model Parallelism</text>
|
|
|
|
<!-- Divider -->
|
|
<line x1="350" y1="32" x2="350" y2="310" stroke="#ccc" stroke-width="1" stroke-dasharray="4,4"/>
|
|
|
|
<!-- === DATA PARALLELISM (left) === -->
|
|
<text x="175" y="50" fill="#3498db" font-size="13" font-weight="bold" text-anchor="middle">Data Parallelism</text>
|
|
|
|
<!-- Full model copies -->
|
|
<rect x="55" y="70" width="70" height="60" rx="4" fill="#3498db" opacity="0.15" stroke="#3498db" stroke-width="1.5"/>
|
|
<text x="90" y="95" fill="#3498db" font-size="9" text-anchor="middle">Full</text>
|
|
<text x="90" y="108" fill="#3498db" font-size="9" text-anchor="middle">Model</text>
|
|
|
|
<rect x="140" y="70" width="70" height="60" rx="4" fill="#3498db" opacity="0.15" stroke="#3498db" stroke-width="1.5"/>
|
|
<text x="175" y="95" fill="#3498db" font-size="9" text-anchor="middle">Full</text>
|
|
<text x="175" y="108" fill="#3498db" font-size="9" text-anchor="middle">Model</text>
|
|
|
|
<rect x="225" y="70" width="70" height="60" rx="4" fill="#3498db" opacity="0.15" stroke="#3498db" stroke-width="1.5"/>
|
|
<text x="260" y="95" fill="#3498db" font-size="9" text-anchor="middle">Full</text>
|
|
<text x="260" y="108" fill="#3498db" font-size="9" text-anchor="middle">Model</text>
|
|
|
|
<!-- GPU labels -->
|
|
<text x="90" y="66" fill="#666" font-size="8" text-anchor="middle">GPU 0</text>
|
|
<text x="175" y="66" fill="#666" font-size="8" text-anchor="middle">GPU 1</text>
|
|
<text x="260" y="66" fill="#666" font-size="8" text-anchor="middle">GPU 2</text>
|
|
|
|
<!-- Data splits -->
|
|
<rect x="55" y="145" width="70" height="28" rx="4" fill="#27ae60" opacity="0.2" stroke="#27ae60" stroke-width="1"/>
|
|
<text x="90" y="164" fill="#27ae60" font-size="9" text-anchor="middle">Data 1/3</text>
|
|
|
|
<rect x="140" y="145" width="70" height="28" rx="4" fill="#27ae60" opacity="0.2" stroke="#27ae60" stroke-width="1"/>
|
|
<text x="175" y="164" fill="#27ae60" font-size="9" text-anchor="middle">Data 2/3</text>
|
|
|
|
<rect x="225" y="145" width="70" height="28" rx="4" fill="#27ae60" opacity="0.2" stroke="#27ae60" stroke-width="1"/>
|
|
<text x="260" y="164" fill="#27ae60" font-size="9" text-anchor="middle">Data 3/3</text>
|
|
|
|
<!-- Gradient sync -->
|
|
<line x1="90" y1="185" x2="90" y2="205" stroke="#e74c3c" stroke-width="1"/>
|
|
<line x1="175" y1="185" x2="175" y2="205" stroke="#e74c3c" stroke-width="1"/>
|
|
<line x1="260" y1="185" x2="260" y2="205" stroke="#e74c3c" stroke-width="1"/>
|
|
<line x1="80" y1="205" x2="270" y2="205" stroke="#e74c3c" stroke-width="1.5"/>
|
|
<text x="175" y="222" fill="#e74c3c" font-size="10" text-anchor="middle" font-weight="bold">All-Reduce gradients</text>
|
|
|
|
<text x="175" y="248" fill="#666" font-size="9" text-anchor="middle">Same model on each GPU</text>
|
|
<text x="175" y="262" fill="#666" font-size="9" text-anchor="middle">Different data on each GPU</text>
|
|
<text x="175" y="276" fill="#3498db" font-size="10" text-anchor="middle" font-weight="bold">Scales batch size</text>
|
|
|
|
<!-- === MODEL PARALLELISM (right) === -->
|
|
<text x="525" y="50" fill="#e74c3c" font-size="13" font-weight="bold" text-anchor="middle">Model Parallelism</text>
|
|
|
|
<!-- Model shards -->
|
|
<rect x="395" y="70" width="70" height="60" rx="4" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="1.5"/>
|
|
<text x="430" y="92" fill="#e74c3c" font-size="9" text-anchor="middle">Layers</text>
|
|
<text x="430" y="105" fill="#e74c3c" font-size="9" text-anchor="middle">1-4</text>
|
|
|
|
<rect x="480" y="70" width="70" height="60" rx="4" fill="#e74c3c" opacity="0.2" stroke="#e74c3c" stroke-width="1.5"/>
|
|
<text x="515" y="92" fill="#e74c3c" font-size="9" text-anchor="middle">Layers</text>
|
|
<text x="515" y="105" fill="#e74c3c" font-size="9" text-anchor="middle">5-8</text>
|
|
|
|
<rect x="565" y="70" width="70" height="60" rx="4" fill="#e74c3c" opacity="0.25" stroke="#e74c3c" stroke-width="1.5"/>
|
|
<text x="600" y="92" fill="#e74c3c" font-size="9" text-anchor="middle">Layers</text>
|
|
<text x="600" y="105" fill="#e74c3c" font-size="9" text-anchor="middle">9-12</text>
|
|
|
|
<!-- GPU labels -->
|
|
<text x="430" y="66" fill="#666" font-size="8" text-anchor="middle">GPU 0</text>
|
|
<text x="515" y="66" fill="#666" font-size="8" text-anchor="middle">GPU 1</text>
|
|
<text x="600" y="66" fill="#666" font-size="8" text-anchor="middle">GPU 2</text>
|
|
|
|
<!-- Same data -->
|
|
<rect x="440" y="145" width="160" height="28" rx="4" fill="#27ae60" opacity="0.2" stroke="#27ae60" stroke-width="1"/>
|
|
<text x="520" y="164" fill="#27ae60" font-size="9" text-anchor="middle">Full Data (same batch)</text>
|
|
|
|
<!-- Activation passing -->
|
|
<line x1="465" y1="130" x2="490" y2="130" stroke="#9b59b6" stroke-width="1.5"/>
|
|
<polygon points="490,127 497,130 490,133" fill="#9b59b6"/>
|
|
<line x1="550" y1="130" x2="575" y2="130" stroke="#9b59b6" stroke-width="1.5"/>
|
|
<polygon points="575,127 582,130 575,133" fill="#9b59b6"/>
|
|
<text x="525" y="145" fill="#9b59b6" font-size="8" text-anchor="middle">pass activations</text>
|
|
|
|
<text x="525" y="200" fill="#666" font-size="9" text-anchor="middle">Model split across GPUs</text>
|
|
<text x="525" y="214" fill="#666" font-size="9" text-anchor="middle">Same data on all GPUs</text>
|
|
<text x="525" y="228" fill="#e74c3c" font-size="10" text-anchor="middle" font-weight="bold">Scales model size</text>
|
|
|
|
<!-- Comparison -->
|
|
<rect x="130" y="290" width="440" height="22" rx="6" fill="#f5f5f5" stroke="#333" stroke-width="1"/>
|
|
<text x="350" y="305" fill="#333" font-size="10" text-anchor="middle">Most large models use both: hybrid parallelism (data + tensor + pipeline)</text>
|
|
</svg> |