diff --git a/CHANGELOG.md b/CHANGELOG.md index 027fe752b..f9b3b8267 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ ## [Unreleased] +### 线性注意力机制精读与通俗拆解入库:新开 model-architecture 分组(250,2026-10-30) + +- 新增 [250 精读](docs/research/model-architecture/250-linear-attention-kda.md)(腾讯技术工程《AI Infra进阶:3万字深入理解线性注意力机制》2026-10-29 全文 + Kimi Linear/GDN/DeltaNet 并行化/vLLM 文档/FWP 等 10 个一手信源逐条对账,Devil 论文 ID 勘误 2209.07482→2210.10340):KV Cache 三重代价 → 门控演进链(每加一个门治一种病:β 治叠账、标量 α 治不淡出、对角 α 治同速遗忘)→ chunk-wise 两级并行(块间仿射 scan + 块内 WY 下三角一次解出)→ hybrid 3:1 兜底与 vLLM v0.32.0 落地三件事(page 对齐 640/前缀缓存块边界/推测解码回退一块);五规律三争议,字数门 6000 内(5993)。 +- 新开 `docs/research/model-architecture/` 分组(_category_.json position 11);配套纯标准库原型 [linear_attention_lab.py](docs/research/model-architecture/assets/linear_attention_lab.py)(17 断言全绿:KDA/DeltaNet/GDN 顺序 vs chunk-wise 最大偏差 4.4e-16;D1–D5 破坏实验实测退化);两张 archify 图四件套入库(`kda--evolution-ladder` workflow、`kda--chunkwise-two-level` dataflow,finalize 四门回执齐)。 +- 登记面:research readme 第十一节、knowledge-map Research 节、mermaid README model-architecture 分节、issue I-242。 + ### Automating ML for Science(Agent4Sci)精读与通俗拆解入库(agent-harness 181,2026-10-29) - 新增 [181 精读](docs/research/agent-harness/181-agent4sci-scientific-hills.md):arXiv:2610.28763v1 首读(2026-10-20,Anthropic Fellows Program,arXiv perpetual non-exclusive)——20 个已发表科学 ML 基准的长时程爬坡测试台:裸仓库试点 12 任务 5 作弊(四类)催生「标准化+三阶段协议」(封存测试集/独立评测/轨迹审计,120 对三家族审计全一致);四前沿 agent 全基准全自动改进(Opus +10.4%)但增益以通用工程招式为主(run 方差分层 σ=1.5 vs 19.6、HPO-only 只回收小部分);三缺陷三技能近翻倍(10.4→20.1,PFDelta 64.4→91.0 物理洞见);三天长跑反例(洞见门控不随时间来、CarbonGlobe 过拟 −25%);五规律三争议五批判边界。 diff --git a/docs/.agents/issue.md b/docs/.agents/issue.md index a244dcfc1..98ea5de61 100644 --- a/docs/.agents/issue.md +++ b/docs/.agents/issue.md @@ -247,6 +247,7 @@ | I-239 | agent-harness 178 DSA 精读入库:三源首读(repo@4e622643 + 站点 + 论文)+ 五机制原型 + 双 archify 图 + 信源原图 5 张(含交付后增补 4 张批次) | ✅ 已完成 | 2026-10-27 | [详情](#I-239) | | I-240 | Dependabot 54 条批量处置:backend 11 包收敛升级(mcp 上界防 2.x)+ katex 0.18 override(rehype-katex 卡 ^0.16)+ fast-uri 全仓 override(根 + 15 分集)+ perceives 七包防 CI 红头 + dismiss 2 条有据告警 | ✅ 已完成 | 2026-10-28 | [详情](#I-240) | | I-241 | agent-harness 181 Agent4Sci 精读入库:信源 URL 伪报核验 + 四原图管线 + 首个「评测协议型」精读 | ✅ 已完成 | 2026-10-29 | [详情](#I-241) | +| I-242 | model-architecture 250 线性注意力精读入库:微信 3 万字长文 + 10 信源对账 + KDA/DeltaNet/GDN 原型(顺序 vs 分块 4.4e-16)+ 双 archify 图 + 新开分组 | ✅ 已完成 | 2026-10-30 | [详情](#I-242) | --- @@ -5736,3 +5737,20 @@ R7 后浏览器对照 Section 2.1 区域发现两类正交缺陷: - **后续防范**:arXiv 类信源入库前一律先核官方 citation 元数据(标题/作者/版本)再采信全文抓取结果;对账摘录一律以快照字节级片段为准,不从记忆复写。 - **同类问题影响**:所有经 MCP 抓取通道的论文精读(guided-learn 各篇);机器对账门禁在快照含宏残留时的 bash/awk 命中判定。 - **注意事项**:webReader 通道不可作为唯一事实源;降采样只改分辨率不改内容,登记表须注明处理方式。 + + +## I-242:model-architecture 250 线性注意力精读入库(新开分组) + +**问题描述**:腾讯技术工程《AI Infra进阶:3万字深入理解线性注意力机制》(2026-10-29)需精读入库:机制密度高(公式 190+ 条内嵌图片 alt、21 配图为懒加载 blob 不可取)、仓库无任何线性注意力既有笔记(需新开分组)、字数门 6000 硬约束。 + +**表因**:微信公式以图片内嵌且配图不可下载,公式保真与图例保留两难;vLLM/模型表细节全部出自单信源转述,有失真风险。 + +**根因**:公众号载体把公式当图片、把配图挂懒加载 blob,文本通道天然残缺;产业现状类论断(模型配比/引擎行为)只有厂商一手可核。 + +**处理方式**:① 公式走「curl 原始 HTML → awk 转写时内嵌 img alt」通道,182 条 LaTeX 完整复原,KaTeX 重排 14 条 display 入正文;② 关键机制改自绘 archify 两图(演进阶梯 workflow + chunk-wise dataflow,finalize 四门全过);③ Workflow 并行派 6 路信源 reader 通读/锚点级对账(Kimi Linear/GDN/DeltaNet/vLLM/FWP/经典组),勘误 Devil 论文 ID(2209.07482→2210.10340)并钉死 hybrid 实为 3:1 配比;④ 纯标准库原型 17 断言(KDA/DeltaNet/GDN 顺序 vs chunk-wise 最大偏差 4.4e-16)+ D1–D5 破坏实验;⑤ 新开 docs/research/model-architecture/ 分组(250 起编号),登记面四处 + CHANGELOG。 + +**后续防范**:公众号类信源一律先 curl 原始 HTML 提 img alt 再谈公式保真;reader 回传的 sha256 必须实测复核(本次 3/6 被截断重建);「配比」类数字以一手论文核对后才可入正文。 + +**同类问题影响**:后续公众号/图片型公式信源精读(对照 014/181 的 source-figures 管线,本篇是「公式不可取型」的新形态);archify dataflow 节点上下同列叠放时反馈边几何不可行——砍边改 tag+卡片承载语义(K₂,₂ 判例复用)。 + +**注意事项**:250 是 model-architecture 分组首篇;lab 字数门沿用 179 的 count_words(上限 6000)。 diff --git a/docs/.agents/knowledge-map.md b/docs/.agents/knowledge-map.md index be0fcdce7..baf05a1d3 100644 --- a/docs/.agents/knowledge-map.md +++ b/docs/.agents/knowledge-map.md @@ -102,3 +102,4 @@ - [Apple Watch Ultra 4 换货开箱视频项目(influence/live/apple-watch-ultra-4-unboxing)](../../apps/negentropy-influence/live/apple-watch-ultra-4-unboxing/README.md) — **influence 工作区 `live/`(真人实拍项目区)首个项目**(2026-10-10 文字包 v1):借用 vibe-video ①–⑥ 文字阶段契约(取证底账/策划/逐字稿 SSOT/四级校验/成文优化/分镜六列)移植到实拍制片,生产层换为 A 档 iPhone 三机位 + 多日日程(Day0 首拆一次性镜头链 / Day1–4 使用日记 / DayN 收尾);分级归因红线(重启=watchOS 27.0 已知已修、掉线=个案)与两段式 ⟨TBD⟩ 定稿点为其真实性核心机制(v2.3 用户校准:换货为同款零售彩盒、官网 14 天退换期);与 episodes/ 的 Remotion 动画集平级共处、不登记 series.json(实拍片不走 TTS/Remotion/骨架门,check_series 仍扫其死链) - [精读:Harness 到 Harness²(179)](../research/agent-harness/179-harness-to-harness2.md) — Harness-Zero(arXiv:2609.24974v1)× Harness²(arXiv:2610.14224v1)双源首读(互不引用、作者零交集、非换代,互补路线对照轴精讲):P1 agent-as-harness 审阅门(pass/replace 最小改动 + 学生第一人称 + 特权只限读 K)→ SFT 蒸馏进权重、部署卸载(9B 三臂 23.3 < 41.7 < 44.3;监督源消融 K 30 vs oracle 答案 15 vs teacher+h\* 错配 3——采集分≠蒸馏价值;28 模式恢复 82.3%、弱模型审阅反噬 −12.0);P2 八组件文件化 harness + 对比式 Propose–Probe–Compose(只比不判、证据锚定组合)+ 并行/串行递归与带保留门的改进库(下题从 H₀ 重开、库选择性改编;单步最高 +11.5、递归再涨、去库 −3.1、跨模型迁移 GLM-5 Code +17.3、胜生产 harness +4.6~5.8);两篇公式链逐条白话、五条规律(资产位置/对比监督/示范可达性/经验保留门/表达边界)三个争议与批判边界(均无独立复现、LLM judge 噪声未量化、组合未实验);4 张论文原图(CC BY 4.0,TeX 源码包矢量渲染入 source-figures);配套原型 [harness2_lab.py](../research/agent-harness/assets/harness2_lab.py)(纯标准库确定性,五组破坏实验:D1 恒放行恢复率归零 / D3 盲判分增益噪声化 / D5 无库失去跨任务反哺档) - [精读:Automating ML for Science(Agent4Sci)·181](../research/agent-harness/181-agent4sci-scientific-hills.md) — arXiv:2610.28763v1 首读(2026-10-20,Anthropic Fellows Program,arXiv perpetual non-exclusive):20 个已发表科学 ML 基准的长时程爬坡测试台——裸仓库试点 12 任务 5 作弊(选择性汇报/测试集污染/指标操纵/硬编码四类)催生「标准化+三阶段协议」(封存测试集、双容器隔离、独立评测算分、轨迹审计;120 对三家族审计全一致);四前沿 agent 全基准全自动改进(Opus +10.4% 领跑、Sonnet 9.6 却 9/20 基准最佳、Gemini 指令失败不罚口径自述偏高)但增益以通用工程招式为主(词云+频次:Opus 56% 调参 44% 架构;run 方差分层:工程型 σ=1.5、洞见型 σ=19.6;HPO-only 只回收小部分);行为三分(全程迭代/提交等待/摇摆)与三缺陷(新颖性失准/资源闲置/探索塌缩)→ 三张 markdown 插件技能近翻倍(10.4→20.1、4.4→8.1;PFDelta 64.4→91.0=PBL 自监督主损失+GNN 温启动牛顿法;CarbonGlobe 49→<6 GPU 时且推理 ~500×);三天长跑反例:洞见门控不随时间来(Codex PFDelta 2000 −99.5% vs CarbonGlobe 集成过拟测试 −25%);五规律(先封缝再测量/分数看成分表/行为剖面即指纹/对症脚手架杠杆/洞见门控)三争议(LLM 审 LLM 循环性/工程洞见分界/窄工况代表性)五批判边界;配套 [agent4sci_lab.py](../research/agent-harness/assets/agent4sci_lab.py)(15 断言 selftest + E1–E5 破坏实验:去封存作弊 Δ% [0,0,0,0]→[0,+31,0,+31] 等)+ 4 张论文原图(source-figures,降采样不改内容) +- [精读:线性注意力机制(250)](../research/model-architecture/250-linear-attention-kda.md) — 腾讯技术工程《AI Infra进阶:3万字深入理解线性注意力机制》(2026-10-29,微信)全文精读 + 10 个一手信源对账(Kimi Linear arXiv:2510.26692v2/GDN 2412.06464v3/DeltaNet 并行化 2406.06484v6/vLLM v0.32.0 文档/FWP 2102.11174v3 通读,TARR/Devil/GLA/Marconi/ReplaySSM 锚点;Devil 正确 ID 勘误为 2210.10340):KV Cache 三重代价(显存/带宽/计算线性增长)→ 三路线(稀疏 DSA/压缩 MLA/线性)→ 门控演进链(Linear 2020 叠账 → +短卷积去分母 → DeltaNet 写入门 β 先查旧账只写差额 → GDN 标量遗忘门 → KDA 按通道对角遗忘;训练视角统一解释 β=学习率、α=1−ηλ=权重衰减、delta=残差梯度一步)→ chunk-wise 两级并行(块间仿射 scan + 块内 WY 下三角系统,精确重写无近似)→ 固定容量 hybrid 3:1(K3 69 KDA+24 MLA/GLM-5.3-Flash 34 KDA+11 DSA/Qwen3.8 系 GDN 混合)与 vLLM 落地(state 542,720B 对齐 block 640、[9,9,8,8] 分组、前缀缓存块边界 align、EAGLE 无条件回退一块);五规律(代数结构定并行上限/门控=在线学习组件/固定容量必混叠/稳定件伴生/算法形态定显存管理)三争议(遗忘粒度/NoPE vs RoPE/线性状态前缀缓存三路线);配套 linear_attention_lab.py(17 断言:KDA/DeltaNet/GDN 顺序 vs 分块偏差 4.4e-16;D1–D5 破坏实验)与两张 archify 图(kda--evolution-ladder、kda--chunkwise-two-level);字数门 6000(5993) diff --git a/docs/assets/architecture/model-architecture/kda--chunkwise-two-level-dark.png b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level-dark.png new file mode 100644 index 000000000..c95286ca7 Binary files /dev/null and b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level-dark.png differ diff --git a/docs/assets/architecture/model-architecture/kda--chunkwise-two-level-light.png b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level-light.png new file mode 100644 index 000000000..bff316942 Binary files /dev/null and b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level-light.png differ diff --git a/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.browser-check.json b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.browser-check.json new file mode 100644 index 000000000..196f8cbc9 --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.browser-check.json @@ -0,0 +1,697 @@ +{ + "schemaVersion": 1, + "ok": true, + "command": "browser-check", + "evidenceKind": "automated-browser", + "status": "pass", + "visualReview": "not-requested", + "provenance": "current", + "deliveryReceiptId": "80a2dc64-dae9-4640-8a13-042e61c85de4", + "artifact": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "sha256": "acd6433de1d14131e6df8440c81a1043c43243ca53d9cf98dec7991290735bd1", + "bytes": 753986 + }, + "state": { + "detail": "read", + "motion": "still" + }, + "chrome": { + "status": "available", + "executable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" + }, + "diagnostics": [], + "containment": { + "status": "pass", + "policy": "fit-or-reader-declared-readable-vertical-scroll", + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 983, + "diagramWidth": 953, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 68, + "diagramChromePx": 78, + "svgPx": 730, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1027, + "diagramWidth": 997, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 764, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1132, + "diagramWidth": 1102, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 844, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1463, + "diagramWidth": 1413, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 1082, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "themeStates": { + "status": "pass", + "viewports": [ + { + "width": 1440, + "height": 900, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1600, + "height": 1000, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1920, + "height": 1080, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 2048, + "height": 1320, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1440, + "height": 900, + "requestedTheme": "dark", + "resolvedTheme": "dark", + "ok": true + }, + { + "width": 2048, + "height": 1320, + "requestedTheme": "dark", + "resolvedTheme": "dark", + "ok": true + } + ] + }, + "readability": { + "status": "pass", + "minimumProjectedNodeTextPx": 6, + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 983, + "diagramWidth": 953, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 68, + "diagramChromePx": 78, + "svgPx": 730, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1027, + "diagramWidth": 997, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 764, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1132, + "diagramWidth": 1102, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 844, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1463, + "diagramWidth": 1413, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 1082, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "viewerChrome": { + "status": "pass", + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 983, + "diagramWidth": 953, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 68, + "diagramChromePx": 78, + "svgPx": 730, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1027, + "diagramWidth": 997, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 764, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1132, + "diagramWidth": 1102, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 844, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1463, + "diagramWidth": 1413, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 1082, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "captures": { + "status": "not-requested", + "screenshots": [], + "contactSheet": null + }, + "sidecars": { + "receipt": "kda--chunkwise-two-level.browser-check.json", + "files": [] + } +} diff --git a/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.delivery.json b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.delivery.json new file mode 100644 index 000000000..d6737ef76 --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.delivery.json @@ -0,0 +1,17 @@ +{ + "schemaVersion": 1, + "receiptId": "80a2dc64-dae9-4640-8a13-042e61c85de4", + "status": "current", + "command": "deliver", + "type": "dataflow", + "input": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/dataflow-kda--chunkwise-two-level-20261030-150635/candidate.json", + "output": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "specification": { + "sha256": "604726a3dc9041b6b7a7bffc5d28598fd6b39caadc95e9d23322e5fdaa503832", + "bytes": 3481 + }, + "artifact": { + "sha256": "acd6433de1d14131e6df8440c81a1043c43243ca53d9cf98dec7991290735bd1", + "bytes": 753986 + } +} diff --git a/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize-summary.json b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize-summary.json new file mode 100644 index 000000000..efc4190a5 --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize-summary.json @@ -0,0 +1,66 @@ +{ + "schemaVersion": 1, + "ok": true, + "command": "finalize", + "status": "pass", + "type": "dataflow", + "quality": "showcase", + "specification": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/dataflow-kda--chunkwise-two-level-20261030-150635/candidate.json", + "sha256": "604726a3dc9041b6b7a7bffc5d28598fd6b39caadc95e9d23322e5fdaa503832", + "bytes": 3481 + }, + "artifact": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "sha256": "acd6433de1d14131e6df8440c81a1043c43243ca53d9cf98dec7991290735bd1", + "bytes": 753986 + }, + "gates": { + "validate": "pass", + "deliver": "pass", + "check": "pass", + "browser-check": "pass" + }, + "diagnostics": [], + "diagnosticSummary": { + "total": 0, + "shown": 0, + "truncated": false + }, + "evidence": { + "receipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize.json", + "summaryReceipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize-summary.json", + "browserCheckReceipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.browser-check.json" + }, + "visualReview": "not-requested", + "durationMs": 2069, + "visualReviewRecommendation": { + "action": "inspect-route-readability", + "signals": { + "routesOverSuggestedStretch": 1 + }, + "reason": "Automated gates passed, but crossings or detours still need perceptual review before claiming visual quality.", + "affectedRoutes": { + "crossings": [], + "detours": [ + { + "relationship": { + "id": "f4", + "from": "mac", + "to": "sc", + "label": "Transition / Δ", + "collectionIndex": 3, + "artifactIndex": 4 + }, + "bends": 2, + "stretch": 1.38 + } + ], + "truncated": false + }, + "hints": [ + "mac → sc needs 2 bends: move node mac or sc so they share a row or column with matching centers, or sit diagonally with a clear corner." + ], + "repair": "Trace these relationships at the desktop viewport. For Architecture, use references/architecture-layout-repair.md: reflow a blocked main path or tangled connected scene, and repair an isolated defect locally only when the surrounding composition is accepted. Preserve all semantic content and user-fixed geometry. Rerun finalize once after the edit." + } +} diff --git a/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize.json b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize.json new file mode 100644 index 000000000..d326bdbfa --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize.json @@ -0,0 +1,965 @@ +{ + "schemaVersion": 1, + "ok": true, + "command": "finalize", + "status": "pass", + "type": "dataflow", + "quality": "showcase", + "startedAt": "2026-10-30T07:09:42.066Z", + "specification": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/dataflow-kda--chunkwise-two-level-20261030-150635/candidate.json", + "sha256": "604726a3dc9041b6b7a7bffc5d28598fd6b39caadc95e9d23322e5fdaa503832", + "bytes": 3481 + }, + "artifact": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "sha256": "acd6433de1d14131e6df8440c81a1043c43243ca53d9cf98dec7991290735bd1", + "bytes": 753986 + }, + "stages": { + "validate": { + "status": "pass", + "exitCode": 0, + "durationMs": null, + "execution": "embedded-in-deliver", + "command": [ + "/Users/cm.huang/.nvm/versions/node/v24.22.1/bin/node", + "/Users/cm.huang/.agents/skills/archify/bin/archify.mjs", + "deliver", + "dataflow", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/dataflow-kda--chunkwise-two-level-20261030-150635/candidate.json", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "--quality", + "showcase", + "--json" + ], + "receipt": { + "schemaVersion": 1, + "ok": true, + "command": "validate", + "specification": { + "sha256": "604726a3dc9041b6b7a7bffc5d28598fd6b39caadc95e9d23322e5fdaa503832", + "bytes": 3481 + }, + "validation": { + "checksPassed": 9, + "checkCount": 9, + "compositionProfile": "showcase", + "compositionStatus": "pass", + "errors": 0, + "warnings": 0 + } + } + }, + "deliver": { + "status": "pass", + "exitCode": 0, + "durationMs": 347, + "command": [ + "/Users/cm.huang/.nvm/versions/node/v24.22.1/bin/node", + "/Users/cm.huang/.agents/skills/archify/bin/archify.mjs", + "deliver", + "dataflow", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/dataflow-kda--chunkwise-two-level-20261030-150635/candidate.json", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "--quality", + "showcase", + "--json" + ], + "receipt": { + "schemaVersion": 1, + "receiptId": "80a2dc64-dae9-4640-8a13-042e61c85de4", + "ok": true, + "command": "deliver", + "type": "dataflow", + "input": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/dataflow-kda--chunkwise-two-level-20261030-150635/candidate.json", + "output": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "specification": { + "sha256": "604726a3dc9041b6b7a7bffc5d28598fd6b39caadc95e9d23322e5fdaa503832", + "bytes": 3481 + }, + "artifact": { + "sha256": "acd6433de1d14131e6df8440c81a1043c43243ca53d9cf98dec7991290735bd1", + "bytes": 753986 + }, + "validation": { + "checksPassed": 9, + "checkCount": 9, + "compositionProfile": "showcase", + "compositionStatus": "pass", + "errors": 0, + "warnings": 0 + } + } + }, + "check": { + "status": "pass", + "exitCode": 0, + "durationMs": 97, + "command": [ + "/Users/cm.huang/.nvm/versions/node/v24.22.1/bin/node", + "/Users/cm.huang/.agents/skills/archify/bin/archify.mjs", + "check", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "--require-provenance" + ], + "receipt": { + "ok": true, + "file": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "artifact": { + "sha256": "acd6433de1d14131e6df8440c81a1043c43243ca53d9cf98dec7991290735bd1", + "bytes": 753986 + }, + "checks": [ + { + "name": "single_svg", + "ok": true, + "details": [ + "found 1 block(s)" + ] + }, + { + "name": "finite_svg", + "ok": true, + "details": [] + }, + { + "name": "orthogonal_arrows", + "ok": true, + "details": [] + }, + { + "name": "label_route_clearance", + "ok": true, + "details": [] + }, + { + "name": "relationship_crossings", + "ok": true, + "details": [] + }, + { + "name": "relationship_corridors", + "ok": true, + "details": [] + }, + { + "name": "container_border_runs", + "ok": true, + "details": [] + }, + { + "name": "route_rhythm", + "ok": true, + "details": [] + }, + { + "name": "legend_clearance", + "ok": true, + "details": [] + } + ], + "composition": { + "schemaVersion": 1, + "profile": "showcase", + "status": "pass", + "summary": { + "errors": 0, + "warnings": 0 + }, + "metrics": { + "properCrossings": 0, + "resolvedCrossovers": 0, + "ambiguousCorridors": 0, + "arrowheadCollisions": 0, + "containerBorderRuns": 0, + "labelRouteClearanceIssues": 0, + "labelCanvasOverflowIssues": 0, + "minLabelRouteClearance": 33, + "desktopReadabilityIssues": 0, + "viewportHeightIssues": 0, + "minProjectedNodeTextPx": 6.925531914893617, + "maxBends": 2, + "routesOverSuggestedBends": 0, + "maxStretch": 1.38, + "routesOverSuggestedStretch": 1, + "minSegmentPx": 32, + "minInteriorSegmentPx": 107, + "shortSegmentCount": 0, + "shortEndpointSegmentCount": 0, + "shortInteriorSegmentCount": 0, + "microSegmentCount": 0 + }, + "suggestedLimits": { + "bendsPerRelationship": 2, + "stretch": 1.35, + "segmentPx": 16, + "microSegmentPx": 8 + }, + "routeReview": { + "crossings": [], + "detours": [ + { + "relationship": { + "id": "f4", + "from": "mac", + "to": "sc", + "label": "Transition / Δ", + "collectionIndex": 3, + "artifactIndex": 4 + }, + "bends": 2, + "stretch": 1.38 + } + ] + }, + "leadingSpace": { + "measured": false, + "reviewSuggested": false + }, + "desktopReadability": { + "budgetBasis": "legacy-930", + "readerContract": "declared-wide-v1", + "availableDiagramWidth": 930, + "actualBudgetPx": 930, + "limit": "legacy", + "requestedTargetPx": null, + "requestedTargetMet": null, + "hardFloorPx": 6, + "hardFloorMet": true, + "minimumOwner": { + "kind": "node", + "id": "tk" + }, + "minimumSourceTextPx": 7, + "minimumProjectedTextPx": 6.925531914893617, + "semanticTextCount": 18 + }, + "issues": [] + }, + "provenance": "current", + "deliveryReceiptId": "80a2dc64-dae9-4640-8a13-042e61c85de4" + } + }, + "browser-check": { + "status": "pass", + "exitCode": 0, + "durationMs": 1167, + "command": [ + "/Users/cm.huang/.nvm/versions/node/v24.22.1/bin/node", + "/Users/cm.huang/.agents/skills/archify/bin/archify.mjs", + "browser-check", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "--json", + "--require-provenance" + ], + "execution": "in-process", + "receipt": { + "schemaVersion": 1, + "ok": true, + "command": "browser-check", + "evidenceKind": "automated-browser", + "status": "pass", + "visualReview": "not-requested", + "provenance": "current", + "deliveryReceiptId": "80a2dc64-dae9-4640-8a13-042e61c85de4", + "artifact": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html", + "sha256": "acd6433de1d14131e6df8440c81a1043c43243ca53d9cf98dec7991290735bd1", + "bytes": 753986 + }, + "state": { + "detail": "read", + "motion": "still" + }, + "chrome": { + "status": "available", + "executable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" + }, + "diagnostics": [], + "containment": { + "status": "pass", + "policy": "fit-or-reader-declared-readable-vertical-scroll", + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 983, + "diagramWidth": 953, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 68, + "diagramChromePx": 78, + "svgPx": 730, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1027, + "diagramWidth": 997, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 764, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1132, + "diagramWidth": 1102, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 844, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1463, + "diagramWidth": 1413, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 1082, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "themeStates": { + "status": "pass", + "viewports": [ + { + "width": 1440, + "height": 900, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1600, + "height": 1000, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1920, + "height": 1080, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 2048, + "height": 1320, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1440, + "height": 900, + "requestedTheme": "dark", + "resolvedTheme": "dark", + "ok": true + }, + { + "width": 2048, + "height": 1320, + "requestedTheme": "dark", + "resolvedTheme": "dark", + "ok": true + } + ] + }, + "readability": { + "status": "pass", + "minimumProjectedNodeTextPx": 6, + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 983, + "diagramWidth": 953, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 68, + "diagramChromePx": 78, + "svgPx": 730, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1027, + "diagramWidth": 997, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 764, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1132, + "diagramWidth": 1102, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 844, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1463, + "diagramWidth": 1413, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 1082, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "viewerChrome": { + "status": "pass", + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 983, + "diagramWidth": 953, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 68, + "diagramChromePx": 78, + "svgPx": 730, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1027, + "diagramWidth": 997, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 764, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1132, + "diagramWidth": 1102, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 76, + "diagramChromePx": 84, + "svgPx": 844, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": "intrinsic-height", + "ok": true, + "readerWidth": 1463, + "diagramWidth": 1413, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 1082, + "cardsPx": 0, + "viewBoxHeight": 720 + }, + "viewBoxWidth": 940, + "minimumProjectedNodeTextPx": 7, + "minimumProjectedNonEdgeTextPx": 7, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "每块的 k, v, α, β", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "tk" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "captures": { + "status": "not-requested", + "screenshots": [], + "contactSheet": null + }, + "sidecars": { + "receipt": "kda--chunkwise-two-level.browser-check.json", + "files": [] + } + } + } + }, + "diagnostics": [], + "evidence": { + "receipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize.json", + "summaryReceipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.finalize-summary.json", + "browserCheckReceipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.browser-check.json" + }, + "visualReview": "not-requested", + "finishedAt": "2026-10-30T07:09:44.135Z", + "durationMs": 2069 +} diff --git a/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html new file mode 100644 index 000000000..cbea1d2ad --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html @@ -0,0 +1,13711 @@ + + + + + + + + chunk-wise 两级并行:块间仿射 scan 与块内 WY 汇于同一份块末状态 + + + + + + + + +
+ +
+
+
+

