Files
ai-agent-book/book/images/fig8-13.svg
T
liqiang b119135836
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

79 lines
9.1 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 980 620" width="980" height="620" style="background:#ffffff">
<defs><marker id="arrow" markerWidth="12" markerHeight="8" refX="11" refY="4" orient="auto"><polygon points="0 0, 12 4, 0 8" fill="#333333"/></marker></defs>
<text x="490" y="25" font-family="Arial, sans-serif" font-size="19" fill="#333333" text-anchor="middle" font-weight="bold">同一 SWE-bench 任务:16 次 rollout 如何产生一次更新</text>
<rect x="30" y="65" width="190" height="120" rx="7" fill="#f0f0f0" stroke="#333333" stroke-width="2"/>
<text x="125" y="88" font-family="Arial, sans-serif" font-size="16" fill="#333333" text-anchor="middle" font-weight="bold">同一任务 + 初始代码</text>
<text x="45" y="116" font-family="'Courier New', monospace" font-size="13" fill="#333333">parser.py</text>
<text x="45" y="137" font-family="'Courier New', monospace" font-size="13" fill="#333333">空输入触发 IndexError</text>
<text x="45" y="158" font-family="'Courier New', monospace" font-size="13" fill="#333333">不能修改测试文件</text>
<line x1="222" y1="125" x2="260" y2="125" stroke="#333333" stroke-width="2" marker-end="url(#arrow)"/>
<rect x="262" y="75" width="170" height="100" rx="7" fill="#d9d9d9" stroke="#333333" stroke-width="2"/>
<text x="347" y="101" font-family="Arial, sans-serif" font-size="17" fill="#333333" text-anchor="middle" font-weight="bold">策略模型</text>
<text x="347" y="128" font-family="Arial, sans-serif" font-size="14" fill="#333333" text-anchor="middle">独立采样 16 条</text>
<text x="347" y="151" font-family="Arial, sans-serif" font-size="13" fill="#666666" text-anchor="middle">每条都是一次完整执行</text>
<line x1="434" y1="125" x2="468" y2="125" stroke="#333333" stroke-width="2" marker-end="url(#arrow)"/>
<rect x="460" y="42" width="500" height="255" rx="7" fill="#fafafa" stroke="#333333" stroke-width="2"/>
<text x="710" y="64" font-family="Arial, sans-serif" font-size="16" fill="#333333" text-anchor="middle" font-weight="bold">16 个相同沙箱中的 rollout(采样不同,初始状态相同)</text>
<rect x="480" y="82" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="532.5" y="98" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#01 × 失败</text>
<rect x="595" y="82" width="105" height="30" rx="5" fill="#666666" stroke="#333333" stroke-width="1.5"/>
<text x="647.5" y="98" font-family="Arial, sans-serif" font-size="12" fill="#ffffff" text-anchor="middle" dominant-baseline="central">#02 ✓ 通过</text>
<rect x="710" y="82" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="762.5" y="98" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#03 × 失败</text>
<rect x="825" y="82" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="877.5" y="98" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#04 × 失败</text>
<rect x="480" y="124" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="532.5" y="140" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#05 × 失败</text>
<rect x="595" y="124" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="647.5" y="140" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#06 × 失败</text>
<rect x="710" y="124" width="105" height="30" rx="5" fill="#666666" stroke="#333333" stroke-width="1.5"/>
<text x="762.5" y="140" font-family="Arial, sans-serif" font-size="12" fill="#ffffff" text-anchor="middle" dominant-baseline="central">#07 ✓ 通过</text>
<rect x="825" y="124" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="877.5" y="140" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#08 × 失败</text>
<rect x="480" y="166" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="532.5" y="182" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#09 × 失败</text>
<rect x="595" y="166" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="647.5" y="182" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#10 × 失败</text>
<rect x="710" y="166" width="105" height="30" rx="5" fill="#666666" stroke="#333333" stroke-width="1.5"/>
<text x="762.5" y="182" font-family="Arial, sans-serif" font-size="12" fill="#ffffff" text-anchor="middle" dominant-baseline="central">#11 ✓ 通过</text>
<rect x="825" y="166" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="877.5" y="182" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#12 × 失败</text>
<rect x="480" y="208" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="532.5" y="224" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#13 × 失败</text>
<rect x="595" y="208" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="647.5" y="224" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#14 × 失败</text>
<rect x="710" y="208" width="105" height="30" rx="5" fill="#eeeeee" stroke="#333333" stroke-width="1.5"/>
<text x="762.5" y="224" font-family="Arial, sans-serif" font-size="12" fill="#333333" text-anchor="middle" dominant-baseline="central">#15 × 失败</text>
<rect x="825" y="208" width="105" height="30" rx="5" fill="#666666" stroke="#333333" stroke-width="1.5"/>
<text x="877.5" y="224" font-family="Arial, sans-serif" font-size="12" fill="#ffffff" text-anchor="middle" dominant-baseline="central">#16 ✓ 通过</text>
<text x="710" y="267" font-family="Arial, sans-serif" font-size="13" fill="#666666" text-anchor="middle">4 条通过,12 条失败</text>
<line x1="710" y1="299" x2="710" y2="330" stroke="#333333" stroke-width="2" marker-end="url(#arrow)"/>
<rect x="240" y="332" width="720" height="72" rx="7" fill="#f0f0f0" stroke="#333333" stroke-width="2"/>
<text x="600" y="354" font-family="Arial, sans-serif" font-size="16" fill="#333333" text-anchor="middle" font-weight="bold">奖励计算:验证器运行隐藏测试并检查路径</text>
<text x="420" y="382" font-family="Arial, sans-serif" font-size="14" fill="#333333" text-anchor="middle">通过全部测试且未改测试 → 奖励 1</text>
<text x="780" y="382" font-family="Arial, sans-serif" font-size="14" fill="#333333" text-anchor="middle">测试失败或违规 → 奖励 0</text>
<line x1="600" y1="406" x2="600" y2="435" stroke="#333333" stroke-width="2" marker-end="url(#arrow)"/>
<rect x="240" y="437" width="720" height="70" rx="7" fill="#fafafa" stroke="#333333" stroke-width="2"/>
<text x="600" y="459" font-family="Arial, sans-serif" font-size="16" fill="#333333" text-anchor="middle" font-weight="bold">组内比较 → 相对优势</text>
<text x="420" y="486" font-family="Arial, sans-serif" font-size="14" fill="#333333" text-anchor="middle">4 条成功高于平均 → 正优势</text>
<text x="780" y="486" font-family="Arial, sans-serif" font-size="14" fill="#333333" text-anchor="middle">12 条失败低于平均 → 负优势</text>
<line x1="238" y1="472" x2="205" y2="472" stroke="#333333" stroke-width="2" marker-end="url(#arrow)"/>
<rect x="30" y="360" width="175" height="145" rx="7" fill="#d9d9d9" stroke="#333333" stroke-width="2"/>
<text x="117.5" y="385" font-family="Arial, sans-serif" font-size="16" fill="#333333" text-anchor="middle" font-weight="bold">策略更新</text>
<text x="117.5" y="414" font-family="Arial, sans-serif" font-size="13" fill="#333333" text-anchor="middle">Gradient Descent</text>
<text x="117.5" y="434" font-family="Arial, sans-serif" font-size="13" fill="#333333" text-anchor="middle">+ Optimizer</text>
<text x="117.5" y="464" font-family="Arial, sans-serif" font-size="13" fill="#333333" text-anchor="middle">成功路径 ↑</text>
<text x="117.5" y="484" font-family="Arial, sans-serif" font-size="13" fill="#333333" text-anchor="middle">失败路径 ↓</text>
<path d="M117 358 L117 225 L245 225 L245 125 L260 125" fill="none" stroke="#333333" stroke-width="2" marker-end="url(#arrow)"/>
<text x="128" y="215" font-family="Arial, sans-serif" font-size="13" fill="#666666">下一 step</text>
<text x="490" y="555" font-family="Arial, sans-serif" font-size="15" fill="#666666" text-anchor="middle">一个 steprollout → 验证 → 比较 → 梯度下降更新</text>
<text x="490" y="583" font-family="Arial, sans-serif" font-size="14" fill="#666666" text-anchor="middle">粗略量级:rollout ≈ 2,000 s + update ≈ 600 s → step ≈ 2,600 s(约 43 分钟)</text>
</svg>