Loading...
正在加载...
请稍候

DyTopo: 动态拓扑路由如何打破Scaling Law

✨步子哥 (steper) 2026年03月28日 08:56
<!DOCTYPE html><html lang="zh-CN"><head> <meta charset="UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>DyTopo: 动态拓扑路由如何打破Scaling Law</title> <script src="https://cdn.tailwindcss.com"></script> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&amp;family=Playfair+Display:ital,wght@0,400;0,600;1,400;1,600&amp;display=swap" rel="stylesheet"/> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"/> <script src="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js"></script> <style> :root { --primary: #2563eb; --secondary: #64748b; --accent: #f59e0b; --neutral: #374151; --surface: #f8fafc; } body { font-family: 'Inter', sans-serif; line-height: 1.7; color: var(--neutral); } .font-display { font-family: 'Playfair Display', serif; } .hero-gradient { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); } .mermaid-container { display: flex; justify-content: center; min-height: 300px; max-height: 800px; background: #ffffff; border: 2px solid #e5e7eb; border-radius: 12px; padding: 30px; margin: 30px 0; box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08); position: relative; overflow: hidden; } .mermaid-container .mermaid { width: 100%; max-width: 100%; height: 100%; cursor: grab; transition: transform 0.3s ease; transform-origin: center center; display: flex; justify-content: center; align-items: center; touch-action: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .mermaid-container .mermaid svg { max-width: 100%; height: 100%; display: block; margin: 0 auto; } .mermaid-container .mermaid:active { cursor: grabbing; } .mermaid-container.zoomed .mermaid { height: 100%; width: 100%; cursor: grab; } .mermaid-controls { position: absolute; top: 15px; right: 15px; display: flex; gap: 10px; z-index: 20; background: rgba(255, 255, 255, 0.95); padding: 8px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } .mermaid-control-btn { background: #ffffff; border: 1px solid #d1d5db; border-radius: 6px; padding: 10px; cursor: pointer; transition: all 0.2s ease; color: #374151; font-size: 14px; min-width: 36px; height: 36px; text-align: center; display: flex; align-items: center; justify-content: center; } .mermaid-control-btn:hover { background: #f8fafc; border-color: #3b82f6; color: #3b82f6; transform: translateY(-1px); } .mermaid-control-btn:active { transform: scale(0.95); } .toc-fixed { position: fixed; top: 2rem; left: 2rem; width: 280px; max-height: calc(100vh - 4rem); overflow-y: auto; z-index: 50; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.5rem; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); } .main-content { margin-left: 320px; padding: 2rem; } .citation { color: var(--primary); text-decoration: none; font-weight: 500; } .citation:hover { text-decoration: underline; } .highlight-box { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-left: 4px solid var(--accent); padding: 1.5rem; margin: 2rem 0; border-radius: 0 8px 8px 0; } .data-point { display: inline-block; background: var(--primary); color: white; padding: 0.25rem 0.75rem; border-radius: 9999px; font-weight: 600; font-size: 0.875rem; } <span class="mention-invalid">@media</span> (max-width: 1280px) { .toc-fixed { display: none; } .main-content { margin-left: 0; } } <span class="mention-invalid">@media</span> (max-width: 1024px) { .mermaid-control-btn:not(.reset-zoom) { display: none; } .mermaid-controls { top: auto; bottom: 15px; right: 15px; } } <span class="mention-invalid">@media</span> (max-width: 768px) { .hero-gradient .bg-white { word-wrap: break-word; overflow-wrap: break-word; } } </style> <base target="_blank"> </head> <body class="bg-gray-50"> <!-- Fixed Table of Contents --> <nav class="toc-fixed"> <h3 class="font-display font-semibold text-lg mb-4 text-gray-800">目录</h3> <ul class="space-y-2 text-sm"> <li> <a href="#hero" class="citation">引言与概述</a> </li> <li> <a href="#disruptive-phenomenon" class="citation">颠覆性现象</a> </li> <li> <a href="#core-technology" class="citation">核心技术原理</a> </li> <li> <a href="#architecture-comparison" class="citation">架构对比分析</a> </li> <li> <a href="#applications" class="citation">应用场景与影响</a> </li> <li> <a href="#computational-democracy" class="citation">算力平权与风险</a> </li> <li> <a href="#conclusion" class="citation">结论与前瞻</a> </li> </ul> </nav> <!-- Main Content --> <div class="main-content"> <!-- Hero Section --> <section id="hero" class="mb-16"> <div class="hero-gradient rounded-2xl p-8 mb-8 text-white"> <div class="grid grid-cols-1 lg:grid-cols-3 gap-8 items-center"> <div class="lg:col-span-2"> <h1 class="font-display text-4xl lg:text-5xl font-bold leading-tight mb-6"> <span class="italic">DyTopo:</span> <br/> 动态拓扑路由如何打破Scaling Law </h1> <p class="text-xl text-blue-100 mb-4"> 小模型逆袭的技术革命与组织启示 </p> <div class="flex flex-wrap gap-2"> <span class="data-point">8B vs 120B</span> <span class="data-point">+57.1% 性能提升</span> <span class="data-point">-51.6% Token消耗</span> </div> </div> <div class="lg:col-span-1"> <img src="https://kimi-web-img.moonshot.cn/img/crad.ict.ac.cn/c4089f0d5623fa56ac6ced775b3724c784f0ec90.jpg" alt="抽象神经网络连接图" class="rounded-lg shadow-2xl opacity-90" size="medium" aspect="wide" query="抽象神经网络" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> </div> </div> </div> <!-- Key Highlights Grid --> <div class="grid grid-cols-1 md:grid-cols-3 gap-6"> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <div class="flex items-center mb-4"> <i class="fas fa-bolt text-yellow-500 text-2xl mr-3"></i> <h3 class="font-semibold text-lg">性能突破</h3> </div> <p class="text-gray-600">8B参数模型在数学推理任务上超越120B参数模型,上下文污染问题得到根本解决</p> </div> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <div class="flex items-center mb-4"> <i class="fas fa-network-wired text-blue-500 text-2xl mr-3"></i> <h3 class="font-semibold text-lg">架构创新</h3> </div> <p class="text-gray-600">动态拓扑路由将静态群聊转变为自由交易集市,通信效率提升40-60%</p> </div> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <div class="flex items-center mb-4"> <i class="fas fa-balance-scale text-green-500 text-2xl mr-3"></i> <h3 class="font-semibold text-lg">算力平权</h3> </div> <p class="text-gray-600">小模型通过系统组织力实现逆袭,打破大厂的算力垄断格局</p> </div> </div> </section> <!-- Disruptive Phenomenon --> <section id="disruptive-phenomenon" class="mb-16"> <h2 class="font-display text-3xl font-bold mb-8 text-gray-800">颠覆性现象:8B参数模型&#34;绞杀&#34;120B巨头的真相</h2> <div class="highlight-box"> <h3 class="font-semibold text-lg mb-3">核心发现</h3> <p>DyTopo框架使<span class="data-point">8B参数小模型</span>在复杂推理任务上超越<span class="data-point">120B参数大模型</span>,同时削减<span class="data-point">40-60%</span>的Token消耗,标志着&#34;模型越大越好&#34;Scaling Law的潜在转折点。</p> </div> <h3 class="font-display text-2xl font-semibold mb-6 mt-8">反直觉实验结果解析</h3> <!-- Performance Comparison Table --> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4">跨模型后端性能提升一致性验证</h4> <div class="overflow-x-auto"> <table class="w-full text-sm"> <thead class="bg-gray-50"> <tr> <th class="px-4 py-3 text-left font-medium text-gray-700">模型后端</th> <th class="px-4 py-3 text-left font-medium text-gray-700">基准测试</th> <th class="px-4 py-3 text-left font-medium text-gray-700">基线准确率</th> <th class="px-4 py-3 text-left font-medium text-gray-700">DyTopo准确率</th> <th class="px-4 py-3 text-left font-medium text-gray-700">相对提升</th> </tr> </thead> <tbody class="divide-y divide-gray-200"> <tr> <td class="px-4 py-3 font-medium">Llama3-8B-Instruct</td> <td class="px-4 py-3">HumanEval</td> <td class="px-4 py-3">80.49%</td> <td class="px-4 py-3 font-semibold text-blue-600">89.63%</td> <td class="px-4 py-3 text-green-600">+11.4%</td> </tr> <tr class="bg-gray-50"> <td class="px-4 py-3 font-medium">Llama3-8B-Instruct</td> <td class="px-4 py-3">Math-500</td> <td class="px-4 py-3">30.00%</td> <td class="px-4 py-3 font-semibold text-blue-600">47.14%</td> <td class="px-4 py-3 text-green-600 font-bold">+57.1%</td> </tr> <tr> <td class="px-4 py-3 font-medium">Qwen3-8B</td> <td class="px-4 py-3">Omni-Math</td> <td class="px-4 py-3">35.71%</td> <td class="px-4 py-3 font-semibold text-blue-600">51.43%</td> <td class="px-4 py-3 text-green-600">+44.0%</td> </tr> <tr class="bg-gray-50"> <td class="px-4 py-3 font-medium">Qwen3-8B</td> <td class="px-4 py-3">Math-500</td> <td class="px-4 py-3">48.57%</td> <td class="px-4 py-3 font-semibold text-blue-600">75.71%</td> <td class="px-4 py-3 text-green-600">+55.9%</td> </tr> </tbody> </table> </div> <p class="text-sm text-gray-600 mt-4"> <a href="https://arxiv.org/pdf/2602.06039" class="citation" target="_blank"> <i class="fas fa-external-link-alt mr-1"></i>数据来源:DyTopo论文实验结果 </a> </p> </div> <h3 class="font-display text-2xl font-semibold mb-6">成本效率的量化分析</h3> <p class="text-gray-700 mb-6"> 在HumanEval基准测试中,DyTopo展现出惊人的效率优势:<span class="data-point">9,453 tokens</span> vs 基线<span class="data-point">19,520 tokens</span>,削减<span class="data-point">51.6%</span>的Token消耗。延迟方面,<span class="data-point">22.3秒</span>对比<span class="data-point">39.8秒</span>,加速<span class="data-point">44.0%</span>。 </p> <h3 class="font-display text-2xl font-semibold mb-6">Scaling Law的重新审视</h3> <p class="text-gray-700 mb-6"> DyTopo揭示了一个被忽视的维度:<strong>架构本身成为可优化变量时,小规模模型通过更优的组织形式可能触及甚至超越大规模模型在次优架构下的表现</strong>。这一发现并非否定Scaling Law,而是扩展了性能优化的维度空间——从单一模型的规模缩放,扩展到多模型系统的架构优化。 </p> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4">系统组织力 vs 单体智能的新范式</h4> <img src="https://kimi-web-img.moonshot.cn/img/img2024.cnblogs.com/518a3d6f6bbca386362289ceacfa8875ae5fc755.png" alt="展示单体智能与系统组织力范式对比的示意图" class="w-full rounded-lg mb-4" size="medium" aspect="wide" query="单体智能与系统组织力对比" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> <p class="text-gray-600 text-sm"> 传统单体智能追求在单一模型中封装尽可能多的知识和能力,而系统组织力通过动态协调多个专业化组件实现复杂功能 </p> </div> </section> <!-- Core Technology --> <section id="core-technology" class="mb-16"> <h2 class="font-display text-3xl font-bold mb-8 text-gray-800">核心技术原理:动态拓扑路由的深度拆解</h2> <h3 class="font-display text-2xl font-semibold mb-6">问题根源:多智能体系统的&#34;上下文污染&#34;死结</h3> <!-- Mermaid Diagram --> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4">五阶段算法流程</h4> <div class="mermaid-container"> <div class="mermaid-controls"> <button class="mermaid-control-btn zoom-in" title="放大"> <i class="fas fa-search-plus"></i> </button> <button class="mermaid-control-btn zoom-out" title="缩小"> <i class="fas fa-search-minus"></i> </button> <button class="mermaid-control-btn reset-zoom" title="重置"> <i class="fas fa-expand-arrows-alt"></i> </button> <button class="mermaid-control-btn fullscreen" title="全屏查看"> <i class="fas fa-expand"></i> </button> </div> <div class="mermaid"> graph TD A[&#34;Phase 1: 单遍代理推理 <br/>Single-Pass Agent Inference&#34;] --&gt; B[&#34;Phase 2: 拓扑诱导 <br/>Topology Induction&#34;] B --&gt; C[&#34;Phase 3: 消息排序 <br/>Deterministic Message Ordering&#34;] C --&gt; D[&#34;Phase 4: 路由与记忆更新 <br/>Routing &amp; Memory Update&#34;] D --&gt; E[&#34;Phase 5: 管理器控制 <br/>Manager Control&#34;] E --&gt; F{&#34;是否终止?&#34;} F --&gt;|&#34;否&#34;| A F --&gt;|&#34;是&#34;| G[&#34;输出最终解 <br/>Final Solution&#34;] style A fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af,font-weight:600 style B fill:#fef3c7,stroke:#f59e0b,stroke-width:2px,color:#92400e,font-weight:600 style C fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#166534,font-weight:600 style D fill:#fce7f3,stroke:#ec4899,stroke-width:2px,color:#be185d,font-weight:600 style E fill:#f3e8ff,stroke:#9333ea,stroke-width:2px,color:#7c2d12,font-weight:600 style F fill:#f8fafc,stroke:#64748b,stroke-width:3px,color:#374151,font-weight:700 style G fill:#ecfdf5,stroke:#059669,stroke-width:3px,color:#065f46,font-weight:700 </div> </div> <p class="text-gray-600 text-sm mt-4"> DyTopo的五阶段闭环控制流程:从单遍推理到自适应终止的完整协作循环 </p> </div> <h4 class="font-semibold text-lg mb-4">语义匹配算法的核心机制</h4> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> <div> <h5 class="font-semibold mb-3">Query-Key描述符机制</h5> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>Query描述符:</strong>表达&#34;我需要什么信息&#34;</li> <li>• <strong>Key描述符:</strong>表达&#34;我能提供什么能力&#34;</li> <li>• <strong>384维嵌入:</strong>sentence-transformers/all-MiniLM-L6-v2</li> <li>• <strong>余弦相似度:</strong>量化语义对齐程度</li> </ul> </div> <div> <h5 class="font-semibold mb-3">拓扑约束参数</h5> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>最大入度K_in=3:</strong>认知负荷管理</li> <li>• <strong>相似度阈值τ_edge:</strong>质量控制</li> <li>• <strong>硬截断策略:</strong>防止信息过载</li> <li>• <strong>每轮重构:</strong>自适应需求变化</li> </ul> </div> </div> <p class="text-sm text-gray-600 mt-4"> <a href="https://www.themoonlight.io/zh/review/dytopo-dynamic-topology-routing-for-multi-agent-reasoning-via-semantic-matching" class="citation" target="_blank"> <i class="fas fa-external-link-alt mr-1"></i>技术细节来源:DyTopo技术解析 </a> </p> </div> <h3 class="font-display text-2xl font-semibold mb-6">死锁打破机制:贪婪循环打破启发式算法</h3> <p class="text-gray-700 mb-6"> 当智能体形成相互依赖的循环(A→B→C→A)时,贪婪循环打破算法通过<strong>迭代选择限制性入度最小的节点</strong>来打破死锁。这一策略优先处理&#34;最不受约束&#34;的智能体,确保系统能够持续推进推理。 </p> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4">算法完备性保证</h4> <img src="https://kimi-web-img.moonshot.cn/img/img2018.cnblogs.com/a85eed0fb31889b238f7541b39f281558e17f4ab.png" alt="算法流程图展示节点处理顺序和循环打破策略" class="w-full rounded-lg mb-4" size="medium" aspect="wide" query="算法流程图" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>确定性输出:</strong>给定相同拓扑结构,总是产生相同的消息排序</li> <li>• <strong>完备性:</strong>对任意有限图都能产生输出并终止</li> <li>• <strong>计算复杂度:</strong>O(V+E),线性于图规模</li> <li>• <strong>循环处理:</strong>强制插入最小入度节点以打破循环</li> </ul> </div> </section> <!-- Architecture Comparison --> <section id="architecture-comparison" class="mb-16"> <h2 class="font-display text-3xl font-bold mb-8 text-gray-800">架构对比:从&#34;静态群聊&#34;到&#34;自由交易集市&#34;</h2> <h3 class="font-display text-2xl font-semibold mb-6">传统多智能体系统的结构性缺陷</h3> <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8"> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <h4 class="font-semibold text-lg mb-4 text-red-600">全连接广播拓扑</h4> <img src="https://fixedplaceholder" alt="全连接网络拓扑结构示意图" class="w-full rounded-lg mb-4" size="medium" aspect="square" query="全连接网络拓扑" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>复杂度:</strong>O(N²) 平方增长</li> <li>• <strong>上下文膨胀:</strong>信息过载严重</li> <li>• <strong>注意力稀释:</strong>关键信号识别能力下降</li> </ul> </div> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <h4 class="font-semibold text-lg mb-4 text-orange-600">固定流水线架构</h4> <img src="https://kimi-web-img.moonshot.cn/img/p8.itc.cn/d7b749c4324856c12b43ca451a67ec6e649fe88d.png" alt="线性流水线架构图" class="w-full rounded-lg mb-4" size="medium" aspect="wide" style="linedrawing" query="线性流水线架构" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>灵活性缺失:</strong>无法适应非线性推理</li> <li>• <strong>迭代困难:</strong>回溯和并行探索受限</li> <li>• <strong>刚性约束:</strong>强制拟合预设流程</li> </ul> </div> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <h4 class="font-semibold text-lg mb-4 text-yellow-600">中心化Hub模式</h4> <img src="https://kimi-web-img.moonshot.cn/img/hkxb.buaa.edu.cn/21c334148b69bdbbbc004988d9ec1c24a5f7178c.jpg" alt="星型网络拓扑结构" class="w-full rounded-lg mb-4" size="medium" aspect="square" style="linedrawing" query="星型网络拓扑" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>单点瓶颈:</strong>中心节点过载</li> <li>• <strong>故障敏感:</strong>中心失效导致系统瘫痪</li> <li>• <strong>延迟瓶颈:</strong>所有信息需中转</li> </ul> </div> </div> <h3 class="font-display text-2xl font-semibold mb-6">DyTopo的创新性架构设计</h3> <div class="highlight-box mb-8"> <h4 class="font-semibold text-lg mb-3">市场化匹配机制的核心优势</h4> <p>DyTopo将多智能体系统从&#34;计划指令经济&#34;转变为&#34;自由交易集市&#34;,通过语义驱动的按需连接实现信息效率的最优化。智能体作为自主参与者,通过发布需求和能力广告寻找最佳交易伙伴。</p> </div> <!-- Efficiency Comparison Table --> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4">DyTopo与AgentScope的全面对比</h4> <div class="overflow-x-auto"> <table class="w-full text-sm"> <thead class="bg-gray-50"> <tr> <th class="px-4 py-3 text-left font-medium text-gray-700">指标</th> <th class="px-4 py-3 text-left font-medium text-gray-700">AgentScope</th> <th class="px-4 py-3 text-left font-medium text-gray-700">DyTopo</th> <th class="px-4 py-3 text-left font-medium text-gray-700">优化幅度</th> </tr> </thead> <tbody class="divide-y divide-gray-200"> <tr> <td class="px-4 py-3 font-medium">HumanEval准确率</td> <td class="px-4 py-3">90.24%</td> <td class="px-4 py-3 font-semibold text-blue-600">92.07%</td> <td class="px-4 py-3 text-green-600">+1.83pp</td> </tr> <tr class="bg-gray-50"> <td class="px-4 py-3 font-medium">Token消耗</td> <td class="px-4 py-3">19,520</td> <td class="px-4 py-3 font-semibold text-blue-600">9,453</td> <td class="px-4 py-3 text-green-600 font-bold">-51.6%</td> </tr> <tr> <td class="px-4 py-3 font-medium">延迟(秒)</td> <td class="px-4 py-3">39.8</td> <td class="px-4 py-3 font-semibold text-blue-600">22.3</td> <td class="px-4 py-3 text-green-600 font-bold">-44.0%</td> </tr> <tr class="bg-gray-50"> <td class="px-4 py-3 font-medium">平均轮次</td> <td class="px-4 py-3">5(固定)</td> <td class="px-4 py-3 font-semibold text-blue-600">2.6</td> <td class="px-4 py-3 text-green-600 font-bold">-48.0%</td> </tr> </tbody> </table> </div> <p class="text-sm text-gray-600 mt-4"> <a href="https://arxiv.org/pdf/2602.06039" class="citation" target="_blank"> <i class="fas fa-external-link-alt mr-1"></i>数据来源:DyTopo论文对比实验 </a> </p> </div> </section> <!-- Applications --> <section id="applications" class="mb-16"> <h2 class="font-display text-3xl font-bold mb-8 text-gray-800">应用场景与深远影响</h2> <h3 class="font-display text-2xl font-semibold mb-6">即时效能提升领域</h3> <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8"> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <h4 class="font-semibold text-lg mb-4 text-blue-600"> <i class="fas fa-code mr-2"></i>代码生成突破 </h4> <img src="https://kimi-web-img.moonshot.cn/img/cdn-yunyin.modao.cc/9823165fb7916249803b2c333e034e2b8700ca7b.jpg" alt="AI代码生成工作流程示意图" class="w-full rounded-lg mb-4" size="medium" aspect="wide" style="clipart" query="AI代码生成工作流程" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> <p class="text-gray-700 mb-4"> <strong>HumanEval基准:</strong>Llama3-8B-Instruct达到<span class="data-point">89.63%</span>的Pass@1准确率,较基线<span class="data-point">80.49%</span>提升9.14个百分点。 </p> <ul class="space-y-2 text-sm text-gray-600"> <li>• 阶段自适应的协作结构</li> <li>• 需求分析、算法设计、编码实现的动态匹配</li> <li>• 调试阶段的开发者-测试者反馈环路</li> </ul> </div> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <h4 class="font-semibold text-lg mb-4 text-green-600"> <i class="fas fa-calculator mr-2"></i>数学推理跃升 </h4> <img src="https://kimi-web-img.moonshot.cn/img/pica.zhimg.com/d7d0e6af6b9e04c58a5222265528141a8549d70e.jpg" alt="数学公式推导的抽象表示" class="w-full rounded-lg mb-4" size="medium" aspect="wide" color="blue" style="linedrawing" query="数学推理抽象图" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> <p class="text-gray-700 mb-4"> <strong>MATH-500基准:</strong>Qwen3-8B从<span class="data-point">48.57%</span>跃升至<span class="data-point">75.71%</span>,相对提升<span class="data-point">55.9%</span>。 </p> <ul class="space-y-2 text-sm text-gray-600"> <li>• 探索-验证-修正的循环结构</li> <li>• 多样化解法路径的并行探索</li> <li>• 严格的形式化验证聚焦</li> </ul> </div> </div> <h3 class="font-display text-2xl font-semibold mb-6">未来AI协作模式的重塑</h3> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4">从&#34;单体智能&#34;到&#34;群体智能&#34;的生态系统演进</h4> <p class="text-gray-700 mb-4"> DyTopo预示着AI系统形态的深层变革:从追求单一超级模型的&#34;单体智能&#34;,转向协作专业化模型的&#34;群体智能&#34;。这一演进类似于生物进化从单细胞到多细胞、从独立个体到社会性群体的转变。 </p> <div class="grid grid-cols-1 md:grid-cols-3 gap-4"> <div class="bg-blue-50 p-4 rounded-lg"> <h5 class="font-semibold text-blue-800 mb-2">角色分化</h5> <p class="text-sm text-blue-700">不同模型针对特定能力优化,形成专业化分工</p> </div> <div class="bg-green-50 p-4 rounded-lg"> <h5 class="font-semibold text-green-800 mb-2">动态组合</h5> <p class="text-sm text-green-700">根据任务需求即时组建最优专家团队</p> </div> <div class="bg-purple-50 p-4 rounded-lg"> <h5 class="font-semibold text-purple-800 mb-2">涌现能力</h5> <p class="text-sm text-purple-700">系统整体表现超越最佳个体的能力边界</p> </div> </div> </div> <h3 class="font-display text-2xl font-semibold mb-6">人类组织架构的反向启示</h3> <div class="highlight-box mb-8"> <h4 class="font-semibold text-lg mb-3">&#34;轻量级交易集市&#34;式组织文化</h4> <p>DyTopo的架构隐喻可扩展为一种组织文化愿景:成员作为自主的&#34;认知企业家&#34;,通过持续发布和响应&#34;能力-需求&#34;信号参与组织协作,而非被动接受层级指令。这种文化的核心特征包括自我声明的责任制、声誉驱动的匹配优先级,以及即时反馈的激励结构。</p> </div> </section> <!-- Computational Democracy --> <section id="computational-democracy" class="mb-16"> <h2 class="font-display text-3xl font-bold mb-8 text-gray-800">算力平权:小模型的逆袭路径与风险警示</h2> <h3 class="font-display text-2xl font-semibold mb-6">系统组织力的降本增效机制</h3> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4">开源小模型的可及性优势</h4> <img src="https://kimi-web-img.moonshot.cn/img/help-static-aliyun-doc.aliyuncs.com/0bca1a60ec117fd570a963d857c1262067f6d334.png" alt="小型AI模型在本地设备上运行的示意图" class="w-full rounded-lg mb-4" size="medium" aspect="wide" style="photo" query="小型AI模型本地部署" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> <div> <h5 class="font-semibold mb-3">硬件门槛</h5> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>8B参数模型:</strong>单张RTX 4090(24GB显存)可全精度部署</li> <li>• <strong>量化支持:</strong>INT4/INT8在更低配置设备上运行</li> <li>• <strong>边缘部署:</strong>适合本地化、隐私优先场景</li> </ul> </div> <div> <h5 class="font-semibold mb-3">成本结构</h5> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>Token节约:</strong>40-60%的通信token削减</li> <li>• <strong>延迟优化:</strong>35-50%的单轮延迟降低</li> <li>• <strong>吞吐量提升:</strong>30%的系统级吞吐改善</li> </ul> </div> </div> <p class="text-sm text-gray-600 mt-4"> <a href="https://github.com/Intradyne/AnyLoom-AnythingLLM-Local-AI-agentic-DyTopo-swarm" class="citation" target="_blank"> <i class="fas fa-external-link-alt mr-1"></i>开源实现:AnyLoom项目 </a> </p> </div> <h3 class="font-display text-2xl font-semibold mb-6">&#34;算力平权&#34;的技术民主化意义</h3> <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8"> <div class="bg-gradient-to-br from-blue-50 to-blue-100 rounded-xl p-6 border border-blue-200"> <h4 class="font-semibold text-lg mb-4 text-blue-800"> <i class="fas fa-unlock mr-2"></i>打破算力垄断 </h4> <p class="text-blue-700 text-sm mb-3"> 通过架构创新而非规模扩张实现性能提升,为小规模参与者提供技术可能性。 </p> <div class="text-xs text-blue-600"> <strong>关键条件:</strong>开源生态成熟度 + 算法创新产出 + 社区协作效能 </div> </div> <div class="bg-gradient-to-br from-green-50 to-green-100 rounded-xl p-6 border border-green-200"> <h4 class="font-semibold text-lg mb-4 text-green-800"> <i class="fas fa-microchip mr-2"></i>边缘计算机遇 </h4> <p class="text-green-700 text-sm mb-3"> 小模型+精巧架构特别适合边缘计算场景,支持本地化、隐私保护的AI部署。 </p> <div class="text-xs text-green-600"> <strong>应用场景:</strong>企业敏感文档、工业现场决策、个人隐私助手 </div> </div> <div class="bg-gradient-to-br from-purple-50 to-purple-100 rounded-xl p-6 border border-purple-200"> <h4 class="font-semibold text-lg mb-4 text-purple-800"> <i class="fas fa-lightbulb mr-2"></i>创新空间拓展 </h4> <p class="text-purple-700 text-sm mb-3"> 创新从资源密集型方向向应用创新、领域适配、交互设计等维度扩散。 </p> <div class="text-xs text-purple-600"> <strong>创新方向:</strong>教育导师系统、创意写作网络、虚拟研究实验室 </div> </div> </div> <h3 class="font-display text-2xl font-semibold mb-6">隐患危机:AI幻觉与&#34;毒药数据&#34;风险</h3> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4 text-red-600">动态网络中的错误传播放大效应</h4> <img src="https://kimi-web-img.moonshot.cn/img/www.forwardpathway.com/70dffb005df8edc210a4cd9b970325d1c2c62694.jpg" alt="错误传播网络效应示意图" class="w-full rounded-lg mb-4" size="medium" aspect="wide" query="错误传播网络效应" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/> <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> <div> <h5 class="font-semibold mb-3 text-red-700">错误传播机制</h5> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>级联反应:</strong>单个幻觉通过通信网络扩散</li> <li>• <strong>深度影响:</strong>精准匹配加剧错误传播</li> <li>• <strong>包装效应:</strong>错误经过多轮迭代被&#34;包装&#34;</li> <li>• <strong>追溯困难:</strong>根源识别极为复杂</li> </ul> </div> <div> <h5 class="font-semibold mb-3 text-red-700">对抗性攻击向量</h5> <ul class="space-y-2 text-sm text-gray-700"> <li>• <strong>描述符投毒:</strong>构造恶意Key描述符吸引匹配</li> <li>• <strong>语义混淆:</strong>冒充合法代理身份</li> <li>• <strong>结构操控:</strong>诱导有利于错误传播的拓扑</li> <li>• <strong>合法性伪装:</strong>利用系统自主决策机制</li> </ul> </div> </div> </div> <!-- Risk and Governance Table --> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4">治理机制设计:自稳定与自我纠正</h4> <div class="overflow-x-auto"> <table class="w-full text-sm"> <thead class="bg-gray-50"> <tr> <th class="px-4 py-3 text-left font-medium text-gray-700">机制</th> <th class="px-4 py-3 text-left font-medium text-gray-700">功能</th> <th class="px-4 py-3 text-left font-medium text-gray-700">触发条件</th> <th class="px-4 py-3 text-left font-medium text-gray-700">响应动作</th> </tr> </thead> <tbody class="divide-y divide-gray-200"> <tr> <td class="px-4 py-3 font-medium">收敛检测</td> <td class="px-4 py-3">识别系统进入稳定状态</td> <td class="px-4 py-3">拓扑变化率低于阈值</td> <td class="px-4 py-3">触发管理器终止评估</td> </tr> <tr class="bg-gray-50"> <td class="px-4 py-3 font-medium">停滞检测</td> <td class="px-4 py-3">识别协作过程异常中断</td> <td class="px-4 py-3">任务完成度无改善</td> <td class="px-4 py-3">注入扰动或任务重分解</td> </tr> <tr> <td class="px-4 py-3 font-medium">重新委派</td> <td class="px-4 py-3">动态调整代理角色分配</td> <td class="px-4 py-3">能力需求持续无法满足</td> <td class="px-4 py-3">激活备用代理或调整角色</td> </tr> </tbody> </table> </div> <p class="text-sm text-gray-600 mt-4"> <a href="https://arxiv.org/html/2602.06039v1" class="citation" target="_blank"> <i class="fas fa-external-link-alt mr-1"></i>治理机制来源:DyTopo论文第5.3节 </a> </p> </div> </section> <!-- Conclusion --> <section id="conclusion" class="mb-16"> <h2 class="font-display text-3xl font-bold mb-8 text-gray-800">结论与前瞻</h2> <div class="bg-white rounded-xl p-8 shadow-lg border border-gray-200 mb-8"> <h3 class="font-display text-2xl font-semibold mb-6 text-center">DyTopo的核心贡献总结</h3> <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6"> <div class="text-center"> <div class="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4"> <i class="fas fa-cogs text-2xl text-blue-600"></i> </div> <h4 class="font-semibold text-lg mb-2">技术层面</h4> <p class="text-sm text-gray-600">动态拓扑路由完整框架,五阶段算法流程,384维语义匹配机制</p> </div> <div class="text-center"> <div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4"> <i class="fas fa-chart-line text-2xl text-green-600"></i> </div> <h4 class="font-semibold text-lg mb-2">经济层面</h4> <p class="text-sm text-gray-600">算力平权可行路径,8B模型挑战120B巨头,成本削减40-60%</p> </div> <div class="text-center"> <div class="w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4"> <i class="fas fa-lightbulb text-2xl text-purple-600"></i> </div> <h4 class="font-semibold text-lg mb-2">概念层面</h4> <p class="text-sm text-gray-600">挑战Scaling Law教条,系统架构作为独立优化维度的价值认知</p> </div> </div> </div> <h3 class="font-display text-2xl font-semibold mb-6">动态拓扑路由技术的演进方向</h3> <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8"> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <h4 class="font-semibold text-lg mb-4">近期发展重点</h4> <ul class="space-y-3 text-sm text-gray-700"> <li class="flex items-start"> <i class="fas fa-arrow-right text-blue-500 mr-2 mt-1"></i> <span><strong>嵌入空间增强:</strong>领域自适应、多模态、层次化语义表示</span> </li> <li class="flex items-start"> <i class="fas fa-arrow-right text-blue-500 mr-2 mt-1"></i> <span><strong>拓扑演化学习化:</strong>强化学习预测最优结构,减少探索成本</span> </li> <li class="flex items-start"> <i class="fas fa-arrow-right text-blue-500 mr-2 mt-1"></i> <span><strong>跨设备扩展:</strong>边缘-云混合架构,网络延迟感知路由</span> </li> </ul> </div> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200"> <h4 class="font-semibold text-lg mb-4">研究前沿方向</h4> <ul class="space-y-3 text-sm text-gray-700"> <li class="flex items-start"> <i class="fas fa-arrow-right text-green-500 mr-2 mt-1"></i> <span><strong>自我改进系统:</strong>优化协作结构本身作为学习目标</span> </li> <li class="flex items-start"> <i class="fas fa-arrow-right text-green-500 mr-2 mt-1"></i> <span><strong>人机混合拓扑:</strong>人类作为特殊代理嵌入框架</span> </li> <li class="flex items-start"> <i class="fas fa-arrow-right text-green-500 mr-2 mt-1"></i> <span><strong>社会智能涌现:</strong>意见动态、集体决策的计算模型</span> </li> </ul> </div> </div> <!-- Final Mermaid Diagram --> <div class="bg-white rounded-xl p-6 shadow-lg border border-gray-200 mb-8"> <h4 class="font-semibold text-lg mb-4">DyTopo技术生态全景图</h4> <div class="mermaid-container"> <div class="mermaid-controls"> <button class="mermaid-control-btn zoom-in" title="放大"> <i class="fas fa-search-plus"></i> </button> <button class="mermaid-control-btn zoom-out" title="缩小"> <i class="fas fa-search-minus"></i> </button> <button class="mermaid-control-btn reset-zoom" title="重置"> <i class="fas fa-expand-arrows-alt"></i> </button> <button class="mermaid-control-btn fullscreen" title="全屏查看"> <i class="fas fa-expand"></i> </button> </div> <div class="mermaid"> graph TB subgraph &#34;技术核心&#34; A1[&#34;动态拓扑路由 <br/>Dynamic Topology Routing&#34;] A2[&#34;384维语义匹配 <br/>Semantic Matching&#34;] A3[&#34;死锁打破算法 <br/>Cycle-breaking Heuristic&#34;] end subgraph &#34;应用场景&#34; B1[&#34;代码生成 <br/>Code Generation&#34;] B2[&#34;数学推理 <br/>Mathematical Reasoning&#34;] B3[&#34;复杂问题求解 <br/>Complex Problem Solving&#34;] end subgraph &#34;社会影响&#34; C1[&#34;算力平权 <br/>Compute Democracy&#34;] C2[&#34;组织启示 <br/>Organizational Insights&#34;] C3[&#34;协作模式重塑 <br/>Collaboration Paradigm Shift&#34;] end subgraph &#34;风险与治理&#34; D1[&#34;错误传播风险 <br/>Error Propagation&#34;] D2[&#34;对抗性攻击 <br/>Adversarial Attacks&#34;] D3[&#34;自稳定机制 <br/>Self-stabilization&#34;] end subgraph &#34;未来发展&#34; E1[&#34;嵌入空间增强 <br/>Embedding Enhancement&#34;] E2[&#34;拓扑演化学习 <br/>Topology Learning&#34;] E3[&#34;人机混合智能 <br/>Human-AI Hybrid&#34;] end A1 --&gt; B1 A1 --&gt; B2 A1 --&gt; B3 A2 --&gt; A1 A3 --&gt; A1 B1 --&gt; C1 B2 --&gt; C2 B3 --&gt; C3 C1 --&gt; D1 C2 --&gt; D2 C3 --&gt; D3 D1 --&gt; E1 D2 --&gt; E2 D3 --&gt; E3 style A1 fill:#dbeafe,stroke:#2563eb,stroke-width:3px,color:#1e40af,font-weight:700 style A2 fill:#fef3c7,stroke:#f59e0b,stroke-width:3px,color:#92400e,font-weight:700 style A3 fill:#dcfce7,stroke:#16a34a,stroke-width:3px,color:#166534,font-weight:700 style B1 fill:#f0f9ff,stroke:#0ea5e9,stroke-width:2px,color:#0c4a6e,font-weight:600 style B2 fill:#f0f9ff,stroke:#0ea5e9,stroke-width:2px,color:#0c4a6e,font-weight:600 style B3 fill:#f0f9ff,stroke:#0ea5e9,stroke-width:2px,color:#0c4a6e,font-weight:600 style C1 fill:#f8fafc,stroke:#64748b,stroke-width:2px,color:#374151,font-weight:600 style C2 fill:#f8fafc,stroke:#64748b,stroke-width:2px,color:#374151,font-weight:600 style C3 fill:#f8fafc,stroke:#64748b,stroke-width:2px,color:#374151,font-weight:600 style D1 fill:#fef2f2,stroke:#ef4444,stroke-width:2px,color:#991b1b,font-weight:600 style D2 fill:#fef2f2,stroke:#ef4444,stroke-width:2px,color:#991b1b,font-weight:600 style D3 fill:#f0fdf4,stroke:#22c55e,stroke-width:2px,color:#166534,font-weight:600 style E1 fill:#fdf4ff,stroke:#a855f7,stroke-width:2px,color:#7c2d12,font-weight:600 style E2 fill:#fdf4ff,stroke:#a855f7,stroke-width:2px,color:#7c2d12,font-weight:600 style E3 fill:#fdf4ff,stroke:#a855f7,stroke-width:2px,color:#7c2d12,font-weight:600 </div> </div> <p class="text-gray-600 text-sm mt-4"> DyTopo从技术创新的一个分支,正在成长为连接工程实践、科学认知和社会设计的跨学科领域 </p> </div> <div class="highlight-box"> <h4 class="font-semibold text-lg mb-3">最终思考</h4> <p class="text-lg"> DyTopo的成功不仅仅是一项技术突破,更是对AI发展范式的一次深刻反思。它提醒我们,在追求更大模型的同时,不应忽视架构创新的力量。在算力资源日益集中的今天,DyTopo为算力民主化开辟了一条可行路径,让小型参与者也能在AI时代找到自己的位置。这种&#34;系统组织力&#34;的范式,或许正是未来智能系统发展的关键所在。 </p> </div> </section> </div> <script> // Initialize Mermaid mermaid.initialize({ startOnLoad: true, theme: 'base', themeVariables: { primaryColor: '#ffffff', primaryTextColor: '#1f2937', primaryBorderColor: '#d1d5db', lineColor: '#6b7280', secondaryColor: '#f8fafc', tertiaryColor: '#f1f5f9', background: '#ffffff', mainBkg: '#ffffff', secondBkg: '#f8fafc', tertiaryBkg: '#f1f5f9', fontFamily: 'Inter, sans-serif', fontSize: '14px', // Enhanced contrast settings nodeBorder: '#374151', clusterBkg: '#f9fafb', clusterBorder: '#d1d5db', defaultLinkColor: '#4b5563', titleColor: '#111827', edgeLabelBackground: '#ffffff', nodeTextColor: '#111827' }, flowchart: { useMaxWidth: false, htmlLabels: true, curve: 'basis', padding: 20 }, sequence: { useMaxWidth: false, wrap: true, width: 200, height: 65, boxMargin: 10, boxTextMargin: 5, noteMargin: 10, messageMargin: 35 }, gantt: { useMaxWidth: false, leftPadding: 75, rightPadding: 20, topPadding: 50, bottomPadding: 50, gridLineStartPadding: 35, fontSize: 11, sectionFontSize: 24, numberSectionStyles: 4 } }); // Initialize Mermaid Controls for zoom and pan function initializeMermaidControls() { const containers = document.querySelectorAll('.mermaid-container'); containers.forEach(container => { const mermaidElement = container.querySelector('.mermaid'); let scale = 1; let isDragging = false; let startX, startY, translateX = 0, translateY = 0; // 触摸相关状态 let isTouch = false; let touchStartTime = 0; let initialDistance = 0; let initialScale = 1; let isPinching = false; // Zoom controls const zoomInBtn = container.querySelector('.zoom-in'); const zoomOutBtn = container.querySelector('.zoom-out'); const resetBtn = container.querySelector('.reset-zoom'); const fullscreenBtn = container.querySelector('.fullscreen'); function updateTransform() { mermaidElement.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`; if (scale > 1) { container.classList.add('zoomed'); } else { container.classList.remove('zoomed'); } mermaidElement.style.cursor = isDragging ? 'grabbing' : 'grab'; } if (zoomInBtn) { zoomInBtn.addEventListener('click', () => { scale = Math.min(scale * 1.25, 4); updateTransform(); }); } if (zoomOutBtn) { zoomOutBtn.addEventListener('click', () => { scale = Math.max(scale / 1.25, 0.3); if (scale <= 1) { translateX = 0; translateY = 0; } updateTransform(); }); } if (resetBtn) { resetBtn.addEventListener('click', () => { scale = 1; translateX = 0; translateY = 0; updateTransform(); }); } if (fullscreenBtn) { fullscreenBtn.addEventListener('click', () => { if (container.requestFullscreen) { container.requestFullscreen(); } else if (container.webkitRequestFullscreen) { container.webkitRequestFullscreen(); } else if (container.msRequestFullscreen) { container.msRequestFullscreen(); } }); } // Mouse Events mermaidElement.addEventListener('mousedown', (e) => { if (isTouch) return; // 如果是触摸设备,忽略鼠标事件 isDragging = true; startX = e.clientX - translateX; startY = e.clientY - translateY; mermaidElement.style.cursor = 'grabbing'; updateTransform(); e.preventDefault(); }); document.addEventListener('mousemove', (e) => { if (isDragging && !isTouch) { translateX = e.clientX - startX; translateY = e.clientY - startY; updateTransform(); } }); document.addEventListener('mouseup', () => { if (isDragging && !isTouch) { isDragging = false; mermaidElement.style.cursor = 'grab'; updateTransform(); } }); document.addEventListener('mouseleave', () => { if (isDragging && !isTouch) { isDragging = false; mermaidElement.style.cursor = 'grab'; updateTransform(); } }); // 获取两点之间的距离 function getTouchDistance(touch1, touch2) { return Math.hypot( touch2.clientX - touch1.clientX, touch2.clientY - touch1.clientY ); } // Touch Events - 触摸事件处理 mermaidElement.addEventListener('touchstart', (e) => { isTouch = true; touchStartTime = Date.now(); if (e.touches.length === 1) { // 单指拖动 isPinching = false; isDragging = true; const touch = e.touches[0]; startX = touch.clientX - translateX; startY = touch.clientY - translateY; } else if (e.touches.length === 2) { // 双指缩放 isPinching = true; isDragging = false; const touch1 = e.touches[0]; const touch2 = e.touches[1]; initialDistance = getTouchDistance(touch1, touch2); initialScale = scale; } e.preventDefault(); }, { passive: false }); mermaidElement.addEventListener('touchmove', (e) => { if (e.touches.length === 1 && isDragging && !isPinching) { // 单指拖动 const touch = e.touches[0]; translateX = touch.clientX - startX; translateY = touch.clientY - startY; updateTransform(); } else if (e.touches.length === 2 && isPinching) { // 双指缩放 const touch1 = e.touches[0]; const touch2 = e.touches[1]; const currentDistance = getTouchDistance(touch1, touch2); if (initialDistance > 0) { const newScale = Math.min(Math.max( initialScale * (currentDistance / initialDistance), 0.3 ), 4); scale = newScale; updateTransform(); } } e.preventDefault(); }, { passive: false }); mermaidElement.addEventListener('touchend', (e) => { // 重置状态 if (e.touches.length === 0) { isDragging = false; isPinching = false; initialDistance = 0; // 延迟重置isTouch,避免鼠标事件立即触发 setTimeout(() => { isTouch = false; }, 100); } else if (e.touches.length === 1 && isPinching) { // 从双指变为单指,切换为拖动模式 isPinching = false; isDragging = true; const touch = e.touches[0]; startX = touch.clientX - translateX; startY = touch.clientY - translateY; } updateTransform(); }); mermaidElement.addEventListener('touchcancel', (e) => { isDragging = false; isPinching = false; initialDistance = 0; setTimeout(() => { isTouch = false; }, 100); updateTransform(); }); // Enhanced wheel zoom with better center point handling container.addEventListener('wheel', (e) => { e.preventDefault(); const rect = container.getBoundingClientRect(); const centerX = rect.width / 2; const centerY = rect.height / 2; const delta = e.deltaY > 0 ? 0.9 : 1.1; const newScale = Math.min(Math.max(scale * delta, 0.3), 4); // Adjust translation to zoom towards center if (newScale !== scale) { const scaleDiff = newScale / scale; translateX = translateX * scaleDiff; translateY = translateY * scaleDiff; scale = newScale; if (scale <= 1) { translateX = 0; translateY = 0; } updateTransform(); } }); // Initialize display updateTransform(); }); } // Call the function to initialize the controls document.addEventListener('DOMContentLoaded', function() { initializeMermaidControls(); }); // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); // Highlight current section in TOC window.addEventListener('scroll', function() { const sections = document.querySelectorAll('section[id]'); const navLinks = document.querySelectorAll('.toc-fixed a[href^="#"]'); let current = ''; sections.forEach(section => { const sectionTop = section.offsetTop; const sectionHeight = section.clientHeight; if (pageYOffset >= sectionTop - 200) { current = section.getAttribute('id'); } }); navLinks.forEach(link => { link.classList.remove('font-semibold', 'text-blue-600'); if (link.getAttribute('href') === '#' + current) { link.classList.add('font-semibold', 'text-blue-600'); } }); }); </script> </body></html>

讨论回复

0 条回复

还没有人回复,快来发表你的看法吧!