chunk-wise 两级并行:块间仿射 scan 与块内 WY 汇于同一份块末状态

+
+
+ + + + +
+ + chunk-wise 两级并行:块间仿射 scan 与块内 WY 汇于同一份块末状态 + 由 Archify 生成的数据流图。 + + + + + + + + + + + + + + + + + + + + + + + + + 01 / 输入 · 按块切开 + + + 02 / 两级并行准备(各块同时) + + + 03 / 汇合 + + + 04 / 产出 + + + + + + + + + + + + Token 流切成 64 一块 · 每块的 k, v, α, β · 01 / 输入 · 按块切开 · 块内已知 + + + + Token 流切成 64 一块 + 每块的 k, v, α, β + 块内已知 + + + + 块间 · 宏观并行 · 各块独立算 Transition / Δ · 02 / 两级并行准备(各块同时) · 仿射可组合 + + + + 块间 · 宏观并行 + 各块独立算 Transition / Δ + 仿射可组合 + + + + 块内 · 微观并行 · 解下三角系统 (I+A)X=B · 02 / 两级并行准备(各块同时) · WY 表示 + + + + 块内 · 微观并行 + 解下三角系统 (I+A)X=B + WY 表示 + + + + 实际写入差额 E · E = U − W·S₀ᵀ · 03 / 汇合 · 旧状态只在此进入 + + + + 实际写入差额 E + E = U − W·S₀ᵀ + 旧状态只在此进入 + + + + 块末状态 S_C · S₀·Transition + Δ · 04 / 产出 · 传给下一块 · 唯一串行 + + + + 块末状态 S_C + S₀·Transition + Δ + 传给下一块 · 唯一串行 + + + + 块内输出 O · Q̂_in·S₀ᵀ + M·E · 04 / 产出 · 全部 token + + + + 块内输出 O + Q̂_in·S₀ᵀ + M·E + 全部 token + + + + + + 本块系数 + + + + 因果折扣 A, B + + + + U, W + + + + Transition / Δ + + + + M·E 块内因果读出 + + + + 参与块末合成 + + + + + 图例 + + + 主要数据 + + + + 数据存储 + + + + 数据流 + + + +

+ + + + + + + + + +
+ + + +
+ + + + diff --git a/docs/assets/architecture/model-architecture/kda--evolution-ladder-dark.png b/docs/assets/architecture/model-architecture/kda--evolution-ladder-dark.png new file mode 100644 index 000000000..4b8409374 Binary files /dev/null and b/docs/assets/architecture/model-architecture/kda--evolution-ladder-dark.png differ diff --git a/docs/assets/architecture/model-architecture/kda--evolution-ladder-light.png b/docs/assets/architecture/model-architecture/kda--evolution-ladder-light.png new file mode 100644 index 000000000..48acd5db4 Binary files /dev/null and b/docs/assets/architecture/model-architecture/kda--evolution-ladder-light.png differ diff --git a/docs/assets/architecture/model-architecture/kda--evolution-ladder.browser-check.json b/docs/assets/architecture/model-architecture/kda--evolution-ladder.browser-check.json new file mode 100644 index 000000000..a3b95ab14 --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--evolution-ladder.browser-check.json @@ -0,0 +1,1177 @@ +{ + "schemaVersion": 1, + "ok": true, + "command": "browser-check", + "evidenceKind": "automated-browser", + "status": "pass", + "visualReview": "not-requested", + "provenance": "current", + "deliveryReceiptId": "385c9b48-27ac-4eb3-967d-b807c714ce0f", + "artifact": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "sha256": "f01e89e0dc50ae2ae56388ef8014632fad1d1725943bbe82208a68f473fa4093", + "bytes": 757775 + }, + "state": { + "detail": "read", + "motion": "still" + }, + "chrome": { + "status": "available", + "executable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" + }, + "diagnostics": [], + "containment": { + "status": "pass", + "policy": "fit-or-reader-declared-readable-vertical-scroll", + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1376, + "diagramWidth": 1346, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 52, + "diagramChromePx": 78, + "svgPx": 580, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 115, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 74, + "spaceAboveNodesPx": 37, + "spaceBelowNodesPx": 4 + }, + { + "frameId": "lane-1", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + }, + { + "frameId": "lane-2", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1536, + "diagramWidth": 1506, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 649, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 129, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 83, + "spaceAboveNodesPx": 41, + "spaceBelowNodesPx": 5 + }, + { + "frameId": "lane-1", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + }, + { + "frameId": "lane-2", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1856, + "diagramWidth": 1826, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 787, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 156, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 100, + "spaceAboveNodesPx": 50, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1920, + "diagramWidth": 1870, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 806, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 160, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 103, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "themeStates": { + "status": "pass", + "viewports": [ + { + "width": 1440, + "height": 900, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1600, + "height": 1000, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1920, + "height": 1080, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 2048, + "height": 1320, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1440, + "height": 900, + "requestedTheme": "dark", + "resolvedTheme": "dark", + "ok": true + }, + { + "width": 2048, + "height": 1320, + "requestedTheme": "dark", + "resolvedTheme": "dark", + "ok": true + } + ] + }, + "readability": { + "status": "pass", + "minimumProjectedNodeTextPx": 6, + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1376, + "diagramWidth": 1346, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 52, + "diagramChromePx": 78, + "svgPx": 580, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 115, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 74, + "spaceAboveNodesPx": 37, + "spaceBelowNodesPx": 4 + }, + { + "frameId": "lane-1", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + }, + { + "frameId": "lane-2", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1536, + "diagramWidth": 1506, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 649, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 129, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 83, + "spaceAboveNodesPx": 41, + "spaceBelowNodesPx": 5 + }, + { + "frameId": "lane-1", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + }, + { + "frameId": "lane-2", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1856, + "diagramWidth": 1826, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 787, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 156, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 100, + "spaceAboveNodesPx": 50, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1920, + "diagramWidth": 1870, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 806, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 160, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 103, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "viewerChrome": { + "status": "pass", + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1376, + "diagramWidth": 1346, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 52, + "diagramChromePx": 78, + "svgPx": 580, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 115, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 74, + "spaceAboveNodesPx": 37, + "spaceBelowNodesPx": 4 + }, + { + "frameId": "lane-1", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + }, + { + "frameId": "lane-2", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1536, + "diagramWidth": 1506, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 649, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 129, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 83, + "spaceAboveNodesPx": 41, + "spaceBelowNodesPx": 5 + }, + { + "frameId": "lane-1", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + }, + { + "frameId": "lane-2", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1856, + "diagramWidth": 1826, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 787, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 156, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 100, + "spaceAboveNodesPx": 50, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1920, + "diagramWidth": 1870, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 806, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 160, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 103, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "captures": { + "status": "not-requested", + "screenshots": [], + "contactSheet": null + }, + "sidecars": { + "receipt": "kda--evolution-ladder.browser-check.json", + "files": [] + } +} diff --git a/docs/assets/architecture/model-architecture/kda--evolution-ladder.delivery.json b/docs/assets/architecture/model-architecture/kda--evolution-ladder.delivery.json new file mode 100644 index 000000000..2cf114179 --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--evolution-ladder.delivery.json @@ -0,0 +1,17 @@ +{ + "schemaVersion": 1, + "receiptId": "385c9b48-27ac-4eb3-967d-b807c714ce0f", + "status": "current", + "command": "deliver", + "type": "workflow", + "input": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/workflow-kda--evolution-ladder-20261030-150635/candidate.json", + "output": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "specification": { + "sha256": "30fcbe7bc582764f4c9338d8af7fe696c26768ec3de0347e9ddf50aa7cfdc808", + "bytes": 4373 + }, + "artifact": { + "sha256": "f01e89e0dc50ae2ae56388ef8014632fad1d1725943bbe82208a68f473fa4093", + "bytes": 757775 + } +} diff --git a/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize-summary.json b/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize-summary.json new file mode 100644 index 000000000..81bf84bb7 --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize-summary.json @@ -0,0 +1,37 @@ +{ + "schemaVersion": 1, + "ok": true, + "command": "finalize", + "status": "pass", + "type": "workflow", + "quality": "showcase", + "specification": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/workflow-kda--evolution-ladder-20261030-150635/candidate.json", + "sha256": "30fcbe7bc582764f4c9338d8af7fe696c26768ec3de0347e9ddf50aa7cfdc808", + "bytes": 4373 + }, + "artifact": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "sha256": "f01e89e0dc50ae2ae56388ef8014632fad1d1725943bbe82208a68f473fa4093", + "bytes": 757775 + }, + "gates": { + "validate": "pass", + "deliver": "pass", + "check": "pass", + "browser-check": "pass" + }, + "diagnostics": [], + "diagnosticSummary": { + "total": 0, + "shown": 0, + "truncated": false + }, + "evidence": { + "receipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize.json", + "summaryReceipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize-summary.json", + "browserCheckReceipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.browser-check.json" + }, + "visualReview": "not-requested", + "durationMs": 1991 +} diff --git a/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize.json b/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize.json new file mode 100644 index 000000000..e6a636055 --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize.json @@ -0,0 +1,1432 @@ +{ + "schemaVersion": 1, + "ok": true, + "command": "finalize", + "status": "pass", + "type": "workflow", + "quality": "showcase", + "startedAt": "2026-10-30T07:07:50.752Z", + "specification": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/workflow-kda--evolution-ladder-20261030-150635/candidate.json", + "sha256": "30fcbe7bc582764f4c9338d8af7fe696c26768ec3de0347e9ddf50aa7cfdc808", + "bytes": 4373 + }, + "artifact": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "sha256": "f01e89e0dc50ae2ae56388ef8014632fad1d1725943bbe82208a68f473fa4093", + "bytes": 757775 + }, + "stages": { + "validate": { + "status": "pass", + "exitCode": 0, + "durationMs": null, + "execution": "embedded-in-deliver", + "command": [ + "/Users/cm.huang/.nvm/versions/node/v24.22.1/bin/node", + "/Users/cm.huang/.agents/skills/archify/bin/archify.mjs", + "deliver", + "workflow", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/workflow-kda--evolution-ladder-20261030-150635/candidate.json", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "--quality", + "showcase", + "--json" + ], + "receipt": { + "schemaVersion": 1, + "ok": true, + "command": "validate", + "specification": { + "sha256": "30fcbe7bc582764f4c9338d8af7fe696c26768ec3de0347e9ddf50aa7cfdc808", + "bytes": 4373 + }, + "validation": { + "checksPassed": 9, + "checkCount": 9, + "compositionProfile": "showcase", + "compositionStatus": "pass", + "errors": 0, + "warnings": 0 + } + } + }, + "deliver": { + "status": "pass", + "exitCode": 0, + "durationMs": 399, + "command": [ + "/Users/cm.huang/.nvm/versions/node/v24.22.1/bin/node", + "/Users/cm.huang/.agents/skills/archify/bin/archify.mjs", + "deliver", + "workflow", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/workflow-kda--evolution-ladder-20261030-150635/candidate.json", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "--quality", + "showcase", + "--json" + ], + "receipt": { + "schemaVersion": 1, + "receiptId": "385c9b48-27ac-4eb3-967d-b807c714ce0f", + "ok": true, + "command": "deliver", + "type": "workflow", + "input": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/.archify/workflow-kda--evolution-ladder-20261030-150635/candidate.json", + "output": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "specification": { + "sha256": "30fcbe7bc582764f4c9338d8af7fe696c26768ec3de0347e9ddf50aa7cfdc808", + "bytes": 4373 + }, + "artifact": { + "sha256": "f01e89e0dc50ae2ae56388ef8014632fad1d1725943bbe82208a68f473fa4093", + "bytes": 757775 + }, + "validation": { + "checksPassed": 9, + "checkCount": 9, + "compositionProfile": "showcase", + "compositionStatus": "pass", + "errors": 0, + "warnings": 0 + } + } + }, + "check": { + "status": "pass", + "exitCode": 0, + "durationMs": 94, + "command": [ + "/Users/cm.huang/.nvm/versions/node/v24.22.1/bin/node", + "/Users/cm.huang/.agents/skills/archify/bin/archify.mjs", + "check", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "--require-provenance" + ], + "receipt": { + "ok": true, + "file": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "artifact": { + "sha256": "f01e89e0dc50ae2ae56388ef8014632fad1d1725943bbe82208a68f473fa4093", + "bytes": 757775 + }, + "checks": [ + { + "name": "single_svg", + "ok": true, + "details": [ + "found 1 block(s)" + ] + }, + { + "name": "finite_svg", + "ok": true, + "details": [] + }, + { + "name": "orthogonal_arrows", + "ok": true, + "details": [] + }, + { + "name": "label_route_clearance", + "ok": true, + "details": [] + }, + { + "name": "relationship_crossings", + "ok": true, + "details": [] + }, + { + "name": "relationship_corridors", + "ok": true, + "details": [] + }, + { + "name": "container_border_runs", + "ok": true, + "details": [] + }, + { + "name": "route_rhythm", + "ok": true, + "details": [] + }, + { + "name": "legend_clearance", + "ok": true, + "details": [] + } + ], + "composition": { + "schemaVersion": 1, + "profile": "showcase", + "status": "pass", + "summary": { + "errors": 0, + "warnings": 0 + }, + "metrics": { + "properCrossings": 0, + "resolvedCrossovers": 0, + "ambiguousCorridors": 0, + "arrowheadCollisions": 0, + "containerBorderRuns": 0, + "labelRouteClearanceIssues": 0, + "labelCanvasOverflowIssues": 0, + "minLabelRouteClearance": 79.7, + "desktopReadabilityIssues": 0, + "viewportHeightIssues": 0, + "minProjectedNodeTextPx": 6.004842615012106, + "maxBends": 1, + "routesOverSuggestedBends": 0, + "maxStretch": 1, + "routesOverSuggestedStretch": 0, + "minSegmentPx": 51.6, + "minInteriorSegmentPx": null, + "shortSegmentCount": 0, + "shortEndpointSegmentCount": 0, + "shortInteriorSegmentCount": 0, + "microSegmentCount": 0 + }, + "suggestedLimits": { + "bendsPerRelationship": 2, + "stretch": 1.35, + "segmentPx": 16, + "microSegmentPx": 8 + }, + "routeReview": { + "crossings": [], + "detours": [] + }, + "leadingSpace": { + "measured": false, + "reviewSuggested": false + }, + "desktopReadability": { + "budgetBasis": "legacy-930", + "readerContract": "declared-wide-v1", + "availableDiagramWidth": 930, + "actualBudgetPx": 930, + "limit": "legacy", + "requestedTargetPx": null, + "requestedTargetMet": null, + "hardFloorPx": 6, + "hardFloorMet": true, + "minimumOwner": { + "kind": "node", + "id": "sm" + }, + "minimumSourceTextPx": 8, + "minimumProjectedTextPx": 6.004842615012106, + "semanticTextCount": 23 + }, + "issues": [] + }, + "provenance": "current", + "deliveryReceiptId": "385c9b48-27ac-4eb3-967d-b807c714ce0f" + } + }, + "browser-check": { + "status": "pass", + "exitCode": 0, + "durationMs": 1035, + "command": [ + "/Users/cm.huang/.nvm/versions/node/v24.22.1/bin/node", + "/Users/cm.huang/.agents/skills/archify/bin/archify.mjs", + "browser-check", + "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "--json", + "--require-provenance" + ], + "execution": "in-process", + "receipt": { + "schemaVersion": 1, + "ok": true, + "command": "browser-check", + "evidenceKind": "automated-browser", + "status": "pass", + "visualReview": "not-requested", + "provenance": "current", + "deliveryReceiptId": "385c9b48-27ac-4eb3-967d-b807c714ce0f", + "artifact": { + "path": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.html", + "sha256": "f01e89e0dc50ae2ae56388ef8014632fad1d1725943bbe82208a68f473fa4093", + "bytes": 757775 + }, + "state": { + "detail": "read", + "motion": "still" + }, + "chrome": { + "status": "available", + "executable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" + }, + "diagnostics": [], + "containment": { + "status": "pass", + "policy": "fit-or-reader-declared-readable-vertical-scroll", + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1376, + "diagramWidth": 1346, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 52, + "diagramChromePx": 78, + "svgPx": 580, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 115, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 74, + "spaceAboveNodesPx": 37, + "spaceBelowNodesPx": 4 + }, + { + "frameId": "lane-1", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + }, + { + "frameId": "lane-2", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1536, + "diagramWidth": 1506, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 649, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 129, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 83, + "spaceAboveNodesPx": 41, + "spaceBelowNodesPx": 5 + }, + { + "frameId": "lane-1", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + }, + { + "frameId": "lane-2", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1856, + "diagramWidth": 1826, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 787, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 156, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 100, + "spaceAboveNodesPx": 50, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1920, + "diagramWidth": 1870, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 806, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 160, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 103, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "themeStates": { + "status": "pass", + "viewports": [ + { + "width": 1440, + "height": 900, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1600, + "height": 1000, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1920, + "height": 1080, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 2048, + "height": 1320, + "requestedTheme": "light", + "resolvedTheme": "light", + "ok": true + }, + { + "width": 1440, + "height": 900, + "requestedTheme": "dark", + "resolvedTheme": "dark", + "ok": true + }, + { + "width": 2048, + "height": 1320, + "requestedTheme": "dark", + "resolvedTheme": "dark", + "ok": true + } + ] + }, + "readability": { + "status": "pass", + "minimumProjectedNodeTextPx": 6, + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1376, + "diagramWidth": 1346, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 52, + "diagramChromePx": 78, + "svgPx": 580, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 115, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 74, + "spaceAboveNodesPx": 37, + "spaceBelowNodesPx": 4 + }, + { + "frameId": "lane-1", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + }, + { + "frameId": "lane-2", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1536, + "diagramWidth": 1506, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 649, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 129, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 83, + "spaceAboveNodesPx": 41, + "spaceBelowNodesPx": 5 + }, + { + "frameId": "lane-1", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + }, + { + "frameId": "lane-2", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1856, + "diagramWidth": 1826, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 787, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 156, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 100, + "spaceAboveNodesPx": 50, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1920, + "diagramWidth": 1870, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 806, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 160, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 103, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "viewerChrome": { + "status": "pass", + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light", + "innerWidth": 1440, + "innerHeight": 900, + "scrollWidth": 1440, + "scrollHeight": 900, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1376, + "diagramWidth": 1346, + "pageComposition": { + "bodyPaddingPx": 12, + "headerPx": 52, + "diagramChromePx": 78, + "svgPx": 580, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 115, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 74, + "spaceAboveNodesPx": 37, + "spaceBelowNodesPx": 4 + }, + { + "frameId": "lane-1", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + }, + { + "frameId": "lane-2", + "heightPx": 115, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 56, + "spaceAboveNodesPx": 46, + "spaceBelowNodesPx": 13 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1600, + "height": 1000, + "theme": "light", + "innerWidth": 1600, + "innerHeight": 1000, + "scrollWidth": 1600, + "scrollHeight": 1000, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1536, + "diagramWidth": 1506, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 649, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 129, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 83, + "spaceAboveNodesPx": 41, + "spaceBelowNodesPx": 5 + }, + { + "frameId": "lane-1", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + }, + { + "frameId": "lane-2", + "heightPx": 129, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 63, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 15 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 1920, + "height": 1080, + "theme": "light", + "innerWidth": 1920, + "innerHeight": 1080, + "scrollWidth": 1920, + "scrollHeight": 1080, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1856, + "diagramWidth": 1826, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 60, + "diagramChromePx": 84, + "svgPx": 787, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 156, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 100, + "spaceAboveNodesPx": 50, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 156, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 77, + "spaceAboveNodesPx": 62, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 54, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + }, + { + "width": 2048, + "height": 1320, + "theme": "light", + "innerWidth": 2048, + "innerHeight": 1320, + "scrollWidth": 2048, + "scrollHeight": 1320, + "overflowX": false, + "overflowY": false, + "verticalScrollAccepted": false, + "overflowDisposition": "contained", + "readerLayout": "adaptive", + "readerOverflow": null, + "readerFit": null, + "ok": true, + "readerWidth": 1920, + "diagramWidth": 1870, + "pageComposition": { + "bodyPaddingPx": 64, + "headerPx": 68, + "diagramChromePx": 94, + "svgPx": 806, + "cardsPx": 0, + "viewBoxHeight": 534 + }, + "viewBoxWidth": 1239, + "workflowLanes": [ + { + "frameId": "lane-0", + "heightPx": 160, + "nodeCount": 6, + "nodeIds": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodeSpanPx": 103, + "spaceAboveNodesPx": 51, + "spaceBelowNodesPx": 6 + }, + { + "frameId": "lane-1", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "rwkv" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + }, + { + "frameId": "lane-2", + "heightPx": 160, + "nodeCount": 1, + "nodeIds": [ + "hyb" + ], + "nodeSpanPx": 78, + "spaceAboveNodesPx": 63, + "spaceBelowNodesPx": 18 + } + ], + "minimumProjectedNodeTextPx": 8, + "minimumProjectedNonEdgeTextPx": 8, + "minimumProjectedEdgeTextPx": 8, + "minimumProjectedNodeText": "精确但全量留底", + "minimumProjectedNodeTextDetail": "context", + "minimumProjectedNodeTextOwner": { + "kind": "node", + "id": "sm" + }, + "minimumRequiredNodeTextPx": 6, + "readabilityOk": true, + "hasLegend": true, + "hasNavigationDock": true, + "legendDockIntersectionArea": 0, + "dockStageIntersectionArea": 0, + "dockStageGap": 10, + "requiredDockStageGap": 10, + "viewerChromeStageOk": true, + "viewerChromeReserve": 44, + "viewerChromeActive": true, + "viewerChromeOk": true, + "resolvedTheme": "light" + } + ] + }, + "captures": { + "status": "not-requested", + "screenshots": [], + "contactSheet": null + }, + "sidecars": { + "receipt": "kda--evolution-ladder.browser-check.json", + "files": [] + } + } + } + }, + "diagnostics": [], + "evidence": { + "receipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize.json", + "summaryReceipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.finalize-summary.json", + "browserCheckReceipt": "/Users/cm.huang/conductor/workspaces/negentropy/almaty-v3/docs/assets/architecture/model-architecture/kda--evolution-ladder.browser-check.json" + }, + "visualReview": "not-requested", + "finishedAt": "2026-10-30T07:07:52.743Z", + "durationMs": 1991 +} diff --git a/docs/assets/architecture/model-architecture/kda--evolution-ladder.html b/docs/assets/architecture/model-architecture/kda--evolution-ladder.html new file mode 100644 index 000000000..22e5148c8 --- /dev/null +++ b/docs/assets/architecture/model-architecture/kda--evolution-ladder.html @@ -0,0 +1,13755 @@ + + + + + + + + 线性注意力门控演进阶梯:每加一个门,治一种病 + + + + + + + + +
+ +
+
+
+

线性注意力门控演进阶梯:每加一个门,治一种病

+
+
+ + + + +
+ + 线性注意力门控演进阶梯:每加一个门,治一种病 + 由 Archify 生成的工作流图。 + + + + + + + + + + + + + + + + + + + + + + + + + 01 / 演进主线 + + + 02 / 平行路线 + + + 03 / 产业收敛 + + + + + 去 softmax 化(2020–2022) + + + 门控化(2021–2025) + + + + + + + + + + + + + + + + Softmax 注意力 · 精确但全量留底 · 演进主线 › 去 softmax 化(2020–2022) + + + + Softmax 注意力 + 精确但全量留底 + + + + 线性注意力 2020 · S←S+vkᵀ · 推理 O(1) · 演进主线 › 去 softmax 化(2020–2022) + + + + 线性注意力 2020 + S←S+vkᵀ · 推理 O(1) + + + + +短卷积 2022 · 去分母 · 补局部 · 演进主线 › 去 softmax 化(2020–2022) + + + + +短卷积 2022 + 去分母 · 补局部 + + + + DeltaNet · 写入门 β · 只写差额 · 演进主线 › 门控化(2021–2025) + + + + DeltaNet + 写入门 β · 只写差额 + + + + GDN 2024 · 标量遗忘门 α · 演进主线 › 门控化(2021–2025) + + + + GDN 2024 + 标量遗忘门 α + + + + KDA 2025 · 按通道遗忘 α · 演进主线 › 门控化(2021–2025) · 本文主角 + + + + KDA 2025 + 按通道遗忘 α + 本文主角 + + + + RWKV 平行路线 · 通道衰减 + 累加写入 · 平行路线 › 去 softmax 化(2020–2022) + + + + RWKV 平行路线 + 通道衰减 + 累加写入 + + + + Hybrid 收敛 · 每 4 层 3 线性 + 1 完整 · 产业收敛 › 门控化(2021–2025) + + + + Hybrid 收敛 + 每 4 层 3 线性 + 1 完整 + + + + + + 去掉 softmax 分母 + + + + 补稳定性与局部 + + + + +写入门 β + + + + +标量 α + + + + α 升维通道级 + + + + 固定容量兜底 + + + + 平行演进 + + + + + 图例 + + + Agent 逻辑 + + + + 上下文 / 追踪 + + + + 云服务 + + + + 外部系统 + + + +

+ + + + + + + + + +
+ + + +
+ + + + diff --git a/docs/assets/mermaid/README.md b/docs/assets/mermaid/README.md index 19b96bd26..de882b04d 100644 --- a/docs/assets/mermaid/README.md +++ b/docs/assets/mermaid/README.md @@ -12,7 +12,7 @@ > `docs/research/agent-harness/` 的五层 Harness 精读、并发独立重学(176)、AI Native 手册精读(180)与 Hermes Agent 精读(190,下表 `agent-harness/` 分节)、 > `docs/research/self-evolution/` 的 Dream-RSI 精读(下表 `self-evolution/` 分节)、 > `docs/research/agent-infra/` 的 Agent Skills 规范精读(230)与 Jev(System One 决策模型)精读(下表 `agent-infra/` 分节)、 -> `docs/research/multimodal-models/` 的 KTP 精读(240,下表 `multimodal-models/` 分节)。未纳入:其余 `docs/research/`(第三方调研)与 +> `docs/research/multimodal-models/` 的 KTP 精读(240,下表 `multimodal-models/` 分节)、`docs/research/model-architecture/` 的线性注意力精读(250,下表 `model-architecture/` 分节)。未纳入:其余 `docs/research/`(第三方调研)与 > `docs/reference/cognizes/`(已退役遗产),**不在此管线**,原地保留渲染。 ## 约定 @@ -337,6 +337,8 @@ | :--- | :--- | :--- | :--- | :--- | :--- | | [ktp--intervention-ladder](./multimodal-models/ktp--intervention-ladder.mmd) | [240 §2](../../research/multimodal-models/240-visual-generation-knowledge-transfer.md) | workflow | ✓ | done | 干预阶梯:画图出口落差 → 直接迁移 / 文本对齐 / 交错对齐 / 先画再读四级三模型均值 + 遮掉图像损失消融支线;candidate JSON 入 `docs/diagrams/ktp--intervention-ladder/` | | [ktp--protocol](./multimodal-models/ktp--protocol.mmd) | [240 §5](../../research/multimodal-models/240-visual-generation-knowledge-transfer.md) | workflow | ✓ | done | 训练与评测协议:数据构造 → 对齐集 / 测试集同一次训练 → 只在测试集算分(文字问答 + 重画);虚线标「跨实体迁移?」;candidate JSON 入 `docs/diagrams/ktp--protocol/` | +| [kda--evolution-ladder](./model-architecture/kda--evolution-ladder.mmd) | [250 §3](../../research/model-architecture/250-linear-attention-kda.md) | workflow | ✓ | done | 门控演进阶梯:Softmax→线性注意力→+短卷积→DeltaNet→GDN→KDA 五档(每档加一个门治一种病)+ RWKV 平行路线 + Hybrid 产业收敛分支;三卡:粒度天花板/训练视角/2026 产业配比;candidate JSON 入 `docs/diagrams/kda--evolution-ladder/` | +| [kda--chunkwise-two-level](./model-architecture/kda--chunkwise-two-level.mmd) | [250 §4](../../research/model-architecture/250-linear-attention-kda.md) | dataflow | ✓ | done | chunk-wise 两级并行数据流:Token 切块 → 块间宏观(Transition/Δ 各块独立)与块内微观(WY 解下三角得 U/W)两路 → 汇合 E=U−WS₀ᵀ → 产出块末状态 S_C 与全部输出 O;两卡:两级分工/重写精确性;candidate JSON 入 `docs/diagrams/kda--chunkwise-two-level/` | ### 原地保留(无 archify 对应类型 / 不在本管线) diff --git a/docs/assets/mermaid/model-architecture/kda--chunkwise-two-level.mmd b/docs/assets/mermaid/model-architecture/kda--chunkwise-two-level.mmd new file mode 100644 index 000000000..473212304 --- /dev/null +++ b/docs/assets/mermaid/model-architecture/kda--chunkwise-two-level.mmd @@ -0,0 +1,19 @@ +%%source: docs/research/model-architecture/250-linear-attention-kda.md §4(信源:腾讯技术工程《AI Infra进阶》+ arXiv:2406.06484 Eq.10-11 / 2412.06464) +%%slug: model-architecture/kda--chunkwise-two-level +%%type: dataflow +%%derived: archify dataflow v1(chunk-wise 两级并行:块间仿射 scan 各块独立算 Transition/Δ、块内 WY 下三角一次解出 U/W,汇合成 E 后产出块末状态 S_C 与全部 token 输出 O;S_C 顺序传下一块是唯一串行环节) +flowchart LR + TK["Token 流按块切开
每块 64 个 k,v,α,β"] + MAC["块间·宏观并行
各块独立算 Transition/Δ"] + MIC["块内·微观并行
解下三角系统 (I+A)X=B"] + E["实际写入差额 E = U − W·S₀ᵀ"] + SC["块末状态 S_C = S₀·Transition + Δ"] + OUT["块内输出 O = Q̂_in·S₀ᵀ + M·E"] + TK -->|"本块系数"| MAC + TK -->|"因果折扣 A,B"| MIC + MIC -->|"U,W"| E + MAC -->|"Transition/Δ"| SC + MAC -->|"衰减查询"| OUT + E -->|"M·E 块内因果"| OUT + E -->|"参与块末合成"| SC + SC -.->|"作为下一块 S₀(唯一顺序环节)"| E diff --git a/docs/assets/mermaid/model-architecture/kda--evolution-ladder.mmd b/docs/assets/mermaid/model-architecture/kda--evolution-ladder.mmd new file mode 100644 index 000000000..679dad3fa --- /dev/null +++ b/docs/assets/mermaid/model-architecture/kda--evolution-ladder.mmd @@ -0,0 +1,16 @@ +%%source: docs/research/model-architecture/250-linear-attention-kda.md §2–§3(信源:腾讯技术工程《AI Infra进阶》+ arXiv:2510.26692/2412.06464/2406.06484/2102.11174) +%%slug: model-architecture/kda--evolution-ladder +%%type: workflow +%%derived: archify workflow v2(五档门控演进:线性注意力→+短卷积→DeltaNet→GDN→KDA,每档加一个门治一种病;RWKV 平行路线与 hybrid 产业收敛分支) +flowchart LR + SM["Softmax 注意力
精确但按 token 全量留底"] + LA["线性注意力 2020
S ← S + vkᵀ · 推理 O(1)"] + CV["+短卷积 2022
去分母·输出归一化·局部混合"] + DN["DeltaNet
写入门 β·先查旧账只写差额"] + GDN["GDN 2024
标量遗忘门 α(每头一个)"] + KDA["KDA 2025
按通道遗忘 α(每列一个)"] + HYB["Hybrid 产业收敛
每 4 层 3 线性 + 1 完整注意力"] + RWKV["RWKV 平行路线
通道衰减 + 累加写入"] + SM -->|"去掉 softmax 分母"| LA -->|"补局部细节与稳定性"| CV -->|"+写入门 β"| DN -->|"+标量 α"| GDN -->|"α 升维到通道级"| KDA + KDA -->|"固定容量兜底"| HYB + LA -.->|"平行演进"| RWKV diff --git a/docs/diagrams/kda--chunkwise-two-level/kda--chunkwise-two-level.json b/docs/diagrams/kda--chunkwise-two-level/kda--chunkwise-two-level.json new file mode 100644 index 000000000..88d04e619 --- /dev/null +++ b/docs/diagrams/kda--chunkwise-two-level/kda--chunkwise-two-level.json @@ -0,0 +1,155 @@ +{ + "schema_version": 1, + "diagram_type": "dataflow", + "meta": { + "title": "chunk-wise 两级并行:块间仿射 scan 与块内 WY 汇于同一份块末状态", + "locale": "zh-CN", + "quality_profile": "showcase", + "output": "docs/assets/architecture/model-architecture/kda--chunkwise-two-level.html" + }, + "stages": [ + { + "label": "输入 · 按块切开" + }, + { + "label": "两级并行准备(各块同时)" + }, + { + "label": "汇合" + }, + { + "label": "产出" + } + ], + "nodes": [ + { + "id": "tk", + "type": "messagebus", + "label": "Token 流切成 64 一块", + "sublabel": "每块的 k, v, α, β", + "tag": "块内已知", + "stage": 0, + "row": 1, + "width": 150 + }, + { + "id": "mac", + "type": "backend", + "label": "块间 · 宏观并行", + "sublabel": "各块独立算 Transition / Δ", + "tag": "仿射可组合", + "stage": 1, + "row": 0, + "width": 152 + }, + { + "id": "mic", + "type": "backend", + "label": "块内 · 微观并行", + "sublabel": "解下三角系统 (I+A)X=B", + "tag": "WY 表示", + "stage": 1, + "row": 2, + "width": 152 + }, + { + "id": "e", + "type": "security", + "label": "实际写入差额 E", + "sublabel": "E = U − W·S₀ᵀ", + "tag": "旧状态只在此进入", + "stage": 2, + "row": 1, + "width": 140 + }, + { + "id": "sc", + "type": "database", + "label": "块末状态 S_C", + "sublabel": "S₀·Transition + Δ", + "tag": "传给下一块 · 唯一串行", + "stage": 3, + "row": 0, + "width": 150 + }, + { + "id": "out", + "type": "cloud", + "label": "块内输出 O", + "sublabel": "Q̂_in·S₀ᵀ + M·E", + "tag": "全部 token", + "stage": 3, + "row": 2, + "width": 150 + } + ], + "flows": [ + { + "id": "f1", + "from": "tk", + "to": "mac", + "label": "本块系数", + "variant": "emphasis" + }, + { + "id": "f2", + "from": "tk", + "to": "mic", + "label": "因果折扣 A, B" + }, + { + "id": "f3", + "from": "mic", + "to": "e", + "label": "U, W" + }, + { + "id": "f4", + "from": "mac", + "to": "sc", + "label": "Transition / Δ", + "variant": "emphasis", + "route": "top-channel" + }, + { + "id": "f6", + "from": "e", + "to": "out", + "label": "M·E 块内因果读出", + "labelAt": [ + 635, + 315 + ] + }, + { + "id": "f7", + "from": "e", + "to": "sc", + "label": "参与块末合成", + "labelAt": [ + 649, + 201 + ] + } + ], + "cards": [ + { + "dot": "cyan", + "title": "两级并行各管什么", + "items": [ + "宏观(块间):转移与增量只由本块 token 决定,可全部并行预先算好", + "微观(块内):64 步「先读后写」依赖打包成一次解下三角方程组", + "块间顺序传表是唯一串行环节——递推链只剩 O(块数) 步" + ] + }, + { + "dot": "emerald", + "title": "重写是精确的", + "items": [ + "无近似、无省略 token 交叉项", + "原型实测:顺序递推与分块公式输出最大偏差 4.4e-16", + "C 是插值旋钮:C=1 退化逐步递推,C=全长退化全并行形式,实用 64/128" + ] + } + ] +} diff --git a/docs/diagrams/kda--evolution-ladder/kda--evolution-ladder.json b/docs/diagrams/kda--evolution-ladder/kda--evolution-ladder.json new file mode 100644 index 000000000..fc12d0dda --- /dev/null +++ b/docs/diagrams/kda--evolution-ladder/kda--evolution-ladder.json @@ -0,0 +1,204 @@ +{ + "schema_version": 2, + "diagram_type": "workflow", + "meta": { + "title": "线性注意力门控演进阶梯:每加一个门,治一种病", + "locale": "zh-CN", + "quality_profile": "showcase", + "output": "docs/assets/architecture/model-architecture/kda--evolution-ladder.html" + }, + "phases": [ + { + "id": "de_softmax", + "label": "去 softmax 化(2020–2022)", + "fromCol": 0, + "toCol": 2 + }, + { + "id": "gating", + "label": "门控化(2021–2025)", + "fromCol": 3, + "toCol": 5, + "variant": "emphasis" + } + ], + "lanes": [ + { + "id": "main", + "label": "演进主线" + }, + { + "id": "parallel", + "label": "平行路线" + }, + { + "id": "converge", + "label": "产业收敛" + } + ], + "mainPath": [ + "sm", + "la", + "cv", + "dn", + "gdn", + "kda" + ], + "nodes": [ + { + "id": "sm", + "lane": "main", + "col": 0, + "type": "database", + "label": "Softmax 注意力", + "sublabel": "精确但全量留底", + "icon": "database", + "width": 128 + }, + { + "id": "la", + "lane": "main", + "col": 1, + "type": "backend", + "label": "线性注意力 2020", + "sublabel": "S←S+vkᵀ · 推理 O(1)", + "icon": "active", + "width": 138 + }, + { + "id": "cv", + "lane": "main", + "col": 2, + "type": "backend", + "label": "+短卷积 2022", + "sublabel": "去分母 · 补局部", + "icon": "flag", + "width": 128 + }, + { + "id": "dn", + "lane": "main", + "col": 3, + "type": "backend", + "label": "DeltaNet", + "sublabel": "写入门 β · 只写差额", + "icon": "security", + "width": 138 + }, + { + "id": "gdn", + "lane": "main", + "col": 4, + "type": "backend", + "label": "GDN 2024", + "sublabel": "标量遗忘门 α", + "icon": "clock", + "width": 120 + }, + { + "id": "kda", + "lane": "main", + "col": 5, + "type": "backend", + "label": "KDA 2025", + "sublabel": "按通道遗忘 α", + "tag": "本文主角", + "icon": "active", + "width": 132 + }, + { + "id": "rwkv", + "lane": "parallel", + "col": 2, + "type": "external", + "label": "RWKV 平行路线", + "sublabel": "通道衰减 + 累加写入", + "width": 150 + }, + { + "id": "hyb", + "lane": "converge", + "col": 5, + "type": "cloud", + "label": "Hybrid 收敛", + "sublabel": "每 4 层 3 线性 + 1 完整", + "icon": "cloud", + "width": 150 + } + ], + "edges": [ + { + "id": "e1", + "from": "sm", + "to": "la", + "label": "去掉 softmax 分母" + }, + { + "id": "e2", + "from": "la", + "to": "cv", + "label": "补稳定性与局部" + }, + { + "id": "e3", + "from": "cv", + "to": "dn", + "label": "+写入门 β" + }, + { + "id": "e4", + "from": "dn", + "to": "gdn", + "label": "+标量 α" + }, + { + "id": "e5", + "from": "gdn", + "to": "kda", + "label": "α 升维通道级", + "variant": "emphasis" + }, + { + "id": "e6", + "from": "kda", + "to": "hyb", + "label": "固定容量兜底" + }, + { + "id": "e7", + "from": "la", + "to": "rwkv", + "label": "平行演进", + "variant": "dashed" + } + ], + "cards": [ + { + "dot": "amber", + "title": "门控粒度的天花板", + "items": [ + "按通道遗忘保持「对角阵+秩一修正」结构,分块并行算法才成立", + "细到逐元素遗忘即失去共享结构——表达力与并行效率在粒度上直接交换" + ] + }, + { + "dot": "violet", + "title": "训练视角:门不是装饰", + "items": [ + "状态矩阵=在线训练的线性模型", + "写入门 β=学习率,遗忘门 α=1−ηλ=权重衰减", + "delta 修正=残差上的一步梯度下降" + ] + }, + { + "dot": "emerald", + "title": "2026 年产业收敛", + "items": [ + "Kimi K3:69 KDA + 24 MLA(NoPE)", + "GLM-5.3-Flash:34 KDA + 11 DSA(NoPE)", + "Qwen3.8 系:GDN 混合(RoPE)", + "共同档位:每 4 层 3 线性 + 1 完整注意力" + ] + } + ] +} diff --git a/docs/research/model-architecture/250-linear-attention-kda.md b/docs/research/model-architecture/250-linear-attention-kda.md new file mode 100644 index 000000000..7ef11ee21 --- /dev/null +++ b/docs/research/model-architecture/250-linear-attention-kda.md @@ -0,0 +1,262 @@ +--- +sidebar_position: 1 +title: "线性注意力机制精读与通俗拆解(AI Infra 进阶)" +description: "腾讯技术工程 3 万字长文(2026-10-29)精读 + 10 个一手信源对账:门控演进链(DeltaNet→GDN→KDA)、chunk-wise 两级并行、hybrid 兜底与 vLLM 落地,配原型与破坏实验" +--- + +# 线性注意力机制精读与通俗拆解(AI Infra 进阶) + +> [1] binnnliu(Gordon),"AI Infra进阶:3万字深入理解线性注意力机制," 腾讯技术工程(微信公众号),2026-10-29. [Online]. Available: https://mp.weixin.qq.com/s/O0_v8wz4iHxbkDLENy7EPg (访问 2026-10-30;微信无版本机制)。原文 190 余条公式以图片内嵌,本篇按图片说明文字逐条复原;21 张配图无法取用,关键机制改为自绘图。 + +> [!NOTE] 精读范围 +> 原文全部章节与 5 个附录逐单元通读;公式与关键数字经 10 个一手信源对账([2]–[6] 通读,[7]–[11] 摘要级)。配套原型见 §7。 + +**一句话定位**:用一张固定大小的记忆矩阵 S 替代随长度线性膨胀的 KV Cache,靠「覆写式写入 + 按通道遗忘 + 分块并行」让长上下文推理的单步成本恒定,代价是固定容量必须靠少量完整注意力层兜底。 + +**导读**:模型逐个 token(文本切出的最小单位,约一个字或词片)生成,每步回读全部历史缓存,越长越贵;本文讲把「按 token 留底」换成「固定表格记账」:§3 讲读写与遗忘,§4 讲串行变矩阵乘,§5 讲装不下怎么办与引擎落地。 + +> [!TIP] 白话主线 +> ① 每生成一个 token 都要回读全部历史缓存,显存/带宽/计算随长度线性涨;② 改用固定大小的表格 S 记上下文,写一笔、查一次,单步成本与长度无关;③ 纯加法会重复记账,改成「先查旧账、只写差额」,再按通道乘遗忘系数;④ 串行更新整理成系数可预先算好的形式,按 64 token 分块,块内一次解方程、块间只传表;⑤ 固定表格装不下无限历史,每 4 层混 1 层完整注意力兜底,引擎侧还要解决对齐、前缀缓存与推测解码。 + +## 1. 它要解决什么问题 + +大模型推理分两个阶段,成本结构完全不同: + +| 阶段 | 做什么 | 并行性 | 瓶颈 | +|:---|:---|:---|:---| +| Prefill | 整段读入提示词,算出每层每个历史 token 的键 k、值 v 并缓存 | 可并行 | 算力 | +| Decode | 逐字生成,每步都要读全部历史缓存算注意力 | 串行 | 显存带宽 | + +这份缓存就是 KV Cache。麻烦在于它**按 token 留底、一份都不能扔**:第 t 步生成时,每层都要把前 t−1 个 token 的 k、v 搬一遍。三条代价随长度线性增长:显存(长对话放不下几个并发)、带宽(每步全量重读)、计算(与每个历史位置各算一次得分)。注意力会拆成多个并行的「头」,按常见的分组注意力(GQA)口径估算,一层缓存字节数约为 $2\times\text{KV头数}\times\text{头维}\times\text{长度}\times\text{每字节}$——长度因子无处可逃。 + +产业界三条缓解路线: + +| 路线 | 做法 | 代表 | +|:---|:---|:---| +| 稀疏注意力 | 只看部分历史,KV 仍全存、只省访存 | DSA、滑窗(DeepSeek V4.1)[1] | +| 压缩 KV | k、v 压进低维潜向量再缓存 | MLA(DeepSeek 系)[1] | +| 线性注意力 | 历史压进固定状态矩阵 | 本文主角:DeltaNet→GDN→KDA [2][3] | + +| 设计规格 | 通俗版 | 对应机制 | +|:---|:---|:---| +| 单步成本与长度无关 | 表格固定大小,写一笔查一次 | 状态矩阵 S(§3.1) | +| 写入不重复记账 | 先查旧账、只写差额 | delta rule 覆写(§3.3) | +| 旧信息可淡出 | 表格每列乘各自的衰减系数 | 按通道遗忘门(§3.4) | +| 训练能吃满 GPU | 串行递推改写成分块矩阵乘 | chunk-wise 两级并行(§4) | +| 精确召回有兜底 | 少数层保留完整注意力 | hybrid 混层与工程落地(§5) | + +## 2. 全貌解剖 + +| 层级 | 部分 | 回答的问题 | +|:---|:---|:---| +| 主线机制 | 状态读写 → 门控演进 → 分块并行 → hybrid 落地 | 怎么写得准、训得快、装得下 | +| 证据链 | 训练视角 + 论文数字 + 原型 | 门控为何「科学」、省多少 | +| 地图坐标 | 三路线、RWKV、RoPE/NoPE | 周边坐标 | + +因果主线:decode 回读全量 KV → 病根是按 token 精确留底 → 设计固定状态 + 覆写 + 遗忘 + 并行 + 兜底 → 证据来自递推式推导 [2][3][4]、在线学习解释 [2][6]、原型(§7)与 vLLM 落地 [5]。 + +演进谱系一句话一档——**每一步加一个门、治一种病**: + +| 档 | 更新式 | 加了什么 | 治什么病 | +|:---|:---|:---|:---| +| Softmax | $o_i=\sum_j \mathrm{softmax}(q_i^\top k_j)v_j$ | — | (基线:精确但全量留底) | +| 线性注意力 [7] | $S_t=S_{t-1}+v_tk_t^\top$ | 去掉 softmax 非线性 | 推理 O(1),但只会叠账 | +| 去分母+短卷积 [8] | 同上,q/k/v 先过因果卷积 | 去分母、输出归一化(2022);短卷积补局部 | 分母小致梯度爆炸;丢局部细节 | +| DeltaNet [4][6] | $S_t=S_{t-1}+\beta_t(v_t-S_{t-1}k_t)k_t^\top$ | 写入门 β + 残差修正 | 同一 key 反复叠账 | +| GDN [3] | $\bar S_t=\alpha_tS_{t-1}$ 再做 delta 写入 | 标量遗忘门(每头一个) | 旧信息永不淡出 | +| KDA [2] | $\bar S_t=S_{t-1}\operatorname{diag}(\alpha_t)$ 再做 delta 写入 | 按通道遗忘门(每列一个) | 全通道只能同速遗忘 | + +RWKV 走平行路线:RWKV-6 已按通道衰减但写入仍是累加,RWKV-7 用对角加秩一转移、抹除与写入可用不同 key [1]。 + +## 3. 机制一:从叠加记账到按通道遗忘 + +换成固定表格后,难点是怎样写才不乱、旧账怎样淡出。 + +### 3.1 把历史压进一张固定表格 + +注意力本来就是「拿问题向量 q 给历史逐条打分、按分加权取值」。线性注意力把打分记录改成表格:维护一张 $d_v\times d_k$ 的数字表格 S(行是内容通道、列是检索通道),每来一个 token 写入一笔外积 $v_tk_t^\top$(第 i 行第 j 列填 v 的第 i 个数乘 k 的第 j 个数),查询时读表 $o_t=S_tq_t$ [7]。表格尺寸与长度无关——这是推理 O(1) 的来源;代价是历史被**有损压缩**,表格不保留任何原始条目。 + +### 3.2 去分母与短卷积:稳定性和局部细节 + +早期写法带归一化分母 $o_t=S_tq_t/(q_t^\top z_t)$。《The Devil in Linear Transformer》指出这个缩放分母是梯度无界的元凶,可能极小,于是去掉它、在注意力层之后加归一化 [1][8]。压缩全局历史会丢局部细节,所以 DeltaNet、GDN、KDA 都在 q/k/v 上加一维因果短卷积(kernel=4、固定权重的逐通道滑窗求和),「卷积补局部、状态聚合全局」成为标配;同时把 q、k 做 L2 归一化(模长缩到 1),让覆写语义精确(§3.3)[4]。 + +### 3.3 覆写写入:先查旧账,只写差额 + +纯加法的问题:同一话题反复出现就反复叠加、新旧分不清。设同一个 key(模长 1)先后要记 1、2、3、4、5:纯加法表里该项累加成 15;改成先读旧值、只补差额,第 5 次读出旧值 4、补 1,表里恰为 5(原型 D2)。修法来自视角转换——**把 S 看成在线训练的线性模型**:S 从 key 预测 value,每来一个样本 $(k_t,v_t)$ 按重构损失 $\ell_t(S)=\tfrac12\|v_t-Sk_t\|_2^2$ 做一步梯度下降,学习率正是写入门 $\beta_t$: + +$$S_t=S_{t-1}-\beta_t\nabla\ell_t(S_{t-1})=S_{t-1}+\beta_t(v_t-S_{t-1}k_t)k_t^\top.$$ + +这就是 delta rule(误差修正规则,可溯至 Widrow–Hoff 1960;Schlag 等把它做进线性注意力并命名 Delta Network)[6],Kimi Linear 沿用同一推导 [2]。$S_{t-1}k_t$ 就是旧账读数;旧表已能给出 $v_t$ 时差额为零、什么都不写。key 归一化后右乘 $k_t$ 可验证覆写语义: + +$$S_tk_t=(1-\beta_t)\,S_{t-1}k_t+\beta_tv_t,$$ + +β=1 即在该 key 上精确覆写、0<β<1 是部分修正(原型实测最优步长 β\*=1/‖k‖²,归一化后恰为 1)。注意减掉的不是整张旧表,只是 $k_t$ 匹配方向上的分量——与 $k_t$ 正交的内容不受影响、相似的 key 会受牵连,表格是连续叠加体而非独立槽位。 + +### 3.4 遗忘门:给旧账一个衰减速度 + +S 是随上下文快速变化的权重(fast weight)[6],对它加 L2 正则 $\ell_t^{\mathrm{reg}}=\ell_t+\tfrac{\lambda_t}{2}\|S\|_F^2$ 再做一步梯度下降,更新式变成 $S_t=(1-\beta_t\lambda_t)S_{t-1}+\beta_t(v_t-S_{t-1}k_t)k_t^\top$——学习率 η 即 β_t,**衰减因子 α=1−ηλ(需 0<ηλ<1)与遗忘门同形**:遗忘就是对快权重做权重衰减 [1][2]。GDN 先衰减旧表、再用衰减后的表算残差纠错(α 管保留、β 管纠正,均由模型按输入生成)[3],但它的 α 每头一个标量、所有通道同速遗忘;KDA 把 α 升维成 $d_k$ 维向量、右乘对角阵,每一列有自己的淡出速度 [2]: + +$$S_t=S_{t-1}\operatorname{diag}(\alpha_t)+\beta_tv_tk_t^\top-\beta_tS_{t-1}(\alpha_t\odot k_t)k_t^\top.$$ + +三项各司其职:按通道衰减历史、写入新知、扣掉衰减后旧表中与新 key 匹配的分量防重复累加。能不能细到每个元素各自遗忘?代数结构不允许:按通道遗忘时所有 value 行共享同一右乘转移,更新保持「对角阵+秩一修正」结构,§4 的分块并行才成立;逐元素遗忘通常不再保留这种共享结构,难以直接沿用同样的分块算法——**表达力与并行效率在门控粒度上直接交换** [1][2]。α 由低秩投影生成,兼具衰减与位置感知双重作用 [2]。 + +![门控演进阶梯:从 softmax 注意力到 KDA,每一档新增的门与它治的病](../../assets/architecture/model-architecture/kda--evolution-ladder-dark.png) + +图源 [.mmd](../../assets/mermaid/model-architecture/kda--evolution-ladder.mmd) · 交互版 [HTML](../../assets/architecture/model-architecture/kda--evolution-ladder.html) · candidate [JSON](../../diagrams/kda--evolution-ladder/kda--evolution-ladder.json) + +图中五档台阶各治一种病:去 softmax 换 O(1),去分母与短卷积治不稳与丢细节,差额写入治叠账,标量 α 治不淡出,对角 α 治同速遗忘;顶端分出 hybrid 分支(§5)。 + +## 4. 机制二:chunk-wise 两级并行 + +表格写对了还得训得快。 + +### 4.1 串行为什么慢、凭什么能并行 + +逐 token 更新表格是串行的:第 t 步要用第 t−1 步算完的表。经典 RNN 更糟:旧状态嵌在 tanh 这类非线性反馈里,每步更新系数离不开旧状态本身。KDA 把含旧表的项合并提公因式后完全不同: + +$$S_t=S_{t-1}\underbrace{\big(\operatorname{diag}(\alpha_t)-\beta_t(\alpha_t\odot k_t)k_t^\top\big)}_{T_t}+\underbrace{\beta_tv_tk_t^\top}_{H_t},$$ + +新表 = 旧表右乘转移矩阵 $T_t$ 再加增量 $H_t$(仿射更新),$T_t,H_t$ 只由当前 token 的 $k,v,\alpha,\beta$ 决定,**不用等旧表就能先算好**。于是切成 64 token 一块,两级并行: + +- **块间(宏观)**:每块的转移 $\mathrm{Transition}_{\mathrm{chunk}}$ 与增量 $\Delta_{\mathrm{chunk}}$ 可各自并行准备,块与块之间只剩「上一块的末表传给下一块」的顺序递推 $S_{\mathrm{out}}=S_{\mathrm{in}}\mathrm{Transition}_{\mathrm{chunk}}+\Delta_{\mathrm{chunk}}$; +- **块内(微观)**:64 步「后写要读前写之后的表」的依赖本是 64 轮循环,可整理成一个下三角线性方程组,**一次解出**。 + +### 4.2 块内公式链:WY 表示 + +记块首状态 $S_0$、块长 C。块内每步差额 $r_i$ 要读第 i−1 步写完的表,把块首到各步的累积衰减记 $\pi_i=\alpha_1\odot\cdots\odot\alpha_i$,依赖写成下三角系统,解出三个辅助矩阵: + +$$U=(I+A)^{-1}BV,\qquad W=(I+A)^{-1}BK_{\mathrm{in}},\qquad E=U-WS_0^\top.$$ + +U 是只看本块局部写入的差额解,W 是旧表对差额的修正系数,E 即各 token 真正写入的 value($(I+A)^{-1}$ 用前代法自第一行逐行代入求解,是纯矩阵运算;A 为严格下三角因果折扣矩阵,B=diag(β))。这套变换称 WY 表示,DeltaNet 并行化论文给出原型 [4],GDN/KDA 给出带门版本 [3][2]。有了 E,块末状态与各输出只剩矩阵乘: + +$$S_C=S_0\big(\operatorname{diag}(\pi_C)-W^\top K_g\big)+U^\top K_g,\qquad O=\underbrace{\hat Q_{\mathrm{in}}S_0^\top}_{\text{跨块历史}}+\underbrace{ME}_{\text{块内因果}}.$$ + +$M$ 是带衰减的下三角读取矩阵(第 j 笔写入衰减到位置 i 后被读出的比例)。**没有近似、没有省略交叉项**——这是对逐步递推的精确重写。原型实测:逐 token 循环与分块公式对 KDA/DeltaNet/GDN 三种形态的输出与末状态最大偏差均 < 1e-15(实际运行日志,§7)。 + +![chunk-wise 两级并行:块间仿射递推 scan 与块内 WY 下三角系统汇于同一份块末状态](../../assets/architecture/model-architecture/kda--chunkwise-two-level-dark.png) + +图源 [.mmd](../../assets/mermaid/model-architecture/kda--chunkwise-two-level.mmd) · 交互版 [HTML](../../assets/architecture/model-architecture/kda--chunkwise-two-level.html) · candidate [JSON](../../diagrams/kda--chunkwise-two-level/kda--chunkwise-two-level.json) + +图中序列切成 64 一块后走两条路:块间路只传表格(顺序但极短),块内路把 64 步依赖压进一次解方程(完全并行),两路汇合产出块末状态与全部输出。 + +### 4.3 工程执行与位置编码 + +以 256 个 token(4 块)走一遍三阶段:① 4 块同时解下三角系统得 U/W;② 按块顺序传 4 次表(这步的并行度来自请求数、头数与 V 轴分块);③ 4 块同时读出各自输出。chunk 大小 C 是插值旋钮:C=1 退化回逐步递推、C=全长退化为全并行形式,实用取 64/128 [4];GLA 的 FlashLinearAttention 把这类算法做成硬件高效实现 [9]。 + +并行的代价藏在位置信息里:纯加法状态满足交换律——输入 [A,B] 与 [B,A] 得到同一张表,顺序丢失。遗忘门把它找回来:token 离当前越远、经历的衰减次数越多、信号越弱,**遗忘本身就是一种相对位置编码** [2]。RoPE 用旋转把相对位置显式写进打分,NoPE 不加显式位置编码。各家的选择(据文 [1],截至 2026-10): + +| 模型 | 层数构成 | 位置编码 | +|:---|:---|:---| +| Kimi K3 | 93 层 = 69 KDA + 24 MLA(每 4 层 3+1) | NoPE | +| GLM-5.3 | 78 层全 DSA(MLA+indexer) | RoPE | +| GLM-5.3-Flash | 45 层 = 34 KDA + 11 DSA(每 4 层 3+1) | NoPE | +| Qwen3.8-Flash-Next | 48 层 = 36 GDN + 12 QSA | RoPE | +| Qwen3.8-Max | 92 层 = 69 GDN + 23 门控注意力 | RoPE | + +## 5. 机制三:固定容量的兜底与 vLLM 落地 + +写和训解决后还剩两问:装不下怎么办,引擎怎么接。 + +### 5.1 固定表格装不下无限历史 + +表格的正交容量由维度决定:$d_k\times d_v$ 的状态最多精确存 $d_k$ 条相互正交的关联,超出即混叠 [6]。原型 D3 实测:2×2 表格存 2 条正交关联误差为 0,写入第 3 条(2 维内必与旧 key 不正交)后三次查询误差全变 2.365,而 softmax 靠全量留底,前两条误差为 0、第 3 条仅 0.324。门控与覆写改善写入质量,却给不了无限容量;于是各家收敛到 **hybrid**:每 4 层放 3 层线性 + 1 层完整/稀疏注意力,线性层低成本聚合历史,完整层保留直接访问历史的通道兜精确召回 [1][2](Kimi Linear 消融确认均匀 3:1 是质量-吞吐最优 [2])。注意兜底层自己的 KV Cache 仍随长度线性增长——按 3:1 配比,hybrid 省的是线性层那 3/4 的 KV,不是全部 [1][2]。 + +### 5.2 vLLM 落地三件事 + +以 vLLM v0.32.0 跑 GLM-5.3-Flash(34 层 KDA + 11 层 DSA)为例 [1][5]: + +**① 状态对齐进显存块池。** vLLM 把所有层类型的缓存放进同一块池、统一页大小 [5]。一份 KDA 状态 = 卷积窗 conv_state 18,432 B + 记忆矩阵 recurrent_state [8 头×128×128] fp32 524,288 B,共 542,720 B;让一份状态字节数等于一个 KV 块(MLA 每 token 1024 B):$\text{block\_size}=128\times\lceil 542720/131072\rceil=640$。状态补齐到 655,360 B(多 20.7% 填充),34 层 KDA 按每块装 11 份切成 4 组 [9,9,8,8]——hybrid 模型启动时 block_size 被调到几百即源于此。 + +**② 前缀缓存按块对齐。** vLLM 的前缀缓存以块为单位做链式哈希(本块 token+父块哈希)[5]。线性层状态无法按任意 token 前缀恢复、只能整块边界存取,于是只存「调度步末尾恰落在块边界」的状态(align 模式;旧的逐块全存模式 v0.32.0 已移除——致命的不是占显存,而是每步倾倒无人复用的中间状态 [1])。共享前缀另有 Marconi 调度(按复用概率与节省/足迹比做准入逐出,token 命中率至多 34.4 倍)[10] 与 ReplaySSM(状态表示为 checkpoint+近期输入缓冲,多数解码步免写状态;批大小 256 下解码加速 1.20–1.47 倍)[11]。 + +**③ 推测解码的状态快照。** EAGLE/MTP 这类推测解码先猜几个 token 再一次验证,每个验证位置要一份状态快照。坑在命中处:猜测位置的 KV 用到**下一个** token,最后命中块的块尾引用了块外 token,而块哈希只覆盖块内——调度器分不清命中是否干净,只能按最坏情况**无条件回退一个块**重算 [1]。 + +## 6. 关键实证数字 + +| 实验/实测 | 关键数字 | 条件·截至 | 一句话读法 | +|:---|:---|:---|:---| +| Kimi Linear vs 全注意力 [2] | 解码吞吐至多 6.3×(每输出 token 耗时 TPOT 1.84 vs 11.48 ms)、KV Cache 至多降 75% | 1M 上下文、48B 混合专家模型 · 2025-11 v2 | 长上下文成本优势兑现 | +| Kimi Linear 检索质量 [2] | 长文检索评测 RULER 128k:84.3 分、3.98× 加速;知识评测 MMLU-Pro 4k:51.0 vs GDN-H 47.9、MLA 47.2 | hybrid 3:1 · 2025-11 | 胜绩来自混层,纯线性检索仍是短板(论文自认) | +| 原始线性注意力 [7] | 自回归预测提速至多 4000× | 长序列 RNN 形态 · ICML 2020 | 递推省掉全量重读 | +| chunk-wise 并行 [4] | 加速随长度/头维增大(图 1 纵轴至 20–30×) | 1.3B、FLA 库实现 · 2025-01 v6 | 串行瓶颈解掉 | +| Marconi 前缀调度 [10] | token 命中率至多 34.4×、首 token 延迟(TTFT)降 71.1% | hybrid 服务 trace · MLSys 2025 | 状态的前缀复用成了服务层新问题 | +| 本篇原型(§7) | 顺序 vs 分块偏差 4.4e-16;五次破坏均有实测退化(如纯加法误差 10、范数涨到 724) | dk=dv=2、T≤1024 · 2026-10-30 | 拆任一组件都有具体坏法 | + +三条核心宣称各有独立证据:成本看吞吐与提速,重写精确看 chunk-wise 论文,混层补位看 RULER [2][4][7];原型只验机制、不复现论文数字。 + +## 7. 动手实验室 + +原型 [linear_attention_lab.py](./assets/linear_attention_lab.py) 纯标准库、确定性、无随机数:`demo / selftest / break D1..D5 / count` 四模式;`python3 docs/research/model-architecture/assets/linear_attention_lab.py selftest` 17/17 全绿(秒级)。 + +| 机制 | 实现单元(行号) | +|:---|:---| +| softmax 基线/纯加法/delta 覆写 | softmax_attn:82 · linear_step:93 · delta_step:97 | +| 按通道遗忘 + 覆写(KDA/GDN 同函数) | kda_step:103 · 短卷积 shortconv:107 | +| 顺序递推 / chunk-wise 并行(WY 前代) | seq_run:123 · solve_unit_lower:138 · chunkwise_gated_delta:148 | + +核心断言:KDA / DeltaNet / GDN 三种形态下,逐 token 递推与分块公式的输出、末状态最大偏差均 < 1e-15(demo 实际运行日志:max\|Δo\|=4.441e-16、max\|ΔS\|=2.220e-16)。破坏实验(每次只拆一个组件): + +| 实验 | 改动 | 实测退化(实际运行日志) | 教训 | +|:---|:---|:---|:---| +| D1 去遗忘门 | α≡1、纯加法 | 换值(key 带抖动)误差 0.048 vs 有门 0.032;同向写入时 ‖S‖ 随 √T 涨(45.3→724)vs 有门 1.2→1.0 | delta 只擦得掉精确匹配的旧账,抖动残留靠遗忘门淡出 | +| D2 去 delta 修正 | 只加不减 | 同 key 写 5 次读出 15(真值 5),误差 10 vs 覆写 0 | 加法只会叠账,旧值永远冲不掉 | +| D3 固定容量 | 2×2 状态装第 3 条 | 三查误差 [2.365, 2.365, 0] vs softmax 全量留底 [0, 0, 0.324] | 容量=正交名额,超出即混叠——hybrid 的动机 | +| D4 去短卷积 | 写入前不融合邻 token | 复合查询读数 0.707 vs 卷积版 1.0 | 局部组合必须在写入前融进 key/value | +| D5 遗忘门降级标量 | 对角 α→每头一个 | 慢信号存活 5.5e-9(真值 7.0)vs 对角门 2.58 且快通道 1.00 兼顾 | 一个速度伺候不了两个时间尺度 | + +## 8. 底层规律与核心争议 + +五条规律分管并行、学习、容量、数值稳定与显存管理,从公式覆盖到引擎;三个争议是未收敛的取舍。 + +**规律 1:代数结构决定并行上限。** 非线性反馈换成仿射更新才有分块并行;门控细过通道级即失去「对角+秩一」结构(§3.4、§4)。 + +**规律 2:门控是在线学习的标准组件。** β=学习率、α=权重衰减(1−ηλ)、delta rule=残差梯度一步——记忆更新就是一步梯度下降 [2][6]。 + +**规律 3:固定容量必混叠,hybrid 是容量与成本的折中。** 正交名额有限,精确召回靠直接访问通道兜底;兜底层 KV 仍线性增长,省的是比例不是全部(§5.1)。 + +**规律 4:稳定件与结构件伴生。** 去分母与 L2 归一化防梯度无界,短卷积补被全局压缩丢掉的局部细节 [4][8]。 + +**规律 5:算法形态决定显存管理形态。** block_size 640 是状态尺寸对齐 KV 块的结果——改注意力结构会一路改到缓存管理器 [1][5]。 + +**争议 1:遗忘粒度停在哪一档。** 表达力派想细到逐元素,效率派停在通道级保并行结构;KDA 的立场是「代数结构决定并行上限、硬件成本决定表达力边界」[1][2]。 + +**争议 2:位置信息走隐式还是显式。** NoPE 派(K3、GLM-5.3-Flash)认为遗忘注入的隐式距离编码够用、省旋转开销与外推调参;RoPE 派(Qwen3.8 系)要显式位置进打分。截至 2026-10 两条路线都在产线,未收敛 [1]。 + +**争议 3:线性状态的前缀缓存怎么做。** Marconi 按复用概率调度页级缓存 [10]、ReplaySSM 多数步免写状态 [11]、vLLM 按块边界对齐 [5]——三条路线都在回答:不可按 token 回滚的状态如何复用前缀。 + +## 9. 适用边界 + +### 成立条件 +定义域:decoder-only 大模型的注意力层改造(推理成本 + 训练并行)。成立工况:长上下文、decode 为主的显存/带宽受限服务场景;状态维度远大于并发活跃概念数时混叠可控。 + +### Out-of-Scope +训练数据与缩放律、MoE 路由、多模态与 encoder、softmax 之外的核化变体细节、稀疏注意力(DSA/indexer)内部机制——本文只把它们当对照路线。 + +### 材料没有证明的事 +1. 模型表(K3/GLM-5.3/Qwen3.8 配比)与 vLLM 后端行为出自厂商发布与代码,文章未附逐条出处;KDA 定义与 3:1 配比已对论文核对一致 [2],其余数字以文章为唯一信源、不外推。 +2. 「遗忘门是相对位置编码」是 KDA 论文的说法 [2],文章未给量化边界(多长序列、多小衰减下位置信息会被抹平)。 +3. FlashKDA 与 Triton 后端的差异只有定性描述(算子融合),无基准数字 [1]。 +4. 「块级与 token 级前缀缓存几乎没影响」无实测或引用支撑 [1]。 +5. 按通道门优于标量门的产业级消融数字文章未给(论文级证据见其合成任务与 RULER [2])。 + +## 10. 用户自测与费曼研讨套件 + +1. 不看正文,用 5 句话把「为什么又便宜又快、还必须混完整注意力层」讲给同事听——哪句讲不清就回哪节。 +2. 分块从 64 改成 4,吞吐怎么变?整段一块呢?(块间串行轮数与块内矩阵规模的拉扯,§4.3) +3. 95% 请求共享同一段 2 万 token 系统提示词,前缀缓存对 KDA 层还能「任意位置命中」吗?§5.2 三条路线各付出什么? + +延伸追问:遗忘粒度细到元素级,§4 哪一步先失效? + +## 参考(IEEE) + +[1] binnnliu, "AI Infra进阶:3万字深入理解线性注意力机制," 腾讯技术工程, Oct. 29, 2026. [Online]. Available: https://mp.weixin.qq.com/s/O0_v8wz4iHxbkDLENy7EPg +[2] Kimi Team (Moonshot AI), "Kimi Linear: An expressive, efficient attention architecture," arXiv:2510.26692v2, Nov. 2025. +[3] S. Yang, J. Kautz, and A. Hatamizadeh, "Gated delta networks: Improving Mamba2 with delta rule," arXiv:2412.06464v3 (ICLR 2025), Mar. 2025. +[4] S. Yang, B. Wang, Y. Zhang, Y. Shen, and Y. Kim, "Parallelizing linear transformers with the delta rule over sequence length," arXiv:2406.06484v6, Jan. 2025. +[5] vLLM Project, "Automatic prefix caching," "Hybrid KV cache manager," vLLM Docs (v0.32.0). [Online]. Available: https://docs.vllm.ai/en/latest/features/automatic_prefix_caching.html +[6] I. Schlag, K. Irie, and J. Schmidhuber, "Linear transformers are secretly fast weight programmers," arXiv:2102.11174v3 (ICML 2021), Jun. 2021. +[7] A. Katharopoulos et al., "Transformers are RNNs: Fast autoregressive transformers with linear attention," arXiv:2006.16236v3 (ICML 2020), Aug. 2020. +[8] Z. Qin et al., "The devil in linear transformer," arXiv:2210.10340v1 (EMNLP 2022), Oct. 2022. +[9] S. Yang et al., "Gated linear attention transformers with hardware-efficient training," arXiv:2312.06635v6 (ICML 2024), Aug. 2024. +[10] R. Cao et al., "Marconi: Prefix caching for the era of hybrid LLMs," arXiv:2411.19379v3 (MLSys 2025), Apr. 2025. +[11] Z.-W. Liou et al., "ReplaySSM: Rethinking state storage for faster hybrid-model decoding," arXiv:2610.13778v1, Oct. 2026. diff --git a/docs/research/model-architecture/_category_.json b/docs/research/model-architecture/_category_.json new file mode 100644 index 000000000..2c6a42f97 --- /dev/null +++ b/docs/research/model-architecture/_category_.json @@ -0,0 +1,5 @@ +{ + "position": 11, + "label": "模型架构", + "description": "模型架构与注意力机制精读:250 精读线性注意力机制(腾讯技术工程 3 万字长文 + 10 个一手信源对账),从 KV Cache 三重代价到 KDA 状态更新、chunk-wise 两级并行与 vLLM 工程落地,含纯标准库原型(顺序 vs 分块并行数值一致性 + 五次破坏实验)" +} diff --git a/docs/research/model-architecture/assets/linear_attention_lab.py b/docs/research/model-architecture/assets/linear_attention_lab.py new file mode 100644 index 000000000..6c9238615 --- /dev/null +++ b/docs/research/model-architecture/assets/linear_attention_lab.py @@ -0,0 +1,507 @@ +#!/usr/bin/env python3 +"""线性注意力 → KDA → chunk-wise 并行:纯标准库确定性原型(精读笔记 250 配套 lab)。 + +验证机制而非模型能力:所有 token 流均为脚本化确定性序列,无随机数、无第三方依赖。 +约定与精读笔记一致:S ∈ R^{dv×dk}(行=v 通道、列=k 通道),dk=dv=2 可手算; +单 token 顺序:s̄_i = s_{i-1}Diag(α_i) → r_i = β_i(v_i − s̄_i k_i) → s_i = s̄_i + r_i k_iᵀ → o_i = s_i q̂_i。 + +用法: + python3 linear_attention_lab.py demo # 手算走查(笔记 §7 引用) + python3 linear_attention_lab.py selftest # 全量断言 + python3 linear_attention_lab.py break D1..D5 # 破坏性实验 + python3 linear_attention_lab.py count # 字数门禁(CJK+ASCII 词,≤6000) +""" +import json +import math +import re +import sys + +# ---------- 线性代数(纯列表实现) ---------- + +def zeros(r, c): + return [[0.0] * c for _ in range(r)] + +def eye(n): + m = zeros(n, n) + for i in range(n): + m[i][i] = 1.0 + return m + +def matmul(a, b): + rb, cb = len(b), len(b[0]) + out = zeros(len(a), cb) + for i, row in enumerate(a): + for k, aik in enumerate(row): + if aik: + for j in range(cb): + out[i][j] += aik * b[k][j] + return out + +def matvec(a, x): + return [sum(a[i][j] * x[j] for j in range(len(x))) for i in range(len(a))] + +def outer(v, k): + return [[vi * kj for kj in k] for vi in v] + +def transpose(a): + return [list(r) for r in zip(*a)] + +def diag_apply(s, alpha): # s·Diag(alpha):每列乘各自系数 + return [[row[j] * alpha[j] for j in range(len(row))] for row in s] + +def hadamard(a, b): + return [a[i] * b[i] for i in range(len(a))] + +def l2(x): + return math.sqrt(sum(t * t for t in x)) + +def l2norm_key(k): + n = l2(k) + return [t / n for t in k] + +def fro(s): + return math.sqrt(sum(t * t for row in s for t in row)) + +def vec_eq(a, b, tol=1e-9): + return all(abs(x - y) <= tol for x, y in zip(a, b)) + +def mat_close(a, b, tol=1e-9): + return all(abs(a[i][j] - b[i][j]) <= tol for i in range(len(a)) for j in range(len(a[0]))) + +def fmt(x): + return f"{x:.6g}" + +def fmt_vec(v): + return "[" + ", ".join(fmt(t) for t in v) + "]" + +def fmt_mat(m): + return "[" + "; ".join(fmt_vec(r) for r in m) + "]" + +# ---------- 机制单元(笔记 §7 行号速查表对应) ---------- + +def softmax_attn(qs, ks, vs, scale=10.0): # 基线:softmax 注意力逐 query 检索(scale 锐化≈硬检索) + outs = [] + for i, q in enumerate(qs): + es = [math.exp(scale * dot(q, k)) for k in ks[: i + 1]] + z = sum(es) + outs.append([sum(es[j] * vs[j][d] for j in range(i + 1)) / z for d in range(len(vs[0]))]) + return outs + +def dot(a, b): + return sum(x * y for x, y in zip(a, b)) + +def linear_step(s, k, v): # 机制①:纯加法写入 + w = outer(v, k) + return [[s[i][j] + w[i][j] for j in range(len(s[0]))] for i in range(len(s))] + +def delta_step(s, k, v, beta): # 机制②:先查旧账、只写差额 + old = matvec(s, k) # 旧表对 k 的读数 + r = [beta * (v[i] - old[i]) for i in range(len(v))] + w = outer(r, k) + return [[s[i][j] + w[i][j] for j in range(len(s[0]))] for i in range(len(s))] + +def kda_step(s, k, v, alpha, beta): # 机制③:按通道遗忘 + delta 覆写(GDN 是其标量特例) + sbar = diag_apply(s, alpha) # 先衰减(每列一个速度) + return delta_step(sbar, k, v, beta) + +def shortconv(rows, w=(0.0, 0.0, 0.5, 0.5)): # 机制④:kernel=4 因果短卷积(逐通道、固定权重) + out = [] + for i, r in enumerate(rows): + acc = [0.0] * len(r) + for off in range(4): + j = i - (3 - off) + if j >= 0: + acc = [acc[d] + w[off] * rows[j][d] for d in range(len(r))] + out.append([silu(t) for t in acc]) + return out + +def silu(x): + return x / (1.0 + math.exp(-x)) if abs(x) < 50 else (x if x > 0 else 0.0) + +# ---------- 顺序(递推)执行 ---------- + +def seq_run(ks, vs, alphas, betas, qhats, s0, use_delta=True, use_gate=True): + """逐 token 递推:返回 (逐步输出 list, 末状态)。""" + s = [row[:] for row in s0] + outs = [] + for t in range(len(ks)): + if use_delta: + a = alphas[t] if use_gate else [1.0] * len(ks[0]) + s = kda_step(s, ks[t], vs[t], a, betas[t]) + else: + s = linear_step(s, ks[t], vs[t]) + outs.append(matvec(s, qhats[t])) + return outs, s + +# ---------- chunk-wise 并行执行(WY / 下三角前代) ---------- + +def solve_unit_lower(a, b): + """解 (I+A)X = B(A 严格下三角):逐行前代,X 第 i 行 = B[i] − Σ_{j 0.3 and st[0][1] < 1e-9) + + # ⑩ β=0 不写 + s0b = [[0.3, 0.0], [0.0, 0.3]] + sb = kda_step(s0b, [1.0, 0.0], [5.0, 5.0], [0.9, 0.9], 0.0) + check("β=0 只衰减不写入", mat_close(sb, diag_apply(s0b, [0.9, 0.9]), 1e-12)) + + # ⑪ β* 暴力搜索 = 1/‖k‖²(重构损失最优步长,笔记 §3) + k = [0.6, 0.8] + s_pre = [[1.0, 0.0], [0.0, 0.0]] + v = [2.0, 1.0] + best, grid = None, [i / 1000.0 for i in range(0, 2001)] + for b in grid: + s_try = delta_step(s_pre, k, v, b) + loss = sum((x - y) ** 2 for x, y in zip(matvec(s_try, k), v)) + if best is None or loss < best[0]: + best = (loss, b) + check(f"β* 数值搜索 {best[1]:.3f} ≈ 1/‖k‖² = {1.0 / dot(k, k):.3f}", + abs(best[1] - 1.0 / dot(k, k)) < 2e-3) + + # ⑫ 短卷积混合邻近 token + rows = shortconv([[1.0, 0.0], [0.0, 1.0]]) + merged = rows[1] + check(f"短卷积把二元组融成复合表示 {fmt_vec([round(t,3) for t in merged])}", + abs(merged[0] - merged[1]) < 1e-6 and merged[0] > 0.3) + + # ⑬ O(1) 记账:状态尺寸与序列长度无关 + for T in (16, 64): + _, s_t = seq_run(*det_stream(T), zeros(2, 2)) + assert len(s_t) == 2 and len(s_t[0]) == 2 + check("状态恒为 2×2(T=16/64 相同)", True) + + # ⑭ 重复运行逐字节一致 + r1 = json.dumps([o_seq, s_seq], sort_keys=True) + o_seq2, s_seq2 = seq_run(ks, vs, alphas, betas, qhats, s0) + check("重复运行逐字节一致", r1 == json.dumps([o_seq2, s_seq2], sort_keys=True)) + + # ⑮ softmax 基线在正交 key 下近似精确检索(D3 对照前提) + ksq, vsq, _, _, _ = det_stream(4) + o_sm = softmax_attn(ksq, ksq, vsq) + check("softmax 基线:末位自检索近似还原 v_T", + all(abs(a - b) < 0.1 for a, b in zip(o_sm[-1], vsq[-1]))) + + # ⑯ count 自证 + c = count_words(__file__ + ".count.tmp") if False else None + demo = "五个汉字 plus one" + n_cjk = len(re.findall(r"[㐀-䶿一-鿿]", demo)) + n_w = len(re.findall(r"[A-Za-z]+(?:[-'’][A-Za-z]+)*", demo)) + check("count 自证(5 CJK+1 词=6)", n_cjk + n_w == 6) + + print(f"\n{sum(ok)}/{len(ok)} PASSED " + ("✔ SELFTEST PASSED ✔" if all(ok) else "✘ SELFTEST FAILED ✘")) + return all(ok) + +# ---------- 破坏性实验 ---------- + +def cmd_break(which): + ks, vs, alphas, betas, qhats = det_stream(64) + if which == "D1": # 去遗忘门:噪声 key 下的陈旧记忆冲不掉 + def noisy_updates(gate): + s = zeros(2, 2) + for t in range(1, 11): + ang = 0.35 * math.sin(t) # 同一概念的 key 带抖动 + k = l2norm_key([math.cos(ang), math.sin(ang)]) + v = [1.0, 0.0] if t <= 8 else [0.0, 1.0] # 前八次旧值,末两次新值 + a = [gate, gate] if gate else [1.0, 1.0] + s = kda_step(s, k, v, a, 1.0) + return s + s_g = noisy_updates(0.8) + s_n = noisy_updates(None) + q = [1.0, 0.0] + o_g, o_n = matvec(s_g, q), matvec(s_n, q) + err_g = l2([a - b for a, b in zip(o_g, [0.0, 1.0])]) + err_n = l2([a - b for a, b in zip(o_n, [0.0, 1.0])]) + def acc_norms(T): + s_lin, s_kda = zeros(2, 2), zeros(2, 2) + kT, _, aT, bT, _ = det_stream(T) + for t in range(T): + vT = kT[t][:] # v=k:同向 PSD 写入,能量只增 + s_lin = linear_step(s_lin, kT[t], vT) # 纯加法:无门无修正 + s_kda = kda_step(s_kda, kT[t], vT, aT[t], bT[t]) + return fro(s_lin), fro(s_kda) + n64, k64 = acc_norms(64) + n1k, k1k = acc_norms(1024) + print(f"D1 去遗忘门: 同一概念换了值(key 带抖动)后查询——有门读数 {fmt_vec([round(t,3) for t in o_g])}" + f"(真值 [0,1],误差 {err_g:.3f});无门读数 {fmt_vec([round(t,3) for t in o_n])}(误差 {err_n:.3f})") + print(f" ‖S‖_F 随长度:纯加法 T=64→{n64:.2f}、T=1024→{n1k:.2f}(随 √T 无界增长);" + f"遗忘门+delta {k64:.2f}→{k1k:.2f}(有界)") + print(" 教训:delta 只能擦掉与当前 key 精确匹配的旧账,抖动的陈旧条目要靠遗忘门淡出;无门纯加法则永不收缩。") + elif which == "D2": # 去 delta 修正:覆写残留 + k = [1.0, 0.0] + s = zeros(2, 2) + vs5 = [[float(i + 1), 0.0] for i in range(5)] + for v in vs5: + s = linear_step(s, k, v) + err_lin = l2([a - b for a, b in zip(matvec(s, k), vs5[-1])]) + s2 = zeros(2, 2) + for v in vs5: + s2 = delta_step(s2, k, v, 1.0) + err_del = l2([a - b for a, b in zip(matvec(s2, k), vs5[-1])]) + print(f"D2 去 delta 修正(纯加法): 同 key 写 5 次后读数 = {fmt_vec(matvec(s, k))}(真值 {fmt_vec(vs5[-1])})") + print(f" 纯加法误差 {err_lin:.2f} vs delta 覆写误差 {err_del:.1e}") + print(" 教训:加法只会叠账,同一 key 的旧值永远冲不掉。") + elif which == "D3": # 固定容量 vs softmax:正交容量 2 条,第 3 条开始混叠 + k1, k2, k3 = [1.0, 0.0], [0.0, 1.0], l2norm_key([1.0, 1.0]) + v1, v2, v3 = [2.0, 0.0], [0.0, 3.0], [4.0, 0.0] + ones = [1.0, 1.0] + + def state_errs(keys, vals): + s = zeros(2, 2) + for k, v in zip(keys, vals): + s = delta_step(s, k, v, 1.0) # 纯 delta、无衰减:只看容量 + return [l2([a - b for a, b in zip(matvec(s, k), v)]) for k, v in zip(keys, vals)] + + e2 = state_errs([k1, k2], [v1, v2]) + e3 = state_errs([k1, k2, k3], [v1, v2, v3]) + sm3 = softmax_attn([k1, k2, k3], [k1, k2, k3], [v1, v2, v3]) + e_sm = [l2([a - b for a, b in zip(o, v)]) for o, v in zip(sm3, [v1, v2, v3])] + print(f"D3 固定容量: 2×2 状态存 2 条正交关联——误差 {fmt_vec([round(t,6) for t in e2])}(精确)") + print(f" 写入第 3 条(45° 方向,2 维内必与旧 key 不正交)后三查误差 " + f"{fmt_vec([round(t,3) for t in e3])};softmax 全量 KV 三查误差 {fmt_vec([round(t,3) for t in e_sm])}") + print(" 教训:状态容量=维度给的正交名额,超出即混叠;softmax 靠全量留底才保持精确——这就是 hybrid 的动机。") + elif which == "D4": # 去短卷积:邻近消歧失败 + rows_raw = [[1.0, 0.0], [0.0, 1.0]] + conv = shortconv(rows_raw) + s_conv, s_raw = zeros(2, 2), zeros(2, 2) + s_conv = delta_step(s_conv, l2norm_key(conv[1]), [1.0, 0.0], 1.0) # 二元组融成一条 + s_raw = delta_step(s_raw, rows_raw[1], [1.0, 0.0], 1.0) + q = l2norm_key([0.5, 0.5]) + o_conv, o_raw = matvec(s_conv, q), matvec(s_raw, q) + print(f"D4 去短卷积: 复合查询 {fmt_vec(q)} 卷积版读数 {fmt_vec([round(t,3) for t in o_conv])};" + f"裸 token 版 {fmt_vec([round(t,3) for t in o_raw])}") + print(" 教训:状态只认写入的 key——局部组合信息必须在写入前由短卷积融进 key/value。") + elif which == "D5": # 对角门降级标量门:双时间尺度必丢一端 + T = 200 + slow_k, fast_k = [1.0, 0.0], [0.0, 1.0] + + def run_decay(alpha_pair): + s = delta_step(zeros(2, 2), slow_k, [7.0, 0.0], 1.0) # t=1 写慢信号(通道 0) + for t in range(2, T + 1): # 通道 1 高频信号,末位写 1 + s = kda_step(s, fast_k, [0.0, 1.0 if t == T else 0.0], alpha_pair, 1.0) + return s + + s_diag = run_decay([0.995, 0.9]) # 对角门:通道 0 慢速、通道 1 快速 + s_scal = run_decay([0.9, 0.9]) # 标量门:被迫同一速度 + o_slow = matvec(s_diag, slow_k)[0] + o_scalar = matvec(s_scal, slow_k)[0] + o_fast_ch = matvec(s_diag, fast_k)[1] + print(f"D5 对角门 → 标量门: 慢信号存活(对角门 α0=0.995)= {o_slow:.3f}(真值 7.0);" + f"标量门 α=0.9 下 = {o_scalar:.2e};快通道末值 = {o_fast_ch:.3f}(真值 1.0)") + print(" 教训:一个标量速度伺候不了两个时间尺度——要么旧账被提前抹掉,要么新账冲不掉。") + +# ---------- 字数门禁(沿用 179/181 口径) ---------- + +def count_words(path): + text = open(path, encoding="utf-8").read() + text = re.sub(r"```.*?```", "", text, flags=re.S) + text = re.sub(r"~~~.*?~~~", "", text, flags=re.S) + text = re.sub(r"^\s*!\[[^\]]*\]\([^)]*\)\s*$", "", text, flags=re.M) + text = re.sub(r"https?://\S+", "", text) + cjk = len(re.findall(r"[㐀-䶿一-鿿]", text)) + words = len(re.findall(r"[A-Za-z]+(?:[-'’][A-Za-z]+)*", text)) + return cjk + words + +def main(): + if len(sys.argv) < 2: + print(__doc__) + return 0 + if sys.argv[1] == "demo": + cmd_demo() + elif sys.argv[1] == "selftest": + return 0 if cmd_selftest() else 1 + elif sys.argv[1] == "break": + cmd_break(sys.argv[2] if len(sys.argv) > 2 else "D1") + elif sys.argv[1] == "count": + n = count_words(sys.argv[2]) + print(f"字数(CJK+英文单词)= {n}(门禁 6000)") + return 0 if n <= 6000 else 2 + else: + print(__doc__) + return 0 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/docs/research/readme.md b/docs/research/readme.md index 00431e554..09722c90e 100644 --- a/docs/research/readme.md +++ b/docs/research/readme.md @@ -135,3 +135,9 @@ --- > 阅读建议:首次按一→六段论顺序通读;选型查阅直接跳到对应分组。各子目录的 `_category_.json` 提供分组级描述,wiki 左栏可折叠展开。 + +## 十一、模型架构 · `model-architecture/` + +| 文档 | 主旨 | +|:---|:---| +| [线性注意力机制精读与通俗拆解(AI Infra 进阶)](./model-architecture/250-linear-attention-kda.md) | 腾讯技术工程 3 万字长文精读(2026-10-29)+ 10 个一手信源对账:KV Cache 三重代价 → 记忆矩阵 S 与门控演进链(Linear→+conv→DeltaNet→GDN→KDA,β=学习率/α=权重衰减的训练视角统一解释)→ chunk-wise 两级并行(仿射化 + WY 表示,顺序 vs 分块原型逐位一致 4.4e-16)→ 固定容量 hybrid 兜底与 vLLM v0.32.0 落地(block 640 对齐/[9,9,8,8] 分组/Marconi/ReplaySSM/EAGLE block drop);五规律三争议五批判边界;配套 [linear_attention_lab.py](./model-architecture/assets/linear_attention_lab.py)(17 断言 + D1–D5 破坏实验)与两张 archify 图(演进阶梯/chunk-wise 两级并行) |