feat: trace DeepSeek Chat completion depth
This commit is contained in:
@@ -3,6 +3,8 @@ dist/
|
|||||||
.astro/
|
.astro/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.log
|
*.log
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
# Local primary-source cache. The public repository stores canonical URLs,
|
# Local primary-source cache. The public repository stores canonical URLs,
|
||||||
# checksums and research notes instead of redistributing downloaded papers.
|
# checksums and research notes instead of redistributing downloaded papers.
|
||||||
|
|||||||
+14
-3
@@ -14,7 +14,7 @@
|
|||||||
| 表示、位置与残差高速公路 | 完成首版 | 81% | 真实 hidden-state / norm traces、长上下文位置外推与深层稳定性消融 |
|
| 表示、位置与残差高速公路 | 完成首版 | 81% | 真实 hidden-state / norm traces、长上下文位置外推与深层稳定性消融 |
|
||||||
| Scaling Laws | 完成首版 | 74% | 真实拟合复现、置信区间与更多模型族对照 |
|
| Scaling Laws | 完成首版 | 74% | 真实拟合复现、置信区间与更多模型族对照 |
|
||||||
| 数据工程与预训练配方 | 完成首版 | 73% | FineWeb / DCLM 逐图精读、真实去重误伤与 mixture traces |
|
| 数据工程与预训练配方 | 完成首版 | 73% | FineWeb / DCLM 逐图精读、真实去重误伤与 mixture traces |
|
||||||
| DeepSeek 专题 | 四轮实证进行中 | 98% | completion-aware 生成评测、完整 27 层与固定 batch-content 对照,再推进 SM90 FlashMLA、FP8/pipeline 与 R1-like RL 复现 |
|
| DeepSeek 专题 | 五轮实证进行中 | 99% | 扩大 completion/task 样本与 sampling 复现,再推进 SM90 FlashMLA、FP8/pipeline、干预式 mediation 与 R1-like RL 复现 |
|
||||||
| 指令微调与人类偏好 | 完成首版 | 75% | 真实偏好分歧、RM 长度偏置与 PPO/DPO 小模型复现 |
|
| 指令微调与人类偏好 | 完成首版 | 75% | 真实偏好分歧、RM 长度偏置与 PPO/DPO 小模型复现 |
|
||||||
| 推理与测试时扩展 | 完成首版 | 76% | 真实模型采样曲线、PRM 案例与逐篇图表精读 |
|
| 推理与测试时扩展 | 完成首版 | 76% | 真实模型采样曲线、PRM 案例与逐篇图表精读 |
|
||||||
| 工具使用与长程 Agent | 完成首版 | 74% | 真实环境 traces、cross-harness 对照、Agent RL 曲线与安全案例 |
|
| 工具使用与长程 Agent | 完成首版 | 74% | 真实环境 traces、cross-harness 对照、Agent RL 曲线与安全案例 |
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
- [x] 完成 486 篇关键论文索引,覆盖 16 个标签专题与 Kimi/DeepSeek 聚光主线。
|
- [x] 完成 486 篇关键论文索引,覆盖 16 个标签专题与 Kimi/DeepSeek 聚光主线。
|
||||||
- [x] 完成可检索、可按专题筛选的论文库页面。
|
- [x] 完成可检索、可按专题筛选的论文库页面。
|
||||||
- [x] 完成 K3、语言模型前史、Transformer 基础、表示/位置/残差、DeepSeek 谱系、Scaling Laws、数据工程、长上下文、MoE、指令微调与人类偏好、推理、Agent、原生多模态、训练系统、推理服务、数值优化与评测安全十七篇首版长文。
|
- [x] 完成 K3、语言模型前史、Transformer 基础、表示/位置/残差、DeepSeek 谱系、Scaling Laws、数据工程、长上下文、MoE、指令微调与人类偏好、推理、Agent、原生多模态、训练系统、推理服务、数值优化与评测安全十七篇首版长文。
|
||||||
- [x] 完成 K3 三轴架构、八联报告实验与四联开放工件实验、语言模型前史四联实验、Transformer 四联实验、表示深度四联实验、DeepSeek 十八联实验、长上下文、MoE 路由、推理三页签,以及训练系统、推理服务、Scaling、数据工程、数值、Alignment、Agent、原生多模态与评测安全专题各四页签等八十五个原创交互视图。
|
- [x] 完成 K3 三轴架构、八联报告实验与四联开放工件实验、语言模型前史四联实验、Transformer 四联实验、表示深度四联实验、DeepSeek 十九联实验、长上下文、MoE 路由、推理三页签,以及训练系统、推理服务、Scaling、数据工程、数值、Alignment、Agent、原生多模态与评测安全专题各四页签等八十六个原创交互视图。
|
||||||
- [x] 完成长上下文首版:五张成本账、26 篇一手论文、10+ 机制图与 8 策略交互实验室。
|
- [x] 完成长上下文首版:五张成本账、26 篇一手论文、10+ 机制图与 8 策略交互实验室。
|
||||||
- [x] 核验 FlashAttention、DeepSeek-V2/V3.2/V4、Kimi Linear/K3 等六份论文原文,并建立长上下文研究账本。
|
- [x] 核验 FlashAttention、DeepSeek-V2/V3.2/V4、Kimi Linear/K3 等六份论文原文,并建立长上下文研究账本。
|
||||||
- [x] 核验 Switch、ST-MoE、DeepSeekMoE、Loss-Free、V3、LatentMoE 与 K3 原文,并建立 MoE 研究账本。
|
- [x] 核验 Switch、ST-MoE、DeepSeekMoE、Loss-Free、V3、LatentMoE 与 K3 原文,并建立 MoE 研究账本。
|
||||||
@@ -241,11 +241,17 @@
|
|||||||
- [x] 第十八个 DeepSeek 交互实验将逐来源双输出、十边分歧图、29 单元设备切分与证据阶梯放到同一页;compact 构建器同时校验固定 revision、官方工件 hash 与 32 / 32 长复现合同。
|
- [x] 第十八个 DeepSeek 交互实验将逐来源双输出、十边分歧图、29 单元设备切分与证据阶梯放到同一页;compact 构建器同时校验固定 revision、官方工件 hash 与 32 / 32 长复现合同。
|
||||||
- [x] DeepSeek Chat 行为层本地闸门通过:75 个 Astro 文件零诊断,21 个页面、1,151 个站内引用、12 个跨页锚点零失败;十四页签桌面与 390px 移动端无运行时异常或文档级横向溢出,十六套真实 Chrome 专题回归全部通过。
|
- [x] DeepSeek Chat 行为层本地闸门通过:75 个 Astro 文件零诊断,21 个页面、1,151 个站内引用、12 个跨页锚点零失败;十四页签桌面与 390px 移动端无运行时异常或文档级横向溢出,十六套真实 Chrome 专题回归全部通过。
|
||||||
- [x] DeepSeek Chat 行为层以源提交 `96443d4`、不可变镜像 `20260729T144827Z-96443d4` 发布;OCI digest `sha256:9468b546…db214`,复用 NAS `12010→8080`、NPM host 31 / cert 41、门户 `LLM ATLAS / projects / 180`,HTTPS、HTTP/2 与十六套生产 Chrome 回归全通过;保留 `20260729T134520Z-1d0a331` 回滚。
|
- [x] DeepSeek Chat 行为层以源提交 `96443d4`、不可变镜像 `20260729T144827Z-96443d4` 发布;OCI digest `sha256:9468b546…db214`,复用 NAS `12010→8080`、NPM host 31 / cert 41、门户 `LLM ATLAS / projects / 180`,HTTPS、HTTP/2 与十六套生产 Chrome 回归全通过;保留 `20260729T134520Z-1d0a331` 回滚。
|
||||||
|
- [x] DeepSeek Round 05 预注册统一 512-token 预算,不选择性续写 97 个截断格;29 GiB formal OOM 发生在写 JSON 前,透明修订为 28 GiB static placement、GPU layers 0–23 + layers 24–26/norm/head offload,并以 29→28 GiB smoke 的 32 / 32 完整 token exact 闸门确认放置不改输出。
|
||||||
|
- [x] 512-token formal 对 128 / 128 prompt hashes 与前 128 generated-token prefixes 全部 exact;自然 EOS 从 31 / 128 增至 121 / 128,仍有 7 格截断。GSM8K strict-complete numeric exact 为 23 / 32;HumanEval 在 pinned、无网络、只读、无 host mount 的逐 candidate 容器中 24 / 32 通过官方 tests。
|
||||||
|
- [x] 512-token 新进程复跑覆盖每域第 1 条的 32 格,完整 generated token IDs、decoded text、EOS 与 truncation state 均 32 / 32 exact;不冒充 128 / 128 全覆盖。
|
||||||
|
- [x] 完成相同 Chat checkpoint 的 prompt-only 全深度 trace:embedding + 27 decoder layers + final norm 共 29 阶段,26 个 MoE gate;1,537 个精确 interior content tokens / condition 产生 1,918,176 次 target top-6 route decisions,56 个 boundary-crossing tokens 明确排除。
|
||||||
|
- [x] 全深度新进程复跑的 4 / 4 source objects(去 runtime 后)、1,856 / 1,856 hidden tensor hashes、1,664 / 1,664 ordered-route hashes 与 1,664 / 1,664 route-weight hashes 全部 exact;复现核对抓到并修正 source-level content-token hash 的循环变量缺陷,正式与复跑文件随后全部重跑。
|
||||||
|
- [x] 第十九个 DeepSeek 交互实验用四页签分开 128→512 completion、Math/Code evaluator、29-stage hidden divergence 与 26-gate route divergence;桌面、390px 移动端、键盘 tab、分域/分边/分指标交互与无横向溢出闸门通过。
|
||||||
|
|
||||||
## 正在进行
|
## 正在进行
|
||||||
|
|
||||||
- [ ] K3 三轮下一闸门:获得真实 token hidden states、expert load 与 cache traces,解释或修订 `A_log [128]` 工件冲突,再做 Figure 3/4/5 数值重绘和独立小模型复现。
|
- [ ] K3 三轮下一闸门:获得真实 token hidden states、expert load 与 cache traces,解释或修订 `A_log [128]` 工件冲突,再做 Figure 3/4/5 数值重绘和独立小模型复现。
|
||||||
- [ ] DeepSeek 四轮下一闸门:把 31 / 128 completion 提升为长度分层、可执行 evaluator 与更长生成预算;扩到完整 27 层并固定 batch content 审计,再推进 SM90 FlashMLA、FP8 / pipeline traces 与 R1-like RL 小模型复现。
|
- [ ] DeepSeek 五轮下一闸门:扩大 GSM8K/HumanEval 与语言 source 样本,加入 sampling robustness 和干预式 mediation;再推进 SM90 FlashMLA、FP8 / pipeline traces 与 R1-like RL 小模型复现。
|
||||||
- [ ] 表示、位置与残差二轮:真实 hidden-state / norm traces、长上下文位置外推复现与 mHC / AttnRes 深层稳定性消融。
|
- [ ] 表示、位置与残差二轮:真实 hidden-state / norm traces、长上下文位置外推复现与 mHC / AttnRes 深层稳定性消融。
|
||||||
- [ ] 评测安全二轮:真实 cross-harness / pass@k 复跑、Judge 元评测、动态污染与过拒案例。
|
- [ ] 评测安全二轮:真实 cross-harness / pass@k 复跑、Judge 元评测、动态污染与过拒案例。
|
||||||
- [ ] 推理服务二轮:真实 GPU kernel / workload traces、功耗与成本、跨 vLLM / SGLang / TensorRT-LLM 复现。
|
- [ ] 推理服务二轮:真实 GPU kernel / workload traces、功耗与成本、跨 vLLM / SGLang / TensorRT-LLM 复现。
|
||||||
@@ -404,6 +410,11 @@
|
|||||||
| 2026-07-29 | 生成实验把 completion 设为首要审计字段 | 31 / 128 自然 EOS 与 97 / 128 长度截断分开报告;截断输出不被当作完整答案参与越界判断 |
|
| 2026-07-29 | 生成实验把 completion 设为首要审计字段 | 31 / 128 自然 EOS 与 97 / 128 长度截断分开报告;截断输出不被当作完整答案参与越界判断 |
|
||||||
| 2026-07-29 | CPU offload 是执行拓扑而非模型属性 | 31.4 GB BF16 工件不因本机 25-GPU-layer / 2-CPU-layer 切分而改变模型身份;设备映射、参数字节与峰值显存都进入复现合同 |
|
| 2026-07-29 | CPU offload 是执行拓扑而非模型属性 | 31.4 GB BF16 工件不因本机 25-GPU-layer / 2-CPU-layer 切分而改变模型身份;设备映射、参数字节与峰值显存都进入复现合同 |
|
||||||
| 2026-07-29 | DeepSeek Chat 行为层以 `20260729T144827Z-96443d4` 发布 | OCI digest `sha256:9468b546…db214`;复用 NAS 12010→8080、NPM 31 / cert 41、门户 order 180;十六套生产 Chrome 回归通过,保留上一不可变镜像回滚 |
|
| 2026-07-29 | DeepSeek Chat 行为层以 `20260729T144827Z-96443d4` 发布 | OCI digest `sha256:9468b546…db214`;复用 NAS 12010→8080、NPM 31 / cert 41、门户 order 180;十六套生产 Chrome 回归通过,保留上一不可变镜像回滚 |
|
||||||
|
| 2026-07-29 | 更长预算必须统一重跑全部条件 | 不只续写先前截断格;128→512 的 128 / 128 prompt 与 generated-prefix exact 进入正式结果闸门 |
|
||||||
|
| 2026-07-29 | 停止、任务终点、可评测与正确分四张账 | 自然 EOS 不等于正确;fallback 不冒充 strict completion;HumanEval tests pass 不冒充代码安全 |
|
||||||
|
| 2026-07-29 | 全深度目标范围排除 boundary-crossing tokens | 八格目标内容先验证 token IDs exact,再比较 1,537 个完全位于字符区间内部的 tokens;56 个相交 token 明确剔除 |
|
||||||
|
| 2026-07-29 | hidden/router association 不升级为 mediation | 29-stage 表示曲线与 26-gate route 曲线描述传播路径;没有干预式中介实验前不解释能力因果 |
|
||||||
|
| 2026-07-29 | 复跑逐字段覆盖身份元数据 | source-level hash 的循环变量缺陷虽不影响激活/路由结论,仍修复并重跑正式与复现文件;不只比较 headline 数字 |
|
||||||
| 2026-07-29 | K3 二轮按 32 张对象账与完整报告顺序重建 | total/active、2.5×、KDA state、深度来源、专家路由、视觉目标、轨迹、缓存与评测协议不再压成一页组件摘要 |
|
| 2026-07-29 | K3 二轮按 32 张对象账与完整报告顺序重建 | total/active、2.5×、KDA state、深度来源、专家路由、视觉目标、轨迹、缓存与评测协议不再压成一页组件摘要 |
|
||||||
| 2026-07-29 | K3 原生视觉事实回到 §2.4 / §3.3 核验 | 删除“先冻结语言模型再解冻”旧表述;明确 MoonViT-V2 从头训练,视觉/文本从开始共同 NTP |
|
| 2026-07-29 | K3 原生视觉事实回到 §2.4 / §3.3 核验 | 删除“先冻结语言模型再解冻”旧表述;明确 MoonViT-V2 从头训练,视觉/文本从开始共同 NTP |
|
||||||
| 2026-07-29 | K3 Figure 1–16 / Table 1–5 全部建立课程视觉契约 | 每张图同时写支持范围与不可外推项;作者报告、论文、推导与 toy model 使用 R/P/D/T 标签 |
|
| 2026-07-29 | K3 Figure 1–16 / Table 1–5 全部建立课程视觉契约 | 每张图同时写支持范围与不可外推项;作者报告、论文、推导与 toy model 使用 R/P/D/T 标签 |
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
当前里程碑包含 17 专题学习地图、486 篇关键论文索引、Kimi K3 完整导读,
|
当前里程碑包含 17 专题学习地图、486 篇关键论文索引、Kimi K3 完整导读,
|
||||||
语言模型前史、Transformer 基础、表示/位置/残差、DeepSeek 技术谱系、Scaling Laws、数据工程、长上下文、MoE、指令微调与人类偏好、推理、工具使用与长程 Agent、原生多模态、训练系统、推理服务、数值优化,以及评测与安全深度专题,
|
语言模型前史、Transformer 基础、表示/位置/残差、DeepSeek 技术谱系、Scaling Laws、数据工程、长上下文、MoE、指令微调与人类偏好、推理、工具使用与长程 Agent、原生多模态、训练系统、推理服务、数值优化,以及评测与安全深度专题,
|
||||||
以及 85 个覆盖核心机制的原创交互视图。K3 二轮导读以 32 张问题账、16 图 / 5 表审计、
|
以及 86 个覆盖核心机制的原创交互视图。K3 二轮导读以 32 张问题账、16 图 / 5 表审计、
|
||||||
8 个交互实验和 100 个一手/官方节点,完整覆盖架构、预训练、后训练、系统、评测、案例与附录。
|
8 个交互实验和 100 个一手/官方节点,完整覆盖架构、预训练、后训练、系统、评测、案例与附录。
|
||||||
第三轮已完成开放工件与首个真实 kernel 里程碑:固定官方模型与 FlashKDA revisions,审计 96 个 checkpoint shards、
|
第三轮已完成开放工件与首个真实 kernel 里程碑:固定官方模型与 FlashKDA revisions,审计 96 个 checkpoint shards、
|
||||||
497,220 个 tensor entries、真实 KDA / MLA / MoE / MoonViT shapes 与小范围参数统计,并用 4 个新视图
|
497,220 个 tensor entries、真实 KDA / MLA / MoE / MoonViT shapes 与小范围参数统计,并用 4 个新视图
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
`sm_120a` wheel,在 RTX 5090 上完成 6/6 官方参考 exact-match 和 K3 fixed / varlen 形状计时。详见
|
`sm_120a` wheel,在 RTX 5090 上完成 6/6 官方参考 exact-match 和 K3 fixed / varlen 形状计时。详见
|
||||||
[K3_ARTIFACT_AUDIT.md](./research/K3_ARTIFACT_AUDIT.md) 与
|
[K3_ARTIFACT_AUDIT.md](./research/K3_ARTIFACT_AUDIT.md) 与
|
||||||
[checkpoint_probe.py](./experiments/k3/checkpoint_probe.py)、[FlashKDA probe](./experiments/k3/flashkda/)。
|
[checkpoint_probe.py](./experiments/k3/checkpoint_probe.py)、[FlashKDA probe](./experiments/k3/flashkda/)。
|
||||||
DeepSeek 四轮专题以 24 张问题账、10 次技术转向、
|
DeepSeek 五轮专题以 24 张问题账、10 次技术转向、
|
||||||
18 个交互实验和 60 个一手/官方节点,串起 Dense、MoE、MLA、V3 协同、R1 与 V4;
|
19 个交互实验和 60 个一手/官方节点,串起 Dense、MoE、MLA、V3 协同、R1 与 V4;
|
||||||
并固定官方 V2-Lite revision,在 RTX 5090 上连续执行 7/27 层,记录 3,240 次真实专家选择、
|
并固定官方 V2-Lite revision,在 RTX 5090 上连续执行 7/27 层,记录 3,240 次真实专家选择、
|
||||||
MLA/HF eager cache shapes 与 `31/31` exact 独立复跑;进一步用真实 layer-1 权重执行官方 V3
|
MLA/HF eager cache shapes 与 `31/31` exact 独立复跑;进一步用真实 layer-1 权重执行官方 V3
|
||||||
naive/absorb 路径,实际写入 576 元素 latent cache,并以 FP32 将两种结合顺序的最大误差压到
|
naive/absorb 路径,实际写入 576 元素 latent cache,并以 FP32 将两种结合顺序的最大误差压到
|
||||||
@@ -64,7 +64,15 @@ Round 04 又固定官方 `DeepSeek-V2-Lite-Chat` revision,加载 31.4 GB 完
|
|||||||
边界条件,共 128 个 greedy 输出;四域中 31 个自然命中 EOS、97 个在 128 新 token
|
边界条件,共 128 个 greedy 输出;四域中 31 个自然命中 EOS、97 个在 128 新 token
|
||||||
上限处截断,因此只把十条成对边写成“生成分歧”,不把它们冒充能力评测。每域独立抽取
|
上限处截断,因此只把十条成对边写成“生成分歧”,不把它们冒充能力评测。每域独立抽取
|
||||||
1 个来源的 32 个输出再次运行,prompt hash、生成 token IDs、文本与 EOS 状态均为
|
1 个来源的 32 个输出再次运行,prompt hash、生成 token IDs、文本与 EOS 状态均为
|
||||||
`32 / 32` exact。FlashMLA 的 SM90/SM100 官方支持矩阵与本机 SM120 边界单独记账。详见
|
`32 / 32` exact。FlashMLA 的 SM90/SM100 官方支持矩阵与本机 SM120 边界单独记账。
|
||||||
|
Round 05 再让全部 128 格统一使用 512-token 预算:自然 EOS 从 `31 / 128` 提升到
|
||||||
|
`121 / 128`,剩余 7 格仍按截断处理;GSM8K 严格完成且数值 exact 为 `23 / 32`,
|
||||||
|
HumanEval 官方 tests pass 为 `24 / 32`,四任务/域不外推为 benchmark。相同 Chat
|
||||||
|
checkpoint 又执行 embedding、27 层、final norm 与 26 个 MoE gate 的 prompt-only
|
||||||
|
全深度 trace,在 1,537 个精确 interior content tokens / condition 上记录
|
||||||
|
1,918,176 次 top-6 路由决定。新进程子集复跑达到 `1,856 / 1,856` hidden tensor hashes、
|
||||||
|
`1,664 / 1,664` ordered route hashes 与 `1,664 / 1,664` route-weight hashes exact。
|
||||||
|
详见
|
||||||
[DEEPSEEK_V2_LITE_TRACE.md](./research/DEEPSEEK_V2_LITE_TRACE.md) 与
|
[DEEPSEEK_V2_LITE_TRACE.md](./research/DEEPSEEK_V2_LITE_TRACE.md) 与
|
||||||
[DEEPSEEK_MLA_ABSORB_AUDIT.md](./research/DEEPSEEK_MLA_ABSORB_AUDIT.md)、
|
[DEEPSEEK_MLA_ABSORB_AUDIT.md](./research/DEEPSEEK_MLA_ABSORB_AUDIT.md)、
|
||||||
[DEEPSEEK_ROUTING_CORPUS_AUDIT.md](./research/DEEPSEEK_ROUTING_CORPUS_AUDIT.md)、
|
[DEEPSEEK_ROUTING_CORPUS_AUDIT.md](./research/DEEPSEEK_ROUTING_CORPUS_AUDIT.md)、
|
||||||
@@ -76,7 +84,8 @@ Round 04 又固定官方 `DeepSeek-V2-Lite-Chat` revision,加载 31.4 GB 完
|
|||||||
[DEEPSEEK_ROUTING_ROLE_MARKER_HEAD_AUDIT.md](./research/DEEPSEEK_ROUTING_ROLE_MARKER_HEAD_AUDIT.md)、
|
[DEEPSEEK_ROUTING_ROLE_MARKER_HEAD_AUDIT.md](./research/DEEPSEEK_ROUTING_ROLE_MARKER_HEAD_AUDIT.md)、
|
||||||
[DEEPSEEK_ROUTING_SPECIAL_TOKEN_FAMILY_AUDIT.md](./research/DEEPSEEK_ROUTING_SPECIAL_TOKEN_FAMILY_AUDIT.md) 与
|
[DEEPSEEK_ROUTING_SPECIAL_TOKEN_FAMILY_AUDIT.md](./research/DEEPSEEK_ROUTING_SPECIAL_TOKEN_FAMILY_AUDIT.md) 与
|
||||||
[DEEPSEEK_ROUTING_ROLE_MARKER_BLOCK_AUDIT.md](./research/DEEPSEEK_ROUTING_ROLE_MARKER_BLOCK_AUDIT.md),以及
|
[DEEPSEEK_ROUTING_ROLE_MARKER_BLOCK_AUDIT.md](./research/DEEPSEEK_ROUTING_ROLE_MARKER_BLOCK_AUDIT.md),以及
|
||||||
[DEEPSEEK_V2_LITE_CHAT_BEHAVIOR_AUDIT.md](./research/DEEPSEEK_V2_LITE_CHAT_BEHAVIOR_AUDIT.md)。
|
[DEEPSEEK_V2_LITE_CHAT_BEHAVIOR_AUDIT.md](./research/DEEPSEEK_V2_LITE_CHAT_BEHAVIOR_AUDIT.md) 与
|
||||||
|
[DEEPSEEK_V2_LITE_CHAT_COMPLETION_DEPTH_AUDIT.md](./research/DEEPSEEK_V2_LITE_CHAT_COMPLETION_DEPTH_AUDIT.md)。
|
||||||
其余专题按进度账本持续扩建。
|
其余专题按进度账本持续扩建。
|
||||||
|
|
||||||
## 本地开发
|
## 本地开发
|
||||||
|
|||||||
+5
-3
@@ -100,10 +100,12 @@ SFT / RM / PPO / DPO / RLAIF / RLVR 的角色合同,重点追踪 DeepSeek LLM
|
|||||||
|
|
||||||
CoT、自洽性、搜索、验证器、过程奖励、GRPO、DeepSeekMath、DeepSeek-R1/R1-Zero、Kimi k1.5、multi-effort RL 与 on-policy distillation。
|
CoT、自洽性、搜索、验证器、过程奖励、GRPO、DeepSeekMath、DeepSeek-R1/R1-Zero、Kimi k1.5、multi-effort RL 与 on-policy distillation。
|
||||||
|
|
||||||
DeepSeek 聚光二轮已完成:以 24 张问题账和 10 次问题转向,串起 DeepSeek LLM、DeepSeekMoE、
|
DeepSeek 聚光五轮持续推进:以 24 张问题账和 10 次问题转向,串起 DeepSeek LLM、DeepSeekMoE、
|
||||||
DeepSeekMath、V2、V3、R1-Zero/R1、V3.2 与 V4;DAPO / Dr.GRPO 明确作为公开后续反查,
|
DeepSeekMath、V2、V3、R1-Zero/R1、V3.2 与 V4;DAPO / Dr.GRPO 明确作为公开后续反查,
|
||||||
Coder/Prover/VL/OCR/系统实现/Engram 作为旁支。配套稀疏容量、MLA 缓存、V3 协同与 RL 偏差四个实验,
|
Coder/Prover/VL/OCR/系统实现/Engram 作为旁支。配套稀疏容量、MLA 缓存、V3 协同与 RL 偏差四个实验,
|
||||||
并以 60 个一手论文或官方仓库节点连接 Kimi K2/K3。
|
并以 60 个一手论文或官方仓库节点连接 Kimi K2/K3;真实权重线已从 Base 前七层、吸收缓存和
|
||||||
|
11,289,744 次公开语料路由,推进到完整 Chat 生成、统一 512-token completion evaluator、
|
||||||
|
29-stage hidden-state 与 26-gate router trace。
|
||||||
|
|
||||||
### 12. 工具使用与长程 Agent
|
### 12. 工具使用与长程 Agent
|
||||||
|
|
||||||
@@ -156,7 +158,7 @@ pass^k、校准、动态基准、代码 Verifier、LLM Judge、Arena、Agent 最
|
|||||||
1. **Kimi K3 解剖**:二轮已完成 32 张问题账、Figure 1–16 / Table 1–5 审计、
|
1. **Kimi K3 解剖**:二轮已完成 32 张问题账、Figure 1–16 / Table 1–5 审计、
|
||||||
8 个报告实验与 100 节点阅读链;三轮首个里程碑进一步固定官方 revisions,审计 96 个 checkpoint shards、
|
8 个报告实验与 100 节点阅读链;三轮首个里程碑进一步固定官方 revisions,审计 96 个 checkpoint shards、
|
||||||
497,220 个 tensor entries、真实 KDA / MLA / MoE / MoonViT shapes,并用 4 个工件视图公开复现边界。
|
497,220 个 tensor entries、真实 KDA / MLA / MoE / MoonViT shapes,并用 4 个工件视图公开复现边界。
|
||||||
2. **DeepSeek 技术谱系**:DeepSeek LLM → DeepSeekMoE → V2/MLA → V3/FP8/MTP/DualPipe → Math/GRPO → R1 → V3.2/DSA → V4 长上下文;四轮已经从 24 张问题账、60 个一手/官方节点和 4 个公式实验,推进到 13 个 Base 工件实验与 1 个完整 Chat 行为实验。最新生成层固定 31.4 GB 官方 V2-Lite-Chat BF16 权重,以 16 个来源 × 8 条件得到 128 个输出,并把自然 EOS、长度截断、成对分歧和 32 / 32 独立复现分账。
|
2. **DeepSeek 技术谱系**:DeepSeek LLM → DeepSeekMoE → V2/MLA → V3/FP8/MTP/DualPipe → Math/GRPO → R1 → V3.2/DSA → V4 长上下文;五轮已经从 24 张问题账、60 个一手/官方节点和 4 个公式实验,推进到 13 个 Base 工件实验、完整 Chat 行为与 completion/full-depth 实验。最新一轮让 16 个来源 × 8 条件统一使用 512-token 预算,分开报告 121 / 128 自然 EOS、Math/Code evaluator 与 32 / 32 长序列复现;同一 checkpoint 的 29-stage hidden / 26-gate route trace 覆盖 1,918,176 次目标路由决定,并以 5,184 个新进程哈希 exact 收口。
|
||||||
3. **“一个 Token 的旅行”**:从文本分词,经注意力、MoE、GPU 集群、后训练,再到线上推理与工具调用。
|
3. **“一个 Token 的旅行”**:从文本分词,经注意力、MoE、GPU 集群、后训练,再到线上推理与工具调用。
|
||||||
|
|
||||||
## 完成标准
|
## 完成标准
|
||||||
|
|||||||
@@ -586,3 +586,89 @@ See `research/DEEPSEEK_V2_LITE_CHAT_BEHAVIOR_PROTOCOL.md` and
|
|||||||
`research/DEEPSEEK_V2_LITE_CHAT_BEHAVIOR_AUDIT.md` for the preregistered
|
`research/DEEPSEEK_V2_LITE_CHAT_BEHAVIOR_AUDIT.md` for the preregistered
|
||||||
contract, output-divergence table, offload device map, truncation boundary,
|
contract, output-divergence table, offload device map, truncation boundary,
|
||||||
rerun coverage, execution fixes, primary sources, and forbidden conclusions.
|
rerun coverage, execution fixes, primary sources, and forbidden conclusions.
|
||||||
|
|
||||||
|
## Completion-aware 512-token evaluation
|
||||||
|
|
||||||
|
The completion run uses the same 16 sources and eight-condition batches but
|
||||||
|
reruns all 128 cells with one uniform 512-token budget. The successful formal
|
||||||
|
placement leaves embeddings and layers 0–23 on CUDA and offloads layers 24–26,
|
||||||
|
final norm, and LM head. `expandable_segments:True` is part of the recorded
|
||||||
|
runtime contract.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
|
||||||
|
PYTHONPATH=/path/to/transformers-4.41.2-deps \
|
||||||
|
python -B experiments/deepseek/v2_lite_chat_special_token_behavior_probe.py \
|
||||||
|
--artifact-dir /path/to/deepseek-v2-lite-chat \
|
||||||
|
--reference-routing-json \
|
||||||
|
src/data/deepseek-v2-lite-routing-special-token-family-control.json \
|
||||||
|
--human-eval /path/to/HumanEval.jsonl.gz \
|
||||||
|
--gsm8k /path/to/gsm8k/test.jsonl \
|
||||||
|
--tnews /path/to/tnews/test.json \
|
||||||
|
--tnews-archive /path/to/tnews_public.zip \
|
||||||
|
--wikitext /path/to/wikitext-validation.parquet \
|
||||||
|
--output src/data/deepseek-v2-lite-chat-completion-512.json \
|
||||||
|
--per-domain 4 \
|
||||||
|
--max-new-tokens 512 \
|
||||||
|
--gpu-memory 28GiB \
|
||||||
|
--cpu-memory 80GiB
|
||||||
|
```
|
||||||
|
|
||||||
|
The evaluator separates stopping, semantic terminal state, evaluator coverage,
|
||||||
|
and correctness. Each HumanEval candidate runs in a fresh pinned, networkless,
|
||||||
|
read-only Docker container with no host mounts:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -B experiments/deepseek/v2_lite_chat_completion_evaluator.py \
|
||||||
|
--behavior-json \
|
||||||
|
src/data/deepseek-v2-lite-chat-completion-512.json \
|
||||||
|
--baseline-json src/data/deepseek-v2-lite-chat-behavior.json \
|
||||||
|
--human-eval /path/to/HumanEval.jsonl.gz \
|
||||||
|
--gsm8k /path/to/gsm8k/test.jsonl \
|
||||||
|
--sandbox-image \
|
||||||
|
python:3.11-alpine@sha256:25976e9d34a0fab1f278cae931f34c8303d97bf0c0d7f85b6b4dcf641d7702a4 \
|
||||||
|
--output \
|
||||||
|
src/data/deepseek-v2-lite-chat-completion-512-eval.json
|
||||||
|
```
|
||||||
|
|
||||||
|
The formal run reaches natural EOS in 121/128 cells, up from 31/128 at the
|
||||||
|
128-token budget. Strict-complete GSM8K numeric exact is 23/32; HumanEval
|
||||||
|
official-test pass is 24/32. These are four source tasks per domain, not
|
||||||
|
benchmark estimates. A fresh-process one-source-per-domain rerun reproduces
|
||||||
|
all 32 complete generated token sequences.
|
||||||
|
|
||||||
|
## Full 27-layer Chat hidden-state and router trace
|
||||||
|
|
||||||
|
`v2_lite_chat_full_depth_trace.py` performs a prompt-only `use_cache=False`
|
||||||
|
forward on the same checkpoint and inputs. It captures hashes and statistics
|
||||||
|
for embedding, every decoder-layer output, final norm, and every MoE gate.
|
||||||
|
Boundary-crossing tokenizer tokens are excluded from the exact target-content
|
||||||
|
scope.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
|
||||||
|
PYTHONPATH=/path/to/transformers-4.41.2-deps \
|
||||||
|
python -B experiments/deepseek/v2_lite_chat_full_depth_trace.py \
|
||||||
|
--artifact-dir /path/to/deepseek-v2-lite-chat \
|
||||||
|
--reference-routing-json \
|
||||||
|
src/data/deepseek-v2-lite-routing-special-token-family-control.json \
|
||||||
|
--human-eval /path/to/HumanEval.jsonl.gz \
|
||||||
|
--gsm8k /path/to/gsm8k/test.jsonl \
|
||||||
|
--tnews /path/to/tnews/test.json \
|
||||||
|
--tnews-archive /path/to/tnews_public.zip \
|
||||||
|
--wikitext /path/to/wikitext-validation.parquet \
|
||||||
|
--output src/data/deepseek-v2-lite-chat-full-depth.json \
|
||||||
|
--per-domain 4 \
|
||||||
|
--gpu-memory 28GiB \
|
||||||
|
--cpu-memory 80GiB
|
||||||
|
```
|
||||||
|
|
||||||
|
The formal trace covers 1,537 exact interior content tokens per condition,
|
||||||
|
29 hidden stages, 26 gates, and 1,918,176 top-6 route decisions. A fresh
|
||||||
|
four-source rerun reproduces 1,856 hidden tensor hashes, 1,664 ordered route
|
||||||
|
hashes, 1,664 route-weight hashes, and every derived comparison.
|
||||||
|
|
||||||
|
See `research/DEEPSEEK_V2_LITE_CHAT_COMPLETION_PROTOCOL.md` and
|
||||||
|
`research/DEEPSEEK_V2_LITE_CHAT_COMPLETION_DEPTH_AUDIT.md` for the OOM
|
||||||
|
amendment, task evaluators, completion table, depth curves, reproduction
|
||||||
|
audit, artifact hashes, and claim boundaries.
|
||||||
|
|||||||
@@ -0,0 +1,701 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Evaluate completion state, GSM8K answers, and HumanEval code safely.
|
||||||
|
|
||||||
|
The input is a raw JSON emitted by
|
||||||
|
v2_lite_chat_special_token_behavior_probe.py. Generated code is executed only
|
||||||
|
inside one fresh, networkless, read-only Docker container per candidate. The
|
||||||
|
result preserves fixed-budget and strict-completion metrics separately.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import ast
|
||||||
|
import gzip
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
from collections import Counter
|
||||||
|
from decimal import Decimal, InvalidOperation
|
||||||
|
from pathlib import Path
|
||||||
|
from statistics import mean
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
|
NUMBER = r"[-+]?(?:\d[\d,]*\.?\d*|\.\d+)"
|
||||||
|
NUMBER_PATTERN = re.compile(NUMBER)
|
||||||
|
BOXED_PATTERN = re.compile(
|
||||||
|
rf"\\boxed\s*\{{\s*({NUMBER})\s*\}}",
|
||||||
|
flags=re.IGNORECASE,
|
||||||
|
)
|
||||||
|
HASH_PATTERN = re.compile(
|
||||||
|
rf"####\s*({NUMBER})",
|
||||||
|
flags=re.IGNORECASE,
|
||||||
|
)
|
||||||
|
ANSWER_PATTERN = re.compile(
|
||||||
|
rf"(?:final\s+answer|answer|result|total|profit)"
|
||||||
|
rf"(?:\s+(?:is|equals|will\s+be))?\s*[:=]?\s*"
|
||||||
|
rf"(?:\$|USD\s*)?({NUMBER})",
|
||||||
|
flags=re.IGNORECASE,
|
||||||
|
)
|
||||||
|
FENCE_PATTERN = re.compile(
|
||||||
|
r"```(?P<lang>[A-Za-z0-9_+-]*)[ \t]*\n?"
|
||||||
|
r"(?P<body>.*?)(?:```|$)",
|
||||||
|
flags=re.DOTALL,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args() -> argparse.Namespace:
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("--behavior-json", type=Path, required=True)
|
||||||
|
parser.add_argument("--baseline-json", type=Path)
|
||||||
|
parser.add_argument("--human-eval", type=Path, required=True)
|
||||||
|
parser.add_argument("--gsm8k", type=Path, required=True)
|
||||||
|
parser.add_argument("--output", type=Path, required=True)
|
||||||
|
parser.add_argument(
|
||||||
|
"--sandbox-image",
|
||||||
|
required=True,
|
||||||
|
help="Pinned image reference including @sha256 digest.",
|
||||||
|
)
|
||||||
|
parser.add_argument("--timeout-seconds", type=float, default=5.0)
|
||||||
|
parser.add_argument("--skip-code-execution", action="store_true")
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def sha256_bytes(payload: bytes) -> str:
|
||||||
|
return hashlib.sha256(payload).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def sha256_file(path: Path) -> str:
|
||||||
|
digest = hashlib.sha256()
|
||||||
|
with path.open("rb") as handle:
|
||||||
|
while chunk := handle.read(16 * 1024 * 1024):
|
||||||
|
digest.update(chunk)
|
||||||
|
return digest.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def canonical_hash(value: Any) -> str:
|
||||||
|
return sha256_bytes(
|
||||||
|
json.dumps(
|
||||||
|
value,
|
||||||
|
ensure_ascii=False,
|
||||||
|
sort_keys=True,
|
||||||
|
separators=(",", ":"),
|
||||||
|
).encode()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def load_jsonl(path: Path) -> list[dict[str, Any]]:
|
||||||
|
with path.open(encoding="utf-8") as handle:
|
||||||
|
return [json.loads(line) for line in handle if line.strip()]
|
||||||
|
|
||||||
|
|
||||||
|
def load_tasks(
|
||||||
|
human_eval_path: Path,
|
||||||
|
gsm8k_path: Path,
|
||||||
|
) -> tuple[dict[str, dict[str, Any]], dict[str, dict[str, Any]]]:
|
||||||
|
with gzip.open(human_eval_path, "rt", encoding="utf-8") as handle:
|
||||||
|
human_eval = {
|
||||||
|
row["task_id"]: row
|
||||||
|
for line in handle
|
||||||
|
if line.strip()
|
||||||
|
for row in [json.loads(line)]
|
||||||
|
}
|
||||||
|
gsm8k = {
|
||||||
|
f"gsm8k/test/{index:04d}": row
|
||||||
|
for index, row in enumerate(load_jsonl(gsm8k_path))
|
||||||
|
}
|
||||||
|
return human_eval, gsm8k
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_number(value: str | None) -> str | None:
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
|
cleaned = value.replace(",", "").strip().rstrip(".")
|
||||||
|
try:
|
||||||
|
number = Decimal(cleaned)
|
||||||
|
except InvalidOperation:
|
||||||
|
return None
|
||||||
|
normalized = format(number.normalize(), "f")
|
||||||
|
if "." in normalized:
|
||||||
|
normalized = normalized.rstrip("0").rstrip(".")
|
||||||
|
return "0" if normalized in {"-0", "+0"} else normalized
|
||||||
|
|
||||||
|
|
||||||
|
def last_match(
|
||||||
|
pattern: re.Pattern[str],
|
||||||
|
text: str,
|
||||||
|
) -> str | None:
|
||||||
|
matches = list(pattern.finditer(text))
|
||||||
|
return matches[-1].group(1) if matches else None
|
||||||
|
|
||||||
|
|
||||||
|
def evaluate_math(
|
||||||
|
text: str,
|
||||||
|
hit_eos: bool,
|
||||||
|
gold_answer: str,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
candidates = [
|
||||||
|
("boxed", last_match(BOXED_PATTERN, text)),
|
||||||
|
("hash_marker", last_match(HASH_PATTERN, text)),
|
||||||
|
("answer_phrase", last_match(ANSWER_PATTERN, text)),
|
||||||
|
]
|
||||||
|
method = "none"
|
||||||
|
extracted = None
|
||||||
|
for name, value in candidates:
|
||||||
|
if value is not None:
|
||||||
|
method = name
|
||||||
|
extracted = value
|
||||||
|
break
|
||||||
|
explicit_terminal = extracted is not None
|
||||||
|
if extracted is None:
|
||||||
|
values = NUMBER_PATTERN.findall(text)
|
||||||
|
if values:
|
||||||
|
method = "last_number_fallback"
|
||||||
|
extracted = values[-1]
|
||||||
|
|
||||||
|
gold_values = NUMBER_PATTERN.findall(
|
||||||
|
gold_answer.rsplit("####", 1)[-1]
|
||||||
|
)
|
||||||
|
gold = normalize_number(gold_values[-1] if gold_values else None)
|
||||||
|
predicted = normalize_number(extracted)
|
||||||
|
fixed_budget_exact = (
|
||||||
|
gold is not None
|
||||||
|
and predicted is not None
|
||||||
|
and gold == predicted
|
||||||
|
)
|
||||||
|
semantic_terminal = bool(hit_eos or explicit_terminal)
|
||||||
|
return {
|
||||||
|
"gold_final": gold,
|
||||||
|
"predicted_final": predicted,
|
||||||
|
"extraction_method": method,
|
||||||
|
"explicit_final_marker": explicit_terminal,
|
||||||
|
"semantic_terminal": semantic_terminal,
|
||||||
|
"evaluator_covered": predicted is not None,
|
||||||
|
"fixed_budget_numeric_exact": fixed_budget_exact,
|
||||||
|
"strict_complete_numeric_exact": (
|
||||||
|
fixed_budget_exact and semantic_terminal
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def code_fences(text: str) -> list[dict[str, str | bool]]:
|
||||||
|
rows = []
|
||||||
|
for match in FENCE_PATTERN.finditer(text):
|
||||||
|
language = match.group("lang").lower()
|
||||||
|
body = match.group("body").strip()
|
||||||
|
rows.append(
|
||||||
|
{
|
||||||
|
"language": language,
|
||||||
|
"body": body,
|
||||||
|
"closed": text[match.start():match.end()].rstrip().endswith(
|
||||||
|
"```"
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return rows
|
||||||
|
|
||||||
|
|
||||||
|
def extract_code(
|
||||||
|
text: str,
|
||||||
|
prompt: str,
|
||||||
|
entry_point: str,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
target = re.compile(
|
||||||
|
rf"(?m)^\s*(?:async\s+)?def\s+{re.escape(entry_point)}\s*\("
|
||||||
|
)
|
||||||
|
fences = code_fences(text)
|
||||||
|
chosen = next(
|
||||||
|
(
|
||||||
|
row for row in fences
|
||||||
|
if target.search(str(row["body"]))
|
||||||
|
and row["language"] in {"", "py", "python", "python3"}
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
if chosen is None:
|
||||||
|
chosen = next(
|
||||||
|
(
|
||||||
|
row for row in fences
|
||||||
|
if row["language"] in {"", "py", "python", "python3"}
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
|
||||||
|
if chosen is not None:
|
||||||
|
raw = str(chosen["body"])
|
||||||
|
mode = "fenced"
|
||||||
|
fence_closed = bool(chosen["closed"])
|
||||||
|
else:
|
||||||
|
match = target.search(text)
|
||||||
|
if match:
|
||||||
|
raw = text[match.start():].strip()
|
||||||
|
mode = "direct_definition"
|
||||||
|
else:
|
||||||
|
raw = text.strip()
|
||||||
|
mode = "prompt_completion"
|
||||||
|
fence_closed = False
|
||||||
|
|
||||||
|
contains_entry_point = target.search(raw) is not None
|
||||||
|
candidate = raw if contains_entry_point else prompt + raw
|
||||||
|
try:
|
||||||
|
ast.parse(candidate)
|
||||||
|
ast_ok = True
|
||||||
|
ast_error = None
|
||||||
|
except SyntaxError as error:
|
||||||
|
ast_ok = False
|
||||||
|
ast_error = {
|
||||||
|
"line": error.lineno,
|
||||||
|
"offset": error.offset,
|
||||||
|
"type": type(error).__name__,
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"candidate": candidate,
|
||||||
|
"candidate_sha256": sha256_bytes(candidate.encode()),
|
||||||
|
"extraction_mode": mode,
|
||||||
|
"contains_entry_point_definition": contains_entry_point,
|
||||||
|
"closed_code_fence": fence_closed,
|
||||||
|
"python_ast_parse": ast_ok,
|
||||||
|
"parse_error": ast_error,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def sandbox_harness(
|
||||||
|
candidate: str,
|
||||||
|
test: str,
|
||||||
|
entry_point: str,
|
||||||
|
) -> str:
|
||||||
|
return (
|
||||||
|
"import sys\n"
|
||||||
|
"try:\n"
|
||||||
|
+ "\n".join(
|
||||||
|
f" {line}" if line else ""
|
||||||
|
for line in candidate.splitlines()
|
||||||
|
)
|
||||||
|
+ "\n"
|
||||||
|
+ "\n".join(
|
||||||
|
f" {line}" if line else ""
|
||||||
|
for line in test.splitlines()
|
||||||
|
)
|
||||||
|
+ f"\n check({entry_point})\n"
|
||||||
|
+ "except AssertionError:\n"
|
||||||
|
+ " raise SystemExit(10)\n"
|
||||||
|
+ "except BaseException:\n"
|
||||||
|
+ " raise SystemExit(11)\n"
|
||||||
|
+ "raise SystemExit(0)\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def execute_code(
|
||||||
|
candidate: str,
|
||||||
|
task: dict[str, Any],
|
||||||
|
image: str,
|
||||||
|
timeout_seconds: float,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
harness = sandbox_harness(
|
||||||
|
candidate,
|
||||||
|
task["test"],
|
||||||
|
task["entry_point"],
|
||||||
|
)
|
||||||
|
command = [
|
||||||
|
"docker",
|
||||||
|
"run",
|
||||||
|
"--rm",
|
||||||
|
"-i",
|
||||||
|
"--network",
|
||||||
|
"none",
|
||||||
|
"--read-only",
|
||||||
|
"--tmpfs",
|
||||||
|
"/tmp:rw,noexec,nosuid,size=16m",
|
||||||
|
"--memory",
|
||||||
|
"256m",
|
||||||
|
"--memory-swap",
|
||||||
|
"256m",
|
||||||
|
"--pids-limit",
|
||||||
|
"64",
|
||||||
|
"--cpus",
|
||||||
|
"0.5",
|
||||||
|
"--cap-drop",
|
||||||
|
"ALL",
|
||||||
|
"--security-opt",
|
||||||
|
"no-new-privileges",
|
||||||
|
"--user",
|
||||||
|
"65534:65534",
|
||||||
|
image,
|
||||||
|
"python",
|
||||||
|
"-I",
|
||||||
|
"-",
|
||||||
|
]
|
||||||
|
started = time.perf_counter()
|
||||||
|
try:
|
||||||
|
completed = subprocess.run(
|
||||||
|
command,
|
||||||
|
input=harness.encode(),
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
timeout=timeout_seconds,
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
return {
|
||||||
|
"status": "timeout",
|
||||||
|
"return_code": None,
|
||||||
|
"runtime_ms": (time.perf_counter() - started) * 1000,
|
||||||
|
"harness_sha256": sha256_bytes(harness.encode()),
|
||||||
|
}
|
||||||
|
runtime_ms = (time.perf_counter() - started) * 1000
|
||||||
|
statuses = {
|
||||||
|
0: "passed",
|
||||||
|
10: "assertion_failed",
|
||||||
|
11: "runtime_error",
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"status": statuses.get(
|
||||||
|
completed.returncode,
|
||||||
|
"sandbox_error",
|
||||||
|
),
|
||||||
|
"return_code": completed.returncode,
|
||||||
|
"runtime_ms": runtime_ms,
|
||||||
|
"harness_sha256": sha256_bytes(harness.encode()),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def evaluate_code(
|
||||||
|
text: str,
|
||||||
|
hit_eos: bool,
|
||||||
|
task: dict[str, Any],
|
||||||
|
image: str,
|
||||||
|
timeout_seconds: float,
|
||||||
|
skip_execution: bool,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
extracted = extract_code(
|
||||||
|
text,
|
||||||
|
task["prompt"],
|
||||||
|
task["entry_point"],
|
||||||
|
)
|
||||||
|
execution = {
|
||||||
|
"status": "not_run",
|
||||||
|
"return_code": None,
|
||||||
|
"runtime_ms": None,
|
||||||
|
"harness_sha256": None,
|
||||||
|
}
|
||||||
|
if extracted["python_ast_parse"] and not skip_execution:
|
||||||
|
execution = execute_code(
|
||||||
|
extracted["candidate"],
|
||||||
|
task,
|
||||||
|
image,
|
||||||
|
timeout_seconds,
|
||||||
|
)
|
||||||
|
passed = execution["status"] == "passed"
|
||||||
|
semantic_terminal = bool(
|
||||||
|
hit_eos
|
||||||
|
or extracted["closed_code_fence"]
|
||||||
|
or passed
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
key: value
|
||||||
|
for key, value in extracted.items()
|
||||||
|
if key != "candidate"
|
||||||
|
} | {
|
||||||
|
"semantic_terminal": semantic_terminal,
|
||||||
|
"evaluator_covered": (
|
||||||
|
extracted["python_ast_parse"]
|
||||||
|
and execution["status"] != "not_run"
|
||||||
|
),
|
||||||
|
"execution": execution,
|
||||||
|
"fixed_budget_tests_pass": passed,
|
||||||
|
"strict_complete_tests_pass": passed and semantic_terminal,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def completion_class(
|
||||||
|
output: dict[str, Any],
|
||||||
|
task_evaluation: dict[str, Any] | None,
|
||||||
|
) -> str:
|
||||||
|
if output["hit_eos"]:
|
||||||
|
return "NATURAL_EOS"
|
||||||
|
if (
|
||||||
|
task_evaluation is not None
|
||||||
|
and task_evaluation.get("semantic_terminal")
|
||||||
|
):
|
||||||
|
return "TASK_TERMINAL_BEFORE_EOS"
|
||||||
|
if output["stopped_at_max_new_tokens"]:
|
||||||
|
if (
|
||||||
|
task_evaluation is not None
|
||||||
|
and task_evaluation.get("extraction_method")
|
||||||
|
== "last_number_fallback"
|
||||||
|
):
|
||||||
|
return "BUDGET_TRUNCATED_WITH_FALLBACK_ONLY"
|
||||||
|
return "BUDGET_TRUNCATED_UNRESOLVED"
|
||||||
|
return "OTHER_STOP"
|
||||||
|
|
||||||
|
|
||||||
|
def baseline_index(
|
||||||
|
baseline: dict[str, Any] | None,
|
||||||
|
) -> dict[tuple[str, str], dict[str, Any]]:
|
||||||
|
if baseline is None:
|
||||||
|
return {}
|
||||||
|
return {
|
||||||
|
(source["id"], output["condition"]): output
|
||||||
|
for source in baseline["sources"]
|
||||||
|
for output in source["outputs"]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def prefix_audit(
|
||||||
|
source_id: str,
|
||||||
|
output: dict[str, Any],
|
||||||
|
baseline_rows: dict[tuple[str, str], dict[str, Any]],
|
||||||
|
) -> dict[str, Any] | None:
|
||||||
|
prior = baseline_rows.get((source_id, output["condition"]))
|
||||||
|
if prior is None:
|
||||||
|
return None
|
||||||
|
reference = prior["generated_token_ids"]
|
||||||
|
observed = output["generated_token_ids"][: len(reference)]
|
||||||
|
return {
|
||||||
|
"baseline_generated_tokens": len(reference),
|
||||||
|
"compared_tokens": min(
|
||||||
|
len(reference),
|
||||||
|
len(output["generated_token_ids"]),
|
||||||
|
),
|
||||||
|
"prompt_hash_exact": (
|
||||||
|
prior["prompt_token_ids_sha256"]
|
||||||
|
== output["prompt_token_ids_sha256"]
|
||||||
|
),
|
||||||
|
"generated_prefix_exact": observed == reference,
|
||||||
|
"baseline_hit_eos": prior["hit_eos"],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def summarize(rows: list[dict[str, Any]]) -> dict[str, Any]:
|
||||||
|
by_condition: dict[str, dict[str, Any]] = {}
|
||||||
|
conditions = sorted({row["condition"] for row in rows})
|
||||||
|
for condition in conditions:
|
||||||
|
subset = [
|
||||||
|
row for row in rows
|
||||||
|
if row["condition"] == condition
|
||||||
|
]
|
||||||
|
math_rows = [
|
||||||
|
row for row in subset
|
||||||
|
if row["domain"] == "math"
|
||||||
|
]
|
||||||
|
code_rows = [
|
||||||
|
row for row in subset
|
||||||
|
if row["domain"] == "code"
|
||||||
|
]
|
||||||
|
by_condition[condition] = {
|
||||||
|
"outputs": len(subset),
|
||||||
|
"natural_eos": sum(row["hit_eos"] for row in subset),
|
||||||
|
"budget_truncated": sum(
|
||||||
|
row["stopped_at_max_new_tokens"]
|
||||||
|
for row in subset
|
||||||
|
),
|
||||||
|
"mean_generated_tokens": mean(
|
||||||
|
row["generated_tokens"] for row in subset
|
||||||
|
),
|
||||||
|
"completion_classes": dict(
|
||||||
|
Counter(row["completion_class"] for row in subset)
|
||||||
|
),
|
||||||
|
"math_fixed_budget_exact": sum(
|
||||||
|
row["task_evaluation"][
|
||||||
|
"fixed_budget_numeric_exact"
|
||||||
|
]
|
||||||
|
for row in math_rows
|
||||||
|
),
|
||||||
|
"math_strict_complete_exact": sum(
|
||||||
|
row["task_evaluation"][
|
||||||
|
"strict_complete_numeric_exact"
|
||||||
|
]
|
||||||
|
for row in math_rows
|
||||||
|
),
|
||||||
|
"math_sources": len(math_rows),
|
||||||
|
"code_ast_parse": sum(
|
||||||
|
row["task_evaluation"]["python_ast_parse"]
|
||||||
|
for row in code_rows
|
||||||
|
),
|
||||||
|
"code_executed": sum(
|
||||||
|
row["task_evaluation"]["execution"]["status"]
|
||||||
|
!= "not_run"
|
||||||
|
for row in code_rows
|
||||||
|
),
|
||||||
|
"code_tests_pass": sum(
|
||||||
|
row["task_evaluation"]["fixed_budget_tests_pass"]
|
||||||
|
for row in code_rows
|
||||||
|
),
|
||||||
|
"code_sources": len(code_rows),
|
||||||
|
}
|
||||||
|
prefix_rows = [
|
||||||
|
row["baseline_prefix_audit"]
|
||||||
|
for row in rows
|
||||||
|
if row["baseline_prefix_audit"] is not None
|
||||||
|
]
|
||||||
|
return {
|
||||||
|
"outputs": len(rows),
|
||||||
|
"natural_eos": sum(row["hit_eos"] for row in rows),
|
||||||
|
"budget_truncated": sum(
|
||||||
|
row["stopped_at_max_new_tokens"] for row in rows
|
||||||
|
),
|
||||||
|
"completion_classes": dict(
|
||||||
|
Counter(row["completion_class"] for row in rows)
|
||||||
|
),
|
||||||
|
"baseline_prefix": {
|
||||||
|
"cells": len(prefix_rows),
|
||||||
|
"prompt_hash_exact": sum(
|
||||||
|
row["prompt_hash_exact"] for row in prefix_rows
|
||||||
|
),
|
||||||
|
"generated_prefix_exact": sum(
|
||||||
|
row["generated_prefix_exact"] for row in prefix_rows
|
||||||
|
),
|
||||||
|
},
|
||||||
|
"by_condition": by_condition,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
args = parse_args()
|
||||||
|
for path in (
|
||||||
|
args.behavior_json,
|
||||||
|
args.human_eval,
|
||||||
|
args.gsm8k,
|
||||||
|
):
|
||||||
|
if not path.is_file():
|
||||||
|
raise FileNotFoundError(path)
|
||||||
|
if args.baseline_json is not None and not args.baseline_json.is_file():
|
||||||
|
raise FileNotFoundError(args.baseline_json)
|
||||||
|
if "@sha256:" not in args.sandbox_image:
|
||||||
|
raise ValueError("--sandbox-image must include an immutable digest")
|
||||||
|
if args.timeout_seconds <= 0:
|
||||||
|
raise ValueError("--timeout-seconds must be positive")
|
||||||
|
|
||||||
|
behavior = json.loads(
|
||||||
|
args.behavior_json.read_text(encoding="utf-8")
|
||||||
|
)
|
||||||
|
baseline = (
|
||||||
|
json.loads(args.baseline_json.read_text(encoding="utf-8"))
|
||||||
|
if args.baseline_json is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
baseline_rows = baseline_index(baseline)
|
||||||
|
human_eval, gsm8k = load_tasks(args.human_eval, args.gsm8k)
|
||||||
|
|
||||||
|
rows = []
|
||||||
|
for source in behavior["sources"]:
|
||||||
|
for output in source["outputs"]:
|
||||||
|
evaluation = None
|
||||||
|
if source["domain"] == "math":
|
||||||
|
evaluation = evaluate_math(
|
||||||
|
output["text"],
|
||||||
|
output["hit_eos"],
|
||||||
|
gsm8k[source["id"]]["answer"],
|
||||||
|
)
|
||||||
|
elif source["domain"] == "code":
|
||||||
|
evaluation = evaluate_code(
|
||||||
|
output["text"],
|
||||||
|
output["hit_eos"],
|
||||||
|
human_eval[source["id"]],
|
||||||
|
args.sandbox_image,
|
||||||
|
args.timeout_seconds,
|
||||||
|
args.skip_code_execution,
|
||||||
|
)
|
||||||
|
rows.append(
|
||||||
|
{
|
||||||
|
"source_id": source["id"],
|
||||||
|
"domain": source["domain"],
|
||||||
|
"condition": output["condition"],
|
||||||
|
"generated_tokens": output["generated_tokens"],
|
||||||
|
"hit_eos": output["hit_eos"],
|
||||||
|
"stopped_at_max_new_tokens": (
|
||||||
|
output["stopped_at_max_new_tokens"]
|
||||||
|
),
|
||||||
|
"prompt_token_ids_sha256": (
|
||||||
|
output["prompt_token_ids_sha256"]
|
||||||
|
),
|
||||||
|
"generated_token_ids_sha256": (
|
||||||
|
output["generated_token_ids_sha256"]
|
||||||
|
),
|
||||||
|
"text_sha256": output["text_sha256"],
|
||||||
|
"task_evaluation": evaluation,
|
||||||
|
"completion_class": completion_class(
|
||||||
|
output,
|
||||||
|
evaluation,
|
||||||
|
),
|
||||||
|
"baseline_prefix_audit": prefix_audit(
|
||||||
|
source["id"],
|
||||||
|
output,
|
||||||
|
baseline_rows,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
result = {
|
||||||
|
"schema_version": 1,
|
||||||
|
"input": {
|
||||||
|
"behavior_path": str(args.behavior_json),
|
||||||
|
"behavior_sha256": sha256_file(args.behavior_json),
|
||||||
|
"baseline_path": (
|
||||||
|
str(args.baseline_json)
|
||||||
|
if args.baseline_json is not None
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"baseline_sha256": (
|
||||||
|
sha256_file(args.baseline_json)
|
||||||
|
if args.baseline_json is not None
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"human_eval_sha256": sha256_file(args.human_eval),
|
||||||
|
"gsm8k_sha256": sha256_file(args.gsm8k),
|
||||||
|
"model_revision": behavior["model"]["revision"],
|
||||||
|
"max_new_tokens": behavior[
|
||||||
|
"generation_contract"
|
||||||
|
]["max_new_tokens"],
|
||||||
|
},
|
||||||
|
"sandbox": {
|
||||||
|
"image": args.sandbox_image,
|
||||||
|
"timeout_seconds": args.timeout_seconds,
|
||||||
|
"code_execution_skipped": args.skip_code_execution,
|
||||||
|
"network": "none",
|
||||||
|
"filesystem": "read-only",
|
||||||
|
"user": "65534:65534",
|
||||||
|
"capabilities": "ALL dropped",
|
||||||
|
"memory": "256m",
|
||||||
|
"memory_swap": "256m",
|
||||||
|
"pids_limit": 64,
|
||||||
|
"cpus": 0.5,
|
||||||
|
"tmpfs": "/tmp:rw,noexec,nosuid,size=16m",
|
||||||
|
"host_mounts": 0,
|
||||||
|
},
|
||||||
|
"rows": rows,
|
||||||
|
"summary": summarize(rows),
|
||||||
|
"claim_boundary": [
|
||||||
|
"Four math and four code sources are not benchmark estimates.",
|
||||||
|
"Completion-conditioned metrics are selection-biased diagnostics.",
|
||||||
|
"A passing HumanEval test is functional evidence, not code-safety evidence.",
|
||||||
|
"Fallback last-number extraction is not strict completion.",
|
||||||
|
"Counterfactual token sequences are not official-valid chats.",
|
||||||
|
],
|
||||||
|
"content_hash": canonical_hash(rows),
|
||||||
|
}
|
||||||
|
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
args.output.write_text(
|
||||||
|
json.dumps(result, ensure_ascii=False, indent=2) + "\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
payload = args.output.read_bytes()
|
||||||
|
print(
|
||||||
|
json.dumps(
|
||||||
|
{
|
||||||
|
"output": str(args.output),
|
||||||
|
"sha256": sha256_bytes(payload),
|
||||||
|
"bytes": len(payload),
|
||||||
|
"summary": result["summary"],
|
||||||
|
},
|
||||||
|
ensure_ascii=False,
|
||||||
|
indent=2,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,872 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Trace all 27 Chat decoder layers and all 26 MoE gates.
|
||||||
|
|
||||||
|
The probe reuses the fixed 16-source, eight-condition completion cohort but
|
||||||
|
runs prompt-only full-depth forwards. It stores hashes and summaries rather
|
||||||
|
than raw hidden tensors. Target-content comparisons use only byte-identical
|
||||||
|
interior content tokens; boundary-crossing tokens are explicitly excluded.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import resource
|
||||||
|
import time
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
from pathlib import Path
|
||||||
|
from statistics import mean
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import accelerate
|
||||||
|
import safetensors
|
||||||
|
import torch
|
||||||
|
import torch.nn.functional as F
|
||||||
|
import transformers
|
||||||
|
from transformers import AutoTokenizer
|
||||||
|
|
||||||
|
import v2_lite_chat_special_token_behavior_probe as behavior
|
||||||
|
import v2_lite_routing_special_token_family_control as special
|
||||||
|
|
||||||
|
|
||||||
|
EDGE_PAIRS = {
|
||||||
|
"system_eos": ("s0_eos", "s1_eos"),
|
||||||
|
"system_bos": ("s0_bos", "s1_bos"),
|
||||||
|
"system_x": ("s0_x", "s1_x"),
|
||||||
|
"system_period": ("s0_period", "s1_period"),
|
||||||
|
"bos_at_s0": ("s0_eos", "s0_bos"),
|
||||||
|
"bos_at_s1": ("s1_eos", "s1_bos"),
|
||||||
|
"x_at_s0": ("s0_eos", "s0_x"),
|
||||||
|
"x_at_s1": ("s1_eos", "s1_x"),
|
||||||
|
"period_at_s0": ("s0_eos", "s0_period"),
|
||||||
|
"period_at_s1": ("s1_eos", "s1_period"),
|
||||||
|
}
|
||||||
|
SCOPES = ("target_content", "full_input")
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args() -> argparse.Namespace:
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("--artifact-dir", type=Path, required=True)
|
||||||
|
parser.add_argument("--reference-routing-json", type=Path, required=True)
|
||||||
|
parser.add_argument("--human-eval", type=Path, required=True)
|
||||||
|
parser.add_argument("--gsm8k", type=Path, required=True)
|
||||||
|
parser.add_argument("--tnews", type=Path, required=True)
|
||||||
|
parser.add_argument("--tnews-archive", type=Path, required=True)
|
||||||
|
parser.add_argument("--wikitext", type=Path, required=True)
|
||||||
|
parser.add_argument("--output", type=Path, required=True)
|
||||||
|
parser.add_argument(
|
||||||
|
"--domains",
|
||||||
|
nargs="+",
|
||||||
|
choices=behavior.DEFAULT_DOMAINS,
|
||||||
|
default=list(behavior.DEFAULT_DOMAINS),
|
||||||
|
)
|
||||||
|
parser.add_argument("--per-domain", type=int, default=1)
|
||||||
|
parser.add_argument("--gpu-memory", default="28GiB")
|
||||||
|
parser.add_argument("--cpu-memory", default="80GiB")
|
||||||
|
parser.add_argument("--captured-at", default=None)
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def canonical_hash(value: Any) -> str:
|
||||||
|
payload = json.dumps(
|
||||||
|
value,
|
||||||
|
ensure_ascii=False,
|
||||||
|
sort_keys=True,
|
||||||
|
separators=(",", ":"),
|
||||||
|
).encode()
|
||||||
|
return hashlib.sha256(payload).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def tensor_hash(tensor: torch.Tensor) -> str:
|
||||||
|
value = tensor.detach().cpu().contiguous()
|
||||||
|
header = json.dumps(
|
||||||
|
{
|
||||||
|
"shape": list(value.shape),
|
||||||
|
"dtype": str(value.dtype),
|
||||||
|
},
|
||||||
|
separators=(",", ":"),
|
||||||
|
).encode()
|
||||||
|
raw = value.view(torch.uint8).numpy().tobytes()
|
||||||
|
return hashlib.sha256(header + b"\0" + raw).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def validate_args(args: argparse.Namespace) -> None:
|
||||||
|
if args.per_domain <= 0:
|
||||||
|
raise ValueError("--per-domain must be positive")
|
||||||
|
for path in (
|
||||||
|
args.artifact_dir,
|
||||||
|
args.reference_routing_json,
|
||||||
|
args.human_eval,
|
||||||
|
args.gsm8k,
|
||||||
|
args.tnews,
|
||||||
|
args.tnews_archive,
|
||||||
|
args.wikitext,
|
||||||
|
):
|
||||||
|
if not path.exists():
|
||||||
|
raise FileNotFoundError(path)
|
||||||
|
missing = [
|
||||||
|
name
|
||||||
|
for name in behavior.MODEL_FILES
|
||||||
|
if not (args.artifact_dir / name).is_file()
|
||||||
|
]
|
||||||
|
if missing:
|
||||||
|
raise FileNotFoundError(
|
||||||
|
f"artifact directory is incomplete: {missing}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def condition_positions(
|
||||||
|
variants: dict[str, dict[str, Any]],
|
||||||
|
batch_tokens: int,
|
||||||
|
) -> dict[str, dict[str, list[int]]]:
|
||||||
|
result = {}
|
||||||
|
for condition in special.CONDITIONS:
|
||||||
|
variant = variants[condition]
|
||||||
|
padding = batch_tokens - variant["tokens"]
|
||||||
|
result[condition] = {
|
||||||
|
"target_content": [
|
||||||
|
padding + int(position)
|
||||||
|
for position in variant["content_positions"]
|
||||||
|
],
|
||||||
|
"full_input": list(range(padding, batch_tokens)),
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def hidden_stats(value: torch.Tensor) -> dict[str, Any]:
|
||||||
|
fp32 = value.float()
|
||||||
|
return {
|
||||||
|
"shape": list(value.shape),
|
||||||
|
"dtype": str(value.dtype),
|
||||||
|
"tensor_sha256": tensor_hash(value),
|
||||||
|
"mean": fp32.mean().item(),
|
||||||
|
"std": fp32.std(unbiased=False).item(),
|
||||||
|
"rms": fp32.square().mean().sqrt().item(),
|
||||||
|
"max_abs": fp32.abs().max().item(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def compare_hidden(
|
||||||
|
left: torch.Tensor,
|
||||||
|
right: torch.Tensor,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
if left.shape != right.shape:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"hidden comparison shape mismatch: {left.shape} != "
|
||||||
|
f"{right.shape}"
|
||||||
|
)
|
||||||
|
left_fp32 = left.float()
|
||||||
|
right_fp32 = right.float()
|
||||||
|
delta = right_fp32 - left_fp32
|
||||||
|
denominator = left_fp32.norm(dim=-1).clamp_min(1e-12)
|
||||||
|
relative = delta.norm(dim=-1) / denominator
|
||||||
|
cosine = F.cosine_similarity(
|
||||||
|
left_fp32,
|
||||||
|
right_fp32,
|
||||||
|
dim=-1,
|
||||||
|
eps=1e-12,
|
||||||
|
).clamp(-1.0, 1.0)
|
||||||
|
exact = (left == right).all(dim=-1)
|
||||||
|
return {
|
||||||
|
"tokens": left.shape[0],
|
||||||
|
"exact_hidden_rows": exact.sum().item(),
|
||||||
|
"mean_cosine_similarity": cosine.mean().item(),
|
||||||
|
"min_cosine_similarity": cosine.min().item(),
|
||||||
|
"mean_relative_l2": relative.mean().item(),
|
||||||
|
"max_abs_delta": delta.abs().max().item(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def route_distribution(
|
||||||
|
route_ids: torch.Tensor,
|
||||||
|
route_weights: torch.Tensor,
|
||||||
|
experts: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
loads = torch.bincount(
|
||||||
|
route_ids.reshape(-1),
|
||||||
|
minlength=experts,
|
||||||
|
).to(torch.int64)
|
||||||
|
weighted = torch.zeros(experts, dtype=torch.float64)
|
||||||
|
weighted.scatter_add_(
|
||||||
|
0,
|
||||||
|
route_ids.reshape(-1),
|
||||||
|
route_weights.reshape(-1).to(torch.float64),
|
||||||
|
)
|
||||||
|
total = loads.sum().item()
|
||||||
|
probabilities = loads.to(torch.float64) / max(total, 1)
|
||||||
|
nonzero = probabilities[probabilities > 0]
|
||||||
|
entropy = (
|
||||||
|
-(nonzero * nonzero.log()).sum().item() / math.log(experts)
|
||||||
|
if len(nonzero)
|
||||||
|
else 0.0
|
||||||
|
)
|
||||||
|
mean_load = loads.double().mean()
|
||||||
|
cv = (
|
||||||
|
loads.double().std(unbiased=False) / mean_load
|
||||||
|
if mean_load > 0
|
||||||
|
else torch.tensor(0.0)
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
"tokens": route_ids.shape[0],
|
||||||
|
"top_k": route_ids.shape[1],
|
||||||
|
"decisions": total,
|
||||||
|
"ordered_route_sha256": canonical_hash(route_ids.tolist()),
|
||||||
|
"route_weight_sha256": tensor_hash(route_weights),
|
||||||
|
"loads": loads.tolist(),
|
||||||
|
"weighted_loads": weighted.tolist(),
|
||||||
|
"unique_experts": int((loads > 0).sum().item()),
|
||||||
|
"load_cv": cv.item(),
|
||||||
|
"normalized_load_entropy": entropy,
|
||||||
|
"max_load_share": probabilities.max().item(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def normalized_load(loads: torch.Tensor) -> torch.Tensor:
|
||||||
|
value = loads.to(torch.float64)
|
||||||
|
return value / value.sum().clamp_min(1e-12)
|
||||||
|
|
||||||
|
|
||||||
|
def compare_routes(
|
||||||
|
left_ids: torch.Tensor,
|
||||||
|
left_weights: torch.Tensor,
|
||||||
|
right_ids: torch.Tensor,
|
||||||
|
right_weights: torch.Tensor,
|
||||||
|
experts: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
if left_ids.shape != right_ids.shape:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"route comparison shape mismatch: {left_ids.shape} != "
|
||||||
|
f"{right_ids.shape}"
|
||||||
|
)
|
||||||
|
ordered_exact = (left_ids == right_ids).all(dim=-1)
|
||||||
|
left_sorted = left_ids.sort(dim=-1).values
|
||||||
|
right_sorted = right_ids.sort(dim=-1).values
|
||||||
|
set_exact = (left_sorted == right_sorted).all(dim=-1)
|
||||||
|
left_hot = F.one_hot(
|
||||||
|
left_ids,
|
||||||
|
num_classes=experts,
|
||||||
|
).sum(dim=1).bool()
|
||||||
|
right_hot = F.one_hot(
|
||||||
|
right_ids,
|
||||||
|
num_classes=experts,
|
||||||
|
).sum(dim=1).bool()
|
||||||
|
intersection = (left_hot & right_hot).sum(dim=-1)
|
||||||
|
union = (left_hot | right_hot).sum(dim=-1).clamp_min(1)
|
||||||
|
|
||||||
|
left_token_weighted = torch.zeros(
|
||||||
|
left_ids.shape[0],
|
||||||
|
experts,
|
||||||
|
dtype=torch.float64,
|
||||||
|
)
|
||||||
|
right_token_weighted = torch.zeros_like(left_token_weighted)
|
||||||
|
left_token_weighted.scatter_add_(
|
||||||
|
1,
|
||||||
|
left_ids,
|
||||||
|
left_weights.to(torch.float64),
|
||||||
|
)
|
||||||
|
right_token_weighted.scatter_add_(
|
||||||
|
1,
|
||||||
|
right_ids,
|
||||||
|
right_weights.to(torch.float64),
|
||||||
|
)
|
||||||
|
token_weighted_tv = 0.5 * (
|
||||||
|
left_token_weighted - right_token_weighted
|
||||||
|
).abs().sum(dim=-1)
|
||||||
|
|
||||||
|
left_load = torch.bincount(
|
||||||
|
left_ids.reshape(-1),
|
||||||
|
minlength=experts,
|
||||||
|
)
|
||||||
|
right_load = torch.bincount(
|
||||||
|
right_ids.reshape(-1),
|
||||||
|
minlength=experts,
|
||||||
|
)
|
||||||
|
load_tv = 0.5 * (
|
||||||
|
normalized_load(left_load)
|
||||||
|
- normalized_load(right_load)
|
||||||
|
).abs().sum()
|
||||||
|
return {
|
||||||
|
"tokens": left_ids.shape[0],
|
||||||
|
"ordered_topk_exact_tokens": ordered_exact.sum().item(),
|
||||||
|
"set_exact_tokens": set_exact.sum().item(),
|
||||||
|
"mean_set_jaccard": (
|
||||||
|
intersection.to(torch.float64)
|
||||||
|
/ union.to(torch.float64)
|
||||||
|
).mean().item(),
|
||||||
|
"mean_token_weighted_tv": token_weighted_tv.mean().item(),
|
||||||
|
"aggregate_load_tv": load_tv.item(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TraceCapture:
|
||||||
|
def __init__(self, experts: int) -> None:
|
||||||
|
self.experts = experts
|
||||||
|
self.positions: dict[str, dict[str, list[int]]] = {}
|
||||||
|
self.batch_tokens = 0
|
||||||
|
self.hidden: dict[str, Any] = {}
|
||||||
|
self.routes: dict[str, Any] = {}
|
||||||
|
|
||||||
|
def start(
|
||||||
|
self,
|
||||||
|
positions: dict[str, dict[str, list[int]]],
|
||||||
|
batch_tokens: int,
|
||||||
|
) -> None:
|
||||||
|
self.positions = positions
|
||||||
|
self.batch_tokens = batch_tokens
|
||||||
|
self.hidden = {}
|
||||||
|
self.routes = {}
|
||||||
|
|
||||||
|
def hidden_hook(self, stage: str):
|
||||||
|
def hook(
|
||||||
|
_module: torch.nn.Module,
|
||||||
|
_inputs: tuple[Any, ...],
|
||||||
|
output: Any,
|
||||||
|
) -> None:
|
||||||
|
tensor = output[0] if isinstance(output, tuple) else output
|
||||||
|
if tensor.ndim != 3:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"{stage} hidden rank {tensor.ndim}, expected 3"
|
||||||
|
)
|
||||||
|
cpu = tensor.detach().cpu()
|
||||||
|
condition_values: dict[str, dict[str, torch.Tensor]] = {}
|
||||||
|
condition_rows = {}
|
||||||
|
for row, condition in enumerate(special.CONDITIONS):
|
||||||
|
condition_values[condition] = {}
|
||||||
|
condition_rows[condition] = {}
|
||||||
|
for scope in SCOPES:
|
||||||
|
positions = self.positions[condition][scope]
|
||||||
|
value = cpu[row, positions, :].contiguous()
|
||||||
|
condition_values[condition][scope] = value
|
||||||
|
condition_rows[condition][scope] = hidden_stats(value)
|
||||||
|
comparisons = {}
|
||||||
|
for name, (left, right) in EDGE_PAIRS.items():
|
||||||
|
comparisons[name] = compare_hidden(
|
||||||
|
condition_values[left]["target_content"],
|
||||||
|
condition_values[right]["target_content"],
|
||||||
|
)
|
||||||
|
self.hidden[stage] = {
|
||||||
|
"conditions": condition_rows,
|
||||||
|
"target_comparisons": comparisons,
|
||||||
|
}
|
||||||
|
|
||||||
|
return hook
|
||||||
|
|
||||||
|
def gate_hook(self, layer: int):
|
||||||
|
def hook(
|
||||||
|
_module: torch.nn.Module,
|
||||||
|
_inputs: tuple[Any, ...],
|
||||||
|
output: Any,
|
||||||
|
) -> None:
|
||||||
|
route_ids, route_weights, _aux = output
|
||||||
|
top_k = route_ids.shape[-1]
|
||||||
|
ids = route_ids.detach().reshape(
|
||||||
|
len(special.CONDITIONS),
|
||||||
|
self.batch_tokens,
|
||||||
|
top_k,
|
||||||
|
).cpu()
|
||||||
|
weights = route_weights.detach().reshape(
|
||||||
|
len(special.CONDITIONS),
|
||||||
|
self.batch_tokens,
|
||||||
|
top_k,
|
||||||
|
).cpu()
|
||||||
|
values: dict[
|
||||||
|
str,
|
||||||
|
dict[str, tuple[torch.Tensor, torch.Tensor]],
|
||||||
|
] = {}
|
||||||
|
condition_rows = {}
|
||||||
|
for row, condition in enumerate(special.CONDITIONS):
|
||||||
|
values[condition] = {}
|
||||||
|
condition_rows[condition] = {}
|
||||||
|
for scope in SCOPES:
|
||||||
|
positions = self.positions[condition][scope]
|
||||||
|
scoped_ids = ids[row, positions, :].contiguous()
|
||||||
|
scoped_weights = weights[
|
||||||
|
row,
|
||||||
|
positions,
|
||||||
|
:,
|
||||||
|
].contiguous()
|
||||||
|
values[condition][scope] = (
|
||||||
|
scoped_ids,
|
||||||
|
scoped_weights,
|
||||||
|
)
|
||||||
|
condition_rows[condition][scope] = (
|
||||||
|
route_distribution(
|
||||||
|
scoped_ids,
|
||||||
|
scoped_weights,
|
||||||
|
self.experts,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
comparisons = {}
|
||||||
|
for name, (left, right) in EDGE_PAIRS.items():
|
||||||
|
left_ids, left_weights = values[left][
|
||||||
|
"target_content"
|
||||||
|
]
|
||||||
|
right_ids, right_weights = values[right][
|
||||||
|
"target_content"
|
||||||
|
]
|
||||||
|
comparisons[name] = compare_routes(
|
||||||
|
left_ids,
|
||||||
|
left_weights,
|
||||||
|
right_ids,
|
||||||
|
right_weights,
|
||||||
|
self.experts,
|
||||||
|
)
|
||||||
|
self.routes[f"layer_{layer:02d}"] = {
|
||||||
|
"layer": layer,
|
||||||
|
"conditions": condition_rows,
|
||||||
|
"target_comparisons": comparisons,
|
||||||
|
}
|
||||||
|
|
||||||
|
return hook
|
||||||
|
|
||||||
|
|
||||||
|
def aggregate_trace(sources: list[dict[str, Any]]) -> dict[str, Any]:
|
||||||
|
hidden_stages = [
|
||||||
|
"embedding",
|
||||||
|
*(f"layer_{index:02d}" for index in range(27)),
|
||||||
|
"final_norm",
|
||||||
|
]
|
||||||
|
router_layers = [
|
||||||
|
f"layer_{index:02d}"
|
||||||
|
for index in range(1, 27)
|
||||||
|
]
|
||||||
|
hidden = {}
|
||||||
|
for stage in hidden_stages:
|
||||||
|
hidden[stage] = {}
|
||||||
|
for edge in EDGE_PAIRS:
|
||||||
|
rows = [
|
||||||
|
source["hidden_stages"][stage][
|
||||||
|
"target_comparisons"
|
||||||
|
][edge]
|
||||||
|
for source in sources
|
||||||
|
]
|
||||||
|
tokens = sum(row["tokens"] for row in rows)
|
||||||
|
hidden[stage][edge] = {
|
||||||
|
"sources": len(rows),
|
||||||
|
"tokens": tokens,
|
||||||
|
"exact_hidden_rows": sum(
|
||||||
|
row["exact_hidden_rows"] for row in rows
|
||||||
|
),
|
||||||
|
"token_weighted_mean_cosine_similarity": sum(
|
||||||
|
row["mean_cosine_similarity"] * row["tokens"]
|
||||||
|
for row in rows
|
||||||
|
) / tokens,
|
||||||
|
"source_mean_relative_l2": mean(
|
||||||
|
row["mean_relative_l2"] for row in rows
|
||||||
|
),
|
||||||
|
"max_abs_delta": max(
|
||||||
|
row["max_abs_delta"] for row in rows
|
||||||
|
),
|
||||||
|
}
|
||||||
|
routes = {}
|
||||||
|
for layer in router_layers:
|
||||||
|
routes[layer] = {}
|
||||||
|
for edge in EDGE_PAIRS:
|
||||||
|
rows = [
|
||||||
|
source["router_layers"][layer][
|
||||||
|
"target_comparisons"
|
||||||
|
][edge]
|
||||||
|
for source in sources
|
||||||
|
]
|
||||||
|
tokens = sum(row["tokens"] for row in rows)
|
||||||
|
routes[layer][edge] = {
|
||||||
|
"sources": len(rows),
|
||||||
|
"tokens": tokens,
|
||||||
|
"ordered_topk_exact_tokens": sum(
|
||||||
|
row["ordered_topk_exact_tokens"] for row in rows
|
||||||
|
),
|
||||||
|
"set_exact_tokens": sum(
|
||||||
|
row["set_exact_tokens"] for row in rows
|
||||||
|
),
|
||||||
|
"token_weighted_mean_set_jaccard": sum(
|
||||||
|
row["mean_set_jaccard"] * row["tokens"]
|
||||||
|
for row in rows
|
||||||
|
) / tokens,
|
||||||
|
"source_mean_token_weighted_tv": mean(
|
||||||
|
row["mean_token_weighted_tv"] for row in rows
|
||||||
|
),
|
||||||
|
"source_mean_aggregate_load_tv": mean(
|
||||||
|
row["aggregate_load_tv"] for row in rows
|
||||||
|
),
|
||||||
|
}
|
||||||
|
target_tokens = sum(
|
||||||
|
source["content_tokens"] for source in sources
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
"sources": len(sources),
|
||||||
|
"conditions_per_source": len(special.CONDITIONS),
|
||||||
|
"decoder_layers_executed": 27,
|
||||||
|
"moe_gates_executed": 26,
|
||||||
|
"hidden_stages": len(hidden_stages),
|
||||||
|
"target_content_tokens_per_condition": target_tokens,
|
||||||
|
"target_route_decisions": (
|
||||||
|
target_tokens
|
||||||
|
* len(special.CONDITIONS)
|
||||||
|
* 26
|
||||||
|
* 6
|
||||||
|
),
|
||||||
|
"hidden": hidden,
|
||||||
|
"routes": routes,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
args = parse_args()
|
||||||
|
validate_args(args)
|
||||||
|
captured_at = args.captured_at or datetime.now(
|
||||||
|
timezone.utc
|
||||||
|
).isoformat()
|
||||||
|
revision_contract = behavior.download_revision_contract(
|
||||||
|
args.artifact_dir
|
||||||
|
)
|
||||||
|
special.install_control_contract()
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(
|
||||||
|
args.artifact_dir,
|
||||||
|
trust_remote_code=True,
|
||||||
|
local_files_only=True,
|
||||||
|
use_fast=True,
|
||||||
|
)
|
||||||
|
if tokenizer.pad_token_id is None:
|
||||||
|
tokenizer.pad_token_id = tokenizer.eos_token_id
|
||||||
|
if special.special_family_token_ids(tokenizer) != {
|
||||||
|
"eos": 100001,
|
||||||
|
"bos": 100000,
|
||||||
|
"x": 87,
|
||||||
|
"period": 13,
|
||||||
|
}:
|
||||||
|
raise RuntimeError("pinned tokenizer ID contract changed")
|
||||||
|
|
||||||
|
source_rows, reference = behavior.selected_sources(args, tokenizer)
|
||||||
|
for source in source_rows:
|
||||||
|
source["variants"] = {
|
||||||
|
condition: special.prior.render_boundary_variant(
|
||||||
|
tokenizer,
|
||||||
|
source["content"],
|
||||||
|
condition,
|
||||||
|
)
|
||||||
|
for condition in special.CONDITIONS
|
||||||
|
}
|
||||||
|
content_sequences = {
|
||||||
|
tuple(
|
||||||
|
source["variants"][condition]["token_ids"][position]
|
||||||
|
for position in source["variants"][condition][
|
||||||
|
"content_positions"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
for condition in special.CONDITIONS
|
||||||
|
}
|
||||||
|
if len(content_sequences) != 1:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"{source['id']} target token sequence is not exact "
|
||||||
|
"across conditions"
|
||||||
|
)
|
||||||
|
source["content_token_ids_sha256"] = canonical_hash(
|
||||||
|
next(iter(content_sequences))
|
||||||
|
)
|
||||||
|
|
||||||
|
if torch.cuda.is_available():
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
torch.cuda.reset_peak_memory_stats()
|
||||||
|
torch.cuda.synchronize()
|
||||||
|
load_started = time.perf_counter()
|
||||||
|
_, official_modeling = special.base.load_official_modules(
|
||||||
|
args.artifact_dir
|
||||||
|
)
|
||||||
|
model = official_modeling.DeepseekV2ForCausalLM.from_pretrained(
|
||||||
|
args.artifact_dir,
|
||||||
|
local_files_only=True,
|
||||||
|
torch_dtype=torch.bfloat16,
|
||||||
|
low_cpu_mem_usage=True,
|
||||||
|
device_map="auto",
|
||||||
|
max_memory={
|
||||||
|
0: args.gpu_memory,
|
||||||
|
"cpu": args.cpu_memory,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
model.eval()
|
||||||
|
if torch.cuda.is_available():
|
||||||
|
torch.cuda.synchronize()
|
||||||
|
load_seconds = time.perf_counter() - load_started
|
||||||
|
load_peak_cuda = (
|
||||||
|
torch.cuda.max_memory_allocated()
|
||||||
|
if torch.cuda.is_available()
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
input_device = model.get_input_embeddings().weight.device
|
||||||
|
|
||||||
|
capture = TraceCapture(model.config.n_routed_experts)
|
||||||
|
handles = [
|
||||||
|
model.model.embed_tokens.register_forward_hook(
|
||||||
|
capture.hidden_hook("embedding")
|
||||||
|
),
|
||||||
|
model.model.norm.register_forward_hook(
|
||||||
|
capture.hidden_hook("final_norm")
|
||||||
|
),
|
||||||
|
]
|
||||||
|
for index, layer in enumerate(model.model.layers):
|
||||||
|
handles.append(
|
||||||
|
layer.register_forward_hook(
|
||||||
|
capture.hidden_hook(f"layer_{index:02d}")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if hasattr(layer.mlp, "gate"):
|
||||||
|
handles.append(
|
||||||
|
layer.mlp.gate.register_forward_hook(
|
||||||
|
capture.gate_hook(index)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
traced_sources = []
|
||||||
|
try:
|
||||||
|
for source in source_rows:
|
||||||
|
unpadded = [
|
||||||
|
source["variants"][condition]["token_ids"]
|
||||||
|
for condition in special.CONDITIONS
|
||||||
|
]
|
||||||
|
prompt_lengths = [len(row) for row in unpadded]
|
||||||
|
batch_tokens = max(prompt_lengths)
|
||||||
|
padded = [
|
||||||
|
[int(tokenizer.pad_token_id)]
|
||||||
|
* (batch_tokens - len(row))
|
||||||
|
+ row
|
||||||
|
for row in unpadded
|
||||||
|
]
|
||||||
|
masks = [
|
||||||
|
[0] * (batch_tokens - len(row))
|
||||||
|
+ [1] * len(row)
|
||||||
|
for row in unpadded
|
||||||
|
]
|
||||||
|
positions = condition_positions(
|
||||||
|
source["variants"],
|
||||||
|
batch_tokens,
|
||||||
|
)
|
||||||
|
capture.start(positions, batch_tokens)
|
||||||
|
input_ids = torch.tensor(
|
||||||
|
padded,
|
||||||
|
dtype=torch.long,
|
||||||
|
device=input_device,
|
||||||
|
)
|
||||||
|
attention_mask = torch.tensor(
|
||||||
|
masks,
|
||||||
|
dtype=torch.long,
|
||||||
|
device=input_device,
|
||||||
|
)
|
||||||
|
if torch.cuda.is_available():
|
||||||
|
torch.cuda.reset_peak_memory_stats()
|
||||||
|
torch.cuda.synchronize()
|
||||||
|
started = time.perf_counter()
|
||||||
|
with torch.inference_mode():
|
||||||
|
output = model.model(
|
||||||
|
input_ids=input_ids,
|
||||||
|
attention_mask=attention_mask,
|
||||||
|
use_cache=False,
|
||||||
|
output_attentions=False,
|
||||||
|
output_hidden_states=False,
|
||||||
|
return_dict=True,
|
||||||
|
)
|
||||||
|
if torch.cuda.is_available():
|
||||||
|
torch.cuda.synchronize()
|
||||||
|
elapsed = time.perf_counter() - started
|
||||||
|
peak = (
|
||||||
|
torch.cuda.max_memory_allocated()
|
||||||
|
if torch.cuda.is_available()
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
if output.last_hidden_state.shape[:2] != input_ids.shape:
|
||||||
|
raise RuntimeError(
|
||||||
|
"final hidden batch/sequence shape does not match input"
|
||||||
|
)
|
||||||
|
expected_hidden = {
|
||||||
|
"embedding",
|
||||||
|
*(f"layer_{index:02d}" for index in range(27)),
|
||||||
|
"final_norm",
|
||||||
|
}
|
||||||
|
expected_routes = {
|
||||||
|
f"layer_{index:02d}"
|
||||||
|
for index in range(1, 27)
|
||||||
|
}
|
||||||
|
if set(capture.hidden) != expected_hidden:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"hidden stages mismatch: {set(capture.hidden)}"
|
||||||
|
)
|
||||||
|
if set(capture.routes) != expected_routes:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"router layers mismatch: {set(capture.routes)}"
|
||||||
|
)
|
||||||
|
content_tokens = len(
|
||||||
|
positions[special.CONDITIONS[0]][
|
||||||
|
"target_content"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
traced_sources.append(
|
||||||
|
{
|
||||||
|
key: value
|
||||||
|
for key, value in source.items()
|
||||||
|
if key not in {"content", "variants"}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
"prompt_tokens_by_condition": {
|
||||||
|
condition: prompt_lengths[index]
|
||||||
|
for index, condition in enumerate(
|
||||||
|
special.CONDITIONS
|
||||||
|
)
|
||||||
|
},
|
||||||
|
"batch_prompt_tokens": batch_tokens,
|
||||||
|
"content_tokens": content_tokens,
|
||||||
|
"content_token_ids_sha256": source[
|
||||||
|
"content_token_ids_sha256"
|
||||||
|
],
|
||||||
|
"boundary_crossing_tokens_by_condition": {
|
||||||
|
condition: source["variants"][condition][
|
||||||
|
"boundary_crossing_tokens"
|
||||||
|
]
|
||||||
|
for condition in special.CONDITIONS
|
||||||
|
},
|
||||||
|
"forward_seconds": elapsed,
|
||||||
|
"peak_cuda_memory_allocated_bytes": peak,
|
||||||
|
"hidden_stages": capture.hidden,
|
||||||
|
"router_layers": capture.routes,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
finally:
|
||||||
|
for handle in handles:
|
||||||
|
handle.remove()
|
||||||
|
|
||||||
|
device_map = getattr(model, "hf_device_map", {})
|
||||||
|
peaks = [
|
||||||
|
source["peak_cuda_memory_allocated_bytes"]
|
||||||
|
for source in traced_sources
|
||||||
|
if source["peak_cuda_memory_allocated_bytes"] is not None
|
||||||
|
]
|
||||||
|
result = {
|
||||||
|
"schema_version": 1,
|
||||||
|
"captured_at": captured_at,
|
||||||
|
"model": {
|
||||||
|
"repo": "deepseek-ai/DeepSeek-V2-Lite-Chat",
|
||||||
|
"revision": behavior.MODEL_REVISION,
|
||||||
|
"checkpoint_identity": "SFT Chat",
|
||||||
|
"architecture": type(model).__name__,
|
||||||
|
"dtype": "bfloat16",
|
||||||
|
"download_revision_contract": revision_contract,
|
||||||
|
"files": {
|
||||||
|
name: {
|
||||||
|
"bytes": (args.artifact_dir / name).stat().st_size,
|
||||||
|
"sha256": behavior.sha256(
|
||||||
|
args.artifact_dir / name
|
||||||
|
),
|
||||||
|
}
|
||||||
|
for name in behavior.MODEL_FILES
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"tokenizer_contract": {
|
||||||
|
"length": len(tokenizer),
|
||||||
|
"vocab_size": tokenizer.vocab_size,
|
||||||
|
"all_special_ids": tokenizer.all_special_ids,
|
||||||
|
"pad_token_id": tokenizer.pad_token_id,
|
||||||
|
"conditions": special.FACTORS,
|
||||||
|
},
|
||||||
|
"source_contract": {
|
||||||
|
**reference,
|
||||||
|
"domains": args.domains,
|
||||||
|
"per_domain": args.per_domain,
|
||||||
|
"sources": len(source_rows),
|
||||||
|
"full_source_text_used": True,
|
||||||
|
"target_scope": (
|
||||||
|
"byte-identical interior content tokens; tokens whose "
|
||||||
|
"offset crosses the content boundary are excluded"
|
||||||
|
),
|
||||||
|
},
|
||||||
|
"trace_contract": {
|
||||||
|
"conditions": list(special.CONDITIONS),
|
||||||
|
"scopes": list(SCOPES),
|
||||||
|
"edge_pairs": EDGE_PAIRS,
|
||||||
|
"decoder_layers": 27,
|
||||||
|
"moe_gate_layers": list(range(1, 27)),
|
||||||
|
"experts": model.config.n_routed_experts,
|
||||||
|
"top_k": model.config.num_experts_per_tok,
|
||||||
|
"use_cache": False,
|
||||||
|
"raw_hidden_tensors_saved": False,
|
||||||
|
"raw_route_ids_saved": False,
|
||||||
|
"load_vectors_saved": True,
|
||||||
|
"hashes_cover_exact_bfloat16_hidden_and_route_values": True,
|
||||||
|
},
|
||||||
|
"execution": {
|
||||||
|
"python": platform.python_version(),
|
||||||
|
"torch": torch.__version__,
|
||||||
|
"transformers": transformers.__version__,
|
||||||
|
"accelerate": accelerate.__version__,
|
||||||
|
"safetensors": safetensors.__version__,
|
||||||
|
"platform": platform.platform(),
|
||||||
|
"gpu": (
|
||||||
|
torch.cuda.get_device_name(0)
|
||||||
|
if torch.cuda.is_available()
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"gpu_memory_limit": args.gpu_memory,
|
||||||
|
"cpu_memory_limit": args.cpu_memory,
|
||||||
|
"pytorch_cuda_alloc_conf": os.environ.get(
|
||||||
|
"PYTORCH_CUDA_ALLOC_CONF"
|
||||||
|
),
|
||||||
|
"input_device": str(input_device),
|
||||||
|
"device_map": device_map,
|
||||||
|
"load_seconds": load_seconds,
|
||||||
|
"forward_seconds": sum(
|
||||||
|
source["forward_seconds"]
|
||||||
|
for source in traced_sources
|
||||||
|
),
|
||||||
|
"load_peak_cuda_memory_allocated_bytes": load_peak_cuda,
|
||||||
|
"peak_cuda_memory_allocated_bytes": max(
|
||||||
|
[load_peak_cuda, *peaks]
|
||||||
|
),
|
||||||
|
"process_max_rss_kib": resource.getrusage(
|
||||||
|
resource.RUSAGE_SELF
|
||||||
|
).ru_maxrss,
|
||||||
|
},
|
||||||
|
"sources": traced_sources,
|
||||||
|
"summary": aggregate_trace(traced_sources),
|
||||||
|
"claim_boundary": [
|
||||||
|
"The trace observes one fixed SFT Chat checkpoint, not the Base checkpoint.",
|
||||||
|
"Target comparisons exclude boundary-crossing tokens and require exact token IDs.",
|
||||||
|
"Router and hidden associations do not establish mediation or capability causality.",
|
||||||
|
"CPU in hf_device_map is offload residency, not proof of CPU matrix execution.",
|
||||||
|
"Prompt-only use_cache=False traces are not generation-time KV or serving traces.",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
args.output.write_text(
|
||||||
|
json.dumps(result, ensure_ascii=False, indent=2) + "\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
payload = args.output.read_bytes()
|
||||||
|
print(
|
||||||
|
json.dumps(
|
||||||
|
{
|
||||||
|
"output": str(args.output),
|
||||||
|
"sha256": hashlib.sha256(payload).hexdigest(),
|
||||||
|
"bytes": len(payload),
|
||||||
|
"sources": len(traced_sources),
|
||||||
|
"decoder_layers": 27,
|
||||||
|
"moe_gates": 26,
|
||||||
|
"target_route_decisions": result["summary"][
|
||||||
|
"target_route_decisions"
|
||||||
|
],
|
||||||
|
"load_seconds": load_seconds,
|
||||||
|
"forward_seconds": result["execution"][
|
||||||
|
"forward_seconds"
|
||||||
|
],
|
||||||
|
"peak_cuda_memory_allocated_bytes": result[
|
||||||
|
"execution"
|
||||||
|
]["peak_cuda_memory_allocated_bytes"],
|
||||||
|
},
|
||||||
|
ensure_ascii=False,
|
||||||
|
indent=2,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -24,6 +24,7 @@ import ast
|
|||||||
import gzip
|
import gzip
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import resource
|
import resource
|
||||||
@@ -933,6 +934,9 @@ def main() -> None:
|
|||||||
),
|
),
|
||||||
"gpu_memory_limit": args.gpu_memory,
|
"gpu_memory_limit": args.gpu_memory,
|
||||||
"cpu_memory_limit": args.cpu_memory,
|
"cpu_memory_limit": args.cpu_memory,
|
||||||
|
"pytorch_cuda_alloc_conf": os.environ.get(
|
||||||
|
"PYTORCH_CUDA_ALLOC_CONF"
|
||||||
|
),
|
||||||
"input_device": str(input_device),
|
"input_device": str(input_device),
|
||||||
"device_map": device_map,
|
"device_map": device_map,
|
||||||
"parameter_bytes_by_runtime_parameter_device": (
|
"parameter_bytes_by_runtime_parameter_device": (
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"build:data:deepseek-special": "node scripts/build-deepseek-special-token-family-compact.mjs",
|
"build:data:deepseek-special": "node scripts/build-deepseek-special-token-family-compact.mjs",
|
||||||
"build:data:deepseek-role-block": "node scripts/build-deepseek-role-marker-block-compact.mjs",
|
"build:data:deepseek-role-block": "node scripts/build-deepseek-role-marker-block-compact.mjs",
|
||||||
"build:data:deepseek-chat-behavior": "node scripts/build-deepseek-chat-behavior-compact.mjs",
|
"build:data:deepseek-chat-behavior": "node scripts/build-deepseek-chat-behavior-compact.mjs",
|
||||||
|
"build:data:deepseek-chat-completion-depth": "node scripts/build-deepseek-chat-completion-depth-compact.mjs",
|
||||||
"check:site": "node scripts/check-site.mjs",
|
"check:site": "node scripts/check-site.mjs",
|
||||||
"check:moe-browser": "node scripts/check-moe-browser.mjs",
|
"check:moe-browser": "node scripts/check-moe-browser.mjs",
|
||||||
"check:reasoning-browser": "node scripts/check-reasoning-browser.mjs",
|
"check:reasoning-browser": "node scripts/check-reasoning-browser.mjs",
|
||||||
|
|||||||
@@ -0,0 +1,412 @@
|
|||||||
|
# DeepSeek-V2-Lite-Chat:512-token 完成度与全 27 层传播审计
|
||||||
|
|
||||||
|
> 状态:已执行、已评测、已做独立子集复跑
|
||||||
|
>
|
||||||
|
> 执行日期:2026-07-29
|
||||||
|
>
|
||||||
|
> 模型:`deepseek-ai/DeepSeek-V2-Lite-Chat`
|
||||||
|
>
|
||||||
|
> revision:`85864749cd611b4353ce1decdb286193298f64c7`
|
||||||
|
>
|
||||||
|
> 前序审计:`DEEPSEEK_V2_LITE_CHAT_BEHAVIOR_AUDIT.md`
|
||||||
|
>
|
||||||
|
> 预注册协议:`DEEPSEEK_V2_LITE_CHAT_COMPLETION_PROTOCOL.md`
|
||||||
|
|
||||||
|
## 0. 先说结论,也先说不能说什么
|
||||||
|
|
||||||
|
这轮把 Round 04 的两个缺口分别补上:
|
||||||
|
|
||||||
|
1. 将统一生成预算从 128 提高到 512,区分“达到长度上限”“自然结束”“可评测”和
|
||||||
|
“答案正确”;
|
||||||
|
2. 不再只观察 Base checkpoint 的前六个 MoE 层,而是在同一个官方 SFT Chat checkpoint
|
||||||
|
上追踪 embedding、27 个 decoder layer、final norm 与 26 个 MoE gate。
|
||||||
|
|
||||||
|
最短结果是:
|
||||||
|
|
||||||
|
```text
|
||||||
|
128-token natural EOS 31 / 128
|
||||||
|
512-token natural EOS 121 / 128
|
||||||
|
仍在 512 截断 7 / 128
|
||||||
|
|
||||||
|
GSM8K 严格完成且数值 exact 23 / 32
|
||||||
|
HumanEval 官方 tests pass 24 / 32
|
||||||
|
|
||||||
|
全深度目标 content tokens 1,537 / condition
|
||||||
|
隐藏状态阶段 29
|
||||||
|
MoE gate 26
|
||||||
|
top-6 route decisions 1,918,176
|
||||||
|
```
|
||||||
|
|
||||||
|
这些数字只来自四域各 4 条 source、八个固定条件。它们证明这组输入上的执行事实,不是
|
||||||
|
GSM8K、HumanEval、语言能力或“哪种边界更好”的 benchmark 估计。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. 冻结的实验对象
|
||||||
|
|
||||||
|
### 1.1 模型与条件
|
||||||
|
|
||||||
|
- 官方 `DeepSeek-V2-Lite-Chat` SFT checkpoint,不是 Base、R1 或蒸馏模型;
|
||||||
|
- 12 个模型与 tokenizer 文件固定到同一个 revision;
|
||||||
|
- English、Chinese、Code、Math 各 4 条完整公开 source;
|
||||||
|
- 每条 source 使用相同八格:
|
||||||
|
|
||||||
|
| 条件 | system | 历史边界 | 身份 |
|
||||||
|
|---|---:|---|---|
|
||||||
|
| `s0_eos` | off | EOS | 官方序列 |
|
||||||
|
| `s1_eos` | on | EOS | 官方序列 |
|
||||||
|
| `s0_bos` | off | BOS | 单 ID 反事实 |
|
||||||
|
| `s1_bos` | on | BOS | 单 ID 反事实 |
|
||||||
|
| `s0_x` | off | `x` | 单 ID 普通词元对照 |
|
||||||
|
| `s1_x` | on | `x` | 单 ID 普通词元对照 |
|
||||||
|
| `s0_period` | off | `.` | 单 ID 普通词元对照 |
|
||||||
|
| `s1_period` | on | `.` | 单 ID 普通词元对照 |
|
||||||
|
|
||||||
|
同一 source 的八格仍在同一个左填充 batch 内 greedy generation。BOS、`x` 与句点格
|
||||||
|
不是有效官方聊天格式;它们是只改一个 input ID 的机制对照。
|
||||||
|
|
||||||
|
### 1.2 数据身份
|
||||||
|
|
||||||
|
| 域 | 数据 | 本轮判断 |
|
||||||
|
|---|---|---|
|
||||||
|
| English | WikiText-2 raw validation | EOS / 截断与传播差异 |
|
||||||
|
| Chinese | TNEWS public test | EOS / 截断与传播差异 |
|
||||||
|
| Code | OpenAI HumanEval | AST、官方 tests、完成状态 |
|
||||||
|
| Math | GSM8K test | 数值抽取、gold exact、完成状态 |
|
||||||
|
|
||||||
|
gold answer、HumanEval tests 与 entry point 都没有进入模型 prompt。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 为什么不能从 128-token 结果直接读“能力”
|
||||||
|
|
||||||
|
Round 04 的 128 个输出里,97 个因为达到 `max_new_tokens=128` 而停下。此时:
|
||||||
|
|
||||||
|
```text
|
||||||
|
数学没有来得及写最终数值 ≠ 推理一定错误
|
||||||
|
代码 fence 尚未闭合 ≠ 完整代码一定不能运行
|
||||||
|
generation 停止 ≠ 模型主动输出 EOS
|
||||||
|
```
|
||||||
|
|
||||||
|
所以本轮没有只续写那 97 格,而是让全部 128 格从头使用相同的 512-token 预算。选择性续写
|
||||||
|
会让先前是否完成决定后续算力,破坏八格的固定预算比较。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. 显存协议:两次 OOM 如何改变了放置,而没有改变输出
|
||||||
|
|
||||||
|
本机可见显存为 32,607 MiB,官方 model card 给出的单卡 BF16 需求是 40GB,因此必须
|
||||||
|
使用 Accelerate 模块级 CPU offload。
|
||||||
|
|
||||||
|
### 3.1 失败链
|
||||||
|
|
||||||
|
1. 初次加载在 allocator 碎片下失败;
|
||||||
|
2. 启用 `expandable_segments:True` 后,29 GiB static placement smoke 成功;
|
||||||
|
3. 29 GiB formal 在长 prompt、512-token KV 与 offloaded `lm_head` 临时回装共同出现时,
|
||||||
|
额外申请约 400 MiB 失败;
|
||||||
|
4. 失败发生在写正式 JSON 之前,没有可供挑选的部分结果。
|
||||||
|
|
||||||
|
### 3.2 正式放置
|
||||||
|
|
||||||
|
```text
|
||||||
|
max_memory[CUDA:0] = 28 GiB
|
||||||
|
CUDA resident = embedding + layers 0–23
|
||||||
|
CPU offload = layers 24–26 + final norm + lm_head
|
||||||
|
allocator = expandable_segments:True
|
||||||
|
八格 batch = 保持不拆
|
||||||
|
```
|
||||||
|
|
||||||
|
`hf_device_map` 里的 CPU 表示权重驻留 / offload 身份。Accelerate hook 会在执行前搬运模块,
|
||||||
|
不能把它简写成“后三层在 CPU 上做矩阵乘”。
|
||||||
|
|
||||||
|
28 GiB 与成功的 29 GiB smoke 在 32 格上:
|
||||||
|
|
||||||
|
```text
|
||||||
|
prompt hash 32 / 32 exact
|
||||||
|
完整 generated token IDs 32 / 32 exact
|
||||||
|
decoded text 32 / 32 exact
|
||||||
|
EOS state 32 / 32 exact
|
||||||
|
```
|
||||||
|
|
||||||
|
因此改变的是可执行的静态放置余量,不是这 32 格的 greedy 输出。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 512-token completion 结果
|
||||||
|
|
||||||
|
### 4.1 总体完成度阶梯
|
||||||
|
|
||||||
|
| 统一预算 | 自然 EOS | 达到预算仍未 EOS | 总输出 |
|
||||||
|
|---:|---:|---:|---:|
|
||||||
|
| 128 | 31 | 97 | 128 |
|
||||||
|
| 512 | 121 | 7 | 128 |
|
||||||
|
|
||||||
|
这不是说“512 已经足够”。它只表明在这组固定输入上,增加统一预算解决了 90 个原先的
|
||||||
|
截断格,仍有 7 格没有自然结束。
|
||||||
|
|
||||||
|
### 4.2 八个条件逐格
|
||||||
|
|
||||||
|
| 条件 | 自然 EOS | 截断 | 平均生成 tokens | Math strict exact | Code tests pass |
|
||||||
|
|---|---:|---:|---:|---:|---:|
|
||||||
|
| `s0_bos` | 15/16 | 1 | 272.6 | 3/4 | 4/4 |
|
||||||
|
| `s0_eos` | 15/16 | 1 | 278.0 | 3/4 | 3/4 |
|
||||||
|
| `s0_period` | 15/16 | 1 | 270.9 | 3/4 | 3/4 |
|
||||||
|
| `s0_x` | 13/16 | 3 | 294.4 | 2/4 | 3/4 |
|
||||||
|
| `s1_bos` | 16/16 | 0 | 232.6 | 3/4 | 4/4 |
|
||||||
|
| `s1_eos` | 15/16 | 1 | 229.6 | 3/4 | 2/4 |
|
||||||
|
| `s1_period` | 16/16 | 0 | 158.3 | 3/4 | 3/4 |
|
||||||
|
| `s1_x` | 16/16 | 0 | 177.3 | 3/4 | 2/4 |
|
||||||
|
|
||||||
|
分母始终保留。每格的 4 条 math / code 太少,不能把 4/4 与 2/4 排成“边界排行榜”。
|
||||||
|
|
||||||
|
### 4.3 仍截断的 7 格
|
||||||
|
|
||||||
|
| source | 域 | 条件 | 状态 |
|
||||||
|
|---|---|---|---|
|
||||||
|
| WikiText `0443` | English | `s0_bos` | 512 截断 |
|
||||||
|
| WikiText `0030` | English | `s0_x` | 512 截断 |
|
||||||
|
| WikiText `2909` | English | `s0_x` | 512 截断 |
|
||||||
|
| WikiText `2746` | English | `s0_eos` | 512 截断 |
|
||||||
|
| WikiText `2746` | English | `s0_x` | 512 截断 |
|
||||||
|
| WikiText `2746` | English | `s0_period` | 512 截断 |
|
||||||
|
| HumanEval `44` | Code | `s1_eos` | fence 未闭合、AST 失败、未执行 |
|
||||||
|
|
||||||
|
English / Chinese 没有 gold task terminal,因此“不截断”只表示遇到 EOS,不表示回答正确。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. 任务评测:完成、可评测、正确各记一张账
|
||||||
|
|
||||||
|
### 5.1 GSM8K
|
||||||
|
|
||||||
|
32 个 math cells 的抽取方法:
|
||||||
|
|
||||||
|
| 方法 | 数量 | 严格身份 |
|
||||||
|
|---|---:|---|
|
||||||
|
| `\boxed{}` | 20 | 明确 final marker |
|
||||||
|
| answer phrase | 8 | 明确 final marker |
|
||||||
|
| last-number fallback | 4 | 只作固定预算诊断 |
|
||||||
|
|
||||||
|
最终:
|
||||||
|
|
||||||
|
```text
|
||||||
|
strict-complete numeric exact = 23 / 32
|
||||||
|
```
|
||||||
|
|
||||||
|
fallback 即使碰巧与 gold 相等,也不会因为“最后一个数字”被升级成严格完成。
|
||||||
|
|
||||||
|
### 5.2 HumanEval
|
||||||
|
|
||||||
|
32 个 code cells 使用官方 tests,逐 candidate 进入新容器:
|
||||||
|
|
||||||
|
| 执行分类 | 数量 |
|
||||||
|
|---|---:|
|
||||||
|
| `passed` | 24 |
|
||||||
|
| `assertion_failed` | 5 |
|
||||||
|
| `runtime_error` | 2 |
|
||||||
|
| `not_run` | 1 |
|
||||||
|
|
||||||
|
沙箱固定为:
|
||||||
|
|
||||||
|
```text
|
||||||
|
python:3.11-alpine@sha256:25976e9d34a0fab1f278cae931f34c8303d97bf0c0d7f85b6b4dcf641d7702a4
|
||||||
|
network=none · read-only · user=65534:65534
|
||||||
|
cap-drop=ALL · no-new-privileges
|
||||||
|
memory/swap=256m · pids=64 · cpus=0.5
|
||||||
|
/tmp=16m,noexec,nosuid · host mounts=0 · timeout=5s
|
||||||
|
```
|
||||||
|
|
||||||
|
通过官方 tests 是这 4 道 HumanEval 上的功能证据,不是生成代码的安全证明。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. 128-token 前缀与独立复跑
|
||||||
|
|
||||||
|
正式 512 运行首先通过:
|
||||||
|
|
||||||
|
```text
|
||||||
|
prompt hash 与 Round 04 相同 128 / 128
|
||||||
|
前 128 generated token prefix exact 128 / 128
|
||||||
|
```
|
||||||
|
|
||||||
|
正式运行后再启动新进程、重新加载模型,每域只取第 1 条 source:
|
||||||
|
|
||||||
|
```text
|
||||||
|
prompt hash 32 / 32 exact
|
||||||
|
完整 generated token IDs 32 / 32 exact
|
||||||
|
decoded text 32 / 32 exact
|
||||||
|
EOS / truncation state 32 / 32 exact
|
||||||
|
```
|
||||||
|
|
||||||
|
它只能支持“32 格长序列复现”,不能写成 128 / 128 独立复跑。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. 全 27 层 trace:到底追踪了什么
|
||||||
|
|
||||||
|
### 7.1 两条观察线
|
||||||
|
|
||||||
|
对每条 source 的八格做一次 prompt-only、`use_cache=false` forward:
|
||||||
|
|
||||||
|
```text
|
||||||
|
hidden line:
|
||||||
|
embedding → layer 00 → ... → layer 26 → final norm
|
||||||
|
共 29 个阶段
|
||||||
|
|
||||||
|
router line:
|
||||||
|
MoE gate layer 01 → ... → layer 26
|
||||||
|
共 26 个 gate
|
||||||
|
```
|
||||||
|
|
||||||
|
每个 hidden 阶段保存目标 content 与完整输入的 shape、dtype、统计量和 tensor SHA-256;
|
||||||
|
每个 gate 保存 ordered top-6 route hash、route-weight hash、64 专家 load / weighted load 与
|
||||||
|
描述统计。原始激活 tensor 和逐 token route ID 不写入数据文件。
|
||||||
|
|
||||||
|
### 7.2 为什么排除边界相交 token
|
||||||
|
|
||||||
|
八种序列化的字符边界可能落在 tokenizer token 的内部。本轮先验证每个条件的目标内容 token
|
||||||
|
序列完全相同,再只比较完全位于 content 字符区间内的 token:
|
||||||
|
|
||||||
|
```text
|
||||||
|
目标 interior content tokens = 1,537 / condition
|
||||||
|
被排除的 boundary-crossing tokens = 56 / 128 variants
|
||||||
|
```
|
||||||
|
|
||||||
|
否则比较的可能是“同一位置上的不同 token”,隐藏状态差异会混入 tokenizer 边界变化。
|
||||||
|
|
||||||
|
### 7.3 规模恒等式
|
||||||
|
|
||||||
|
```text
|
||||||
|
1,537 target tokens
|
||||||
|
× 8 conditions
|
||||||
|
× 26 MoE gates
|
||||||
|
× top-6 experts
|
||||||
|
= 1,918,176 route decisions
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. 隐藏状态怎样沿深度分叉
|
||||||
|
|
||||||
|
十条 edge 在 embedding 的 1,537 个目标 token 上都 byte-exact:
|
||||||
|
|
||||||
|
```text
|
||||||
|
10 edges × 1,537 rows = 15,370 / 15,370 exact
|
||||||
|
```
|
||||||
|
|
||||||
|
原因不是“条件没有影响”,而是 embedding 是逐 token lookup;目标内容 token ID 相同,
|
||||||
|
尚未与前文发生 attention 混合。进入 layer 00 后,十条 edge 的 exact hidden rows 都降为 0,
|
||||||
|
说明上下文差异已经传播到全部目标行。
|
||||||
|
|
||||||
|
四域合计的代表性结果:
|
||||||
|
|
||||||
|
| edge | final-norm cosine | final relative L2 | cosine 最低阶段 |
|
||||||
|
|---|---:|---:|---|
|
||||||
|
| System on−off · EOS | 0.99530 | 0.08474 | layer 22 |
|
||||||
|
| System on−off · BOS | 0.99440 | 0.09614 | layer 22 |
|
||||||
|
| System on−off · x | 0.98771 | 0.14814 | layer 22 |
|
||||||
|
| System on−off · period | 0.98747 | 0.15230 | layer 22 |
|
||||||
|
| BOS−EOS · system off | 0.99321 | 0.10376 | layer 01 |
|
||||||
|
| BOS−EOS · system on | 0.99304 | 0.11123 | layer 02 |
|
||||||
|
| x−EOS · system off | 0.99252 | 0.11333 | layer 13 |
|
||||||
|
| x−EOS · system on | 0.98706 | 0.15694 | layer 10 |
|
||||||
|
| period−EOS · system off | 0.99252 | 0.11368 | layer 08 |
|
||||||
|
| period−EOS · system on | 0.98754 | 0.15810 | layer 08 |
|
||||||
|
|
||||||
|
不能只看 cosine 接近 1 就说“几乎一样”:2048 维状态中的小方向变化可以改变后续 router
|
||||||
|
排序与 logits。也不能把 relative L2 的深度曲线读成单调累积;残差、归一化与注意力会让差异
|
||||||
|
被放大、旋转或部分抵消。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. 26 个 gate 怎样分叉
|
||||||
|
|
||||||
|
ordered top-6 exact 比 set exact 更严格:前者要求六个专家及顺序完全一致;后者只要求专家集合
|
||||||
|
一致。四域合计:
|
||||||
|
|
||||||
|
| edge | ordered exact 最低层 | 最低比例 | layer 26 ordered exact | layer 26 set exact |
|
||||||
|
|---|---|---:|---:|---:|
|
||||||
|
| System on−off · EOS | 24 | 52.6% | 60.2% | 71.6% |
|
||||||
|
| System on−off · BOS | 24 | 47.0% | 56.9% | 69.8% |
|
||||||
|
| System on−off · x | 24 | 38.1% | 45.7% | 60.5% |
|
||||||
|
| System on−off · period | 24 | 36.6% | 44.2% | 59.1% |
|
||||||
|
| BOS−EOS · system off | 01 | 42.0% | 54.1% | 67.0% |
|
||||||
|
| BOS−EOS · system on | 24 | 40.9% | 50.6% | 64.9% |
|
||||||
|
| x−EOS · system off | 21 | 41.1% | 49.1% | 63.6% |
|
||||||
|
| x−EOS · system on | 24 | 32.9% | 44.6% | 58.9% |
|
||||||
|
| period−EOS · system off | 24 | 42.7% | 48.9% | 63.8% |
|
||||||
|
| period−EOS · system on | 24 | 34.8% | 43.4% | 57.2% |
|
||||||
|
|
||||||
|
“最低层常在 24”是这 16 条 source 的描述事实,不是模型普遍规律,也不是 layer 24 的因果
|
||||||
|
特殊性。更不能把 gate 分叉率直接解释成能力变化:路由只是稀疏 FFN 计算路径的一部分。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. 全深度独立复跑与元数据缺陷
|
||||||
|
|
||||||
|
正式 trace 后重新启动进程,每域复跑第 1 条 source。逐字段核对:
|
||||||
|
|
||||||
|
```text
|
||||||
|
source objects(去除 runtime 字段) 4 / 4 exact
|
||||||
|
hidden tensor SHA-256 1,856 / 1,856 exact
|
||||||
|
ordered-route SHA-256 1,664 / 1,664 exact
|
||||||
|
route-weight SHA-256 1,664 / 1,664 exact
|
||||||
|
所有隐藏 / 路由比较统计 exact
|
||||||
|
```
|
||||||
|
|
||||||
|
预发布核对曾发现 `content_token_ids_sha256` 错误引用了外层循环最后一条 source,并通过
|
||||||
|
Python set 的迭代顺序让该顶层元数据在两个进程间不同。隐藏 tensor、route hash 与全部比较
|
||||||
|
统计当时已经 exact;仍然修正脚本为“在每条 source 验证后立即保存其内容 token hash”,随后
|
||||||
|
正式与复跑两份 trace 全部重跑。当前公开文件是修正后的结果。
|
||||||
|
|
||||||
|
这个例子说明:复跑不能只看 headline 数字,也要比较不参与结论的身份字段。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11. 文件、哈希与运行账
|
||||||
|
|
||||||
|
| 文件 | bytes | SHA-256 |
|
||||||
|
|---|---:|---|
|
||||||
|
| 512 formal generation | 871,946 | `6af40512c5868caab0ef58356aaa7728384f2b7acc7c502aa89478fdf5a2a468` |
|
||||||
|
| completion evaluation | 138,837 | `73f4616359d664377405dd989ee15cbf18e540e2f7b916b0ff99a99143091427` |
|
||||||
|
| 512 independent subset | 233,300 | `6c89f85ae783de5dfbe71694ba23307e79ca04f9522dd8684aef8f6f5295424d` |
|
||||||
|
| full-depth formal | 36,019,346 | `5678ed238f13e3b0d5cf7a3db2268dbddf13f047cdc3730771ba1c66d96426e8` |
|
||||||
|
| full-depth independent subset | 9,166,628 | `17c367cccce3698df6fa8a0c0455d2b0e52cd27e1f66717a66989a586dfd1098` |
|
||||||
|
|
||||||
|
关键运行账:
|
||||||
|
|
||||||
|
| 运行 | GPU placement | 模型加载 | 执行 | peak CUDA allocation |
|
||||||
|
|---|---|---:|---:|---:|
|
||||||
|
| 512 formal | 28 GiB | 8.42 s | 1,225.27 s generation | 31,464,357,376 B |
|
||||||
|
| full-depth formal | 28 GiB | 8.37 s | 13.55 s forward | 28,754,760,704 B |
|
||||||
|
| full-depth subset | 28 GiB | 8.44 s | 3.85 s forward | 28,754,760,704 B |
|
||||||
|
|
||||||
|
这些 eager + offload 延迟不是生产 serving throughput。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 12. 证据阶梯与下一步
|
||||||
|
|
||||||
|
```text
|
||||||
|
前六层 Base route
|
||||||
|
↓ 回答早期路由是否分叉
|
||||||
|
|
||||||
|
完整 Chat generation
|
||||||
|
↓ 回答最终 token 轨迹是否结束、可评测、正确
|
||||||
|
|
||||||
|
29-stage hidden + 26-gate route
|
||||||
|
↓ 回答同一输入差异怎样穿过完整 checkpoint
|
||||||
|
|
||||||
|
尚未完成:
|
||||||
|
干预式 mediation、更多 source、sampling robustness、
|
||||||
|
标准 benchmark harness、generation-time KV / serving trace
|
||||||
|
```
|
||||||
|
|
||||||
|
本轮最重要的边界仍然是:
|
||||||
|
|
||||||
|
- hidden/router association 不是中介因果;
|
||||||
|
- 4 道 math / code 不是 benchmark;
|
||||||
|
- 固定 greedy exact 不是采样鲁棒性;
|
||||||
|
- counterfactual token 序列不是官方有效聊天;
|
||||||
|
- prompt-only `use_cache=false` trace 不是生成期 KV 或生产服务轨迹;
|
||||||
|
- HumanEval tests pass 不是代码安全。
|
||||||
@@ -0,0 +1,331 @@
|
|||||||
|
# DeepSeek-V2-Lite-Chat completion-aware 生成与任务评测协议
|
||||||
|
|
||||||
|
> 状态:已执行;正式结果与独立复跑均通过预注册闸门
|
||||||
|
>
|
||||||
|
> 上一阶段:`DEEPSEEK_V2_LITE_CHAT_BEHAVIOR_AUDIT.md`
|
||||||
|
>
|
||||||
|
> 模型:`deepseek-ai/DeepSeek-V2-Lite-Chat`
|
||||||
|
>
|
||||||
|
> revision:`85864749cd611b4353ce1decdb286193298f64c7`
|
||||||
|
|
||||||
|
## 0. 这一轮要修正什么
|
||||||
|
|
||||||
|
Round 04 在 16 个固定 source、8 个条件上生成了 128 个输出,但只有 31 个自然遇到
|
||||||
|
EOS,另外 97 个在 `max_new_tokens=128` 处停止。编辑距离和 exact comparison 仍然是
|
||||||
|
真实观测;任务准确率却不能直接解释,因为:
|
||||||
|
|
||||||
|
```text
|
||||||
|
没有出现最终数值
|
||||||
|
≠ 数学推理已经失败
|
||||||
|
|
||||||
|
代码在第 128 token 处不能解析
|
||||||
|
≠ 完整代码一定不能通过测试
|
||||||
|
|
||||||
|
生成达到长度上限
|
||||||
|
≠ 模型主动结束回答
|
||||||
|
```
|
||||||
|
|
||||||
|
本轮因此把“停止”“任务终点”“可评测”和“正确”拆成四张账。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. 冻结不变的实验对象
|
||||||
|
|
||||||
|
下列对象全部继承 Round 04,不因结果调整:
|
||||||
|
|
||||||
|
- 官方 SFT Chat checkpoint、12 个模型/tokenizer 文件及其 SHA-256;
|
||||||
|
- 4 个域 × 4 个 source,共 16 个完整公开 source;
|
||||||
|
- `system off/on × EOS/BOS/x/period` 八格;
|
||||||
|
- 同 source 八格进入同一个左填充 batch;
|
||||||
|
- EOS 为官方序列;BOS、`x`、句点各只替换一个历史边界 input ID;
|
||||||
|
- greedy、`do_sample=false`、`use_cache=true`;
|
||||||
|
- BF16 权重、官方 eager 实现与 Accelerate 模块级 CPU offload;
|
||||||
|
- 数学和代码各只有 4 条,仍不是 benchmark。
|
||||||
|
|
||||||
|
数据身份:
|
||||||
|
|
||||||
|
- English / Chinese 只测生成终止与成对输出变化,没有 gold correctness;
|
||||||
|
- Math 使用 GSM8K 官方 `answer`;
|
||||||
|
- Code 使用 OpenAI HumanEval 官方 `prompt`、`test` 与 `entry_point`;
|
||||||
|
- gold 与 tests 从不进入模型 prompt。
|
||||||
|
|
||||||
|
来源:
|
||||||
|
[GSM8K](https://github.com/openai/grade-school-math)、
|
||||||
|
[HumanEval](https://github.com/openai/human-eval/tree/6d43fb980f9fee3c892a914eda09951f772ad10d)。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 统一预算,而不是选择性续写
|
||||||
|
|
||||||
|
执行阶梯:
|
||||||
|
|
||||||
|
```text
|
||||||
|
已发布 baseline = 4 source/domain × 8 conditions × 128 new tokens
|
||||||
|
512 smoke = 1 source/domain × 8 conditions × 512 new tokens
|
||||||
|
512 formal = 4 source/domain × 8 conditions × 512 new tokens
|
||||||
|
512 independent = 1 source/domain × 8 conditions × 512 new tokens
|
||||||
|
```
|
||||||
|
|
||||||
|
不能只给 97 个截断格追加预算。那会让“之前是否完成”决定后续算力,破坏八格比较。512
|
||||||
|
正式运行必须重跑全部 128 格。
|
||||||
|
|
||||||
|
进入正式运行前,smoke 必须满足:
|
||||||
|
|
||||||
|
1. 32 / 32 prompt token hashes 与 128 baseline 相同;
|
||||||
|
2. 32 / 32 新输出的前 `min(128, baseline length)` 个 token 与 baseline exact;
|
||||||
|
3. 没有 OOM、NaN 或 runtime exception;
|
||||||
|
4. EOS、PAD、左填充和单 ID edit 合同不变;
|
||||||
|
5. evaluator 可以对 32 格全部产出 completion state。
|
||||||
|
|
||||||
|
正式运行还必须满足:
|
||||||
|
|
||||||
|
```text
|
||||||
|
128 / 128 prompt hashes exact
|
||||||
|
128 / 128 baseline token prefixes exact
|
||||||
|
```
|
||||||
|
|
||||||
|
独立复跑只覆盖每域第 1 条的 32 格,因此只能写“32 / 32 长序列复现”,不能写
|
||||||
|
“128 / 128 独立复跑”。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. 正式运行前的显存协议修订
|
||||||
|
|
||||||
|
29 GiB static-placement smoke 成功:
|
||||||
|
|
||||||
|
```text
|
||||||
|
CUDA resident = embedding + layers 0–24
|
||||||
|
CPU offloaded = layers 25–26 + final norm + lm_head
|
||||||
|
32 outputs = 完成
|
||||||
|
```
|
||||||
|
|
||||||
|
但 16-source formal 在更长 source 的 512-token KV 状态下,于 offloaded `lm_head`
|
||||||
|
临时回装执行设备时申请 400 MiB 失败;脚本在写 JSON 前退出,没有产生可选择的正式结果。
|
||||||
|
这说明 `max_memory=29GiB` 只约束静态参数放置,不是 activation、KV 和临时回装后的硬峰值。
|
||||||
|
|
||||||
|
正式运行改为:
|
||||||
|
|
||||||
|
```text
|
||||||
|
max_memory[CUDA:0] = 28 GiB
|
||||||
|
CUDA resident = embedding + layers 0–23
|
||||||
|
CPU offloaded = layers 24–26 + final norm + lm_head
|
||||||
|
allocator = expandable_segments:True
|
||||||
|
八格 batch = 不拆分
|
||||||
|
```
|
||||||
|
|
||||||
|
这里的 `CPU offloaded` 是驻留身份;Accelerate hook 会在 forward 前把模块权重带到执行
|
||||||
|
设备,不能把 device map 写成“后三层在 CPU 做矩阵乘”。
|
||||||
|
|
||||||
|
修订发生在成功 formal 结果之前。为检查它是否改变输出,28 GiB smoke 与此前 29 GiB
|
||||||
|
smoke 逐格比较:
|
||||||
|
|
||||||
|
```text
|
||||||
|
prompt hash exact 32 / 32
|
||||||
|
generated token IDs exact 32 / 32
|
||||||
|
decoded text exact 32 / 32
|
||||||
|
EOS state exact 32 / 32
|
||||||
|
```
|
||||||
|
|
||||||
|
因此正式运行采用 28 GiB,同时把两次 OOM、两张 device map、峰值显存和跨放置 exact
|
||||||
|
闸门全部写入审计。若成功 formal 的 baseline 前缀不是 128 / 128 exact,仍判失败。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 四张 completion 账
|
||||||
|
|
||||||
|
每个输出保存以下互不替代的字段:
|
||||||
|
|
||||||
|
### 4.1 停止账
|
||||||
|
|
||||||
|
- `natural_eos`:生成序列实际遇到官方 EOS;
|
||||||
|
- `budget_truncated`:未遇 EOS 且正好达到 512-token 上限;
|
||||||
|
- `other_stop`:两者皆否;出现时必须单独调查。
|
||||||
|
|
||||||
|
### 4.2 任务终点账
|
||||||
|
|
||||||
|
- Math:出现明确 `\boxed{}`、`####` 或 final-answer 语言标记;
|
||||||
|
- Code:出现闭合 Python code fence,或自然 EOS;
|
||||||
|
- English / Chinese:没有任务终点判定器,不用句号冒充完成。
|
||||||
|
|
||||||
|
### 4.3 可评测账
|
||||||
|
|
||||||
|
- Math:终点范围内能抽取规范化数值;
|
||||||
|
- Code:抽出的 candidate 能通过 Python AST,并进入隔离沙箱;
|
||||||
|
- 截断后的“最后一个数字”只保存为 fallback 诊断,不进入严格完成指标。
|
||||||
|
|
||||||
|
### 4.4 正确账
|
||||||
|
|
||||||
|
- Math:规范化预测数值与 GSM8K gold final exact;
|
||||||
|
- Code:HumanEval 官方 `check(candidate)` 在隔离沙箱退出 0;
|
||||||
|
- 同时报告固定预算 pass 与 strict-complete pass;
|
||||||
|
- completion-conditioned accuracy 只作选择偏差明显的诊断,不作为主准确率。
|
||||||
|
|
||||||
|
由此得到五种状态:
|
||||||
|
|
||||||
|
```text
|
||||||
|
NATURAL_EOS
|
||||||
|
TASK_TERMINAL_BEFORE_EOS
|
||||||
|
BUDGET_TRUNCATED_WITH_FALLBACK_ONLY
|
||||||
|
BUDGET_TRUNCATED_UNRESOLVED
|
||||||
|
OTHER_STOP
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. 数学答案抽取
|
||||||
|
|
||||||
|
按以下优先级只取最后一个命中:
|
||||||
|
|
||||||
|
1. `\boxed{number}`;
|
||||||
|
2. `#### number`;
|
||||||
|
3. 明确的 `answer/result/total/profit ... is/= number`;
|
||||||
|
4. 文本最后数值,仅作 fallback。
|
||||||
|
|
||||||
|
数字统一:
|
||||||
|
|
||||||
|
- 去逗号;
|
||||||
|
- `Decimal` 规范化;
|
||||||
|
- 去无意义末尾零;
|
||||||
|
- `-0/+0 → 0`。
|
||||||
|
|
||||||
|
主指标:
|
||||||
|
|
||||||
|
```text
|
||||||
|
fixed_budget_numeric_exact = gold 与任何抽取结果 exact
|
||||||
|
strict_complete_numeric_exact
|
||||||
|
= gold exact
|
||||||
|
AND (natural EOS OR explicit final marker)
|
||||||
|
```
|
||||||
|
|
||||||
|
fallback exact 可以显示,但不能冒充 strict completion。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. HumanEval 执行合同
|
||||||
|
|
||||||
|
代码抽取优先级:
|
||||||
|
|
||||||
|
1. 包含目标 `def entry_point` 的 Python fence;
|
||||||
|
2. 其他 Python fence;
|
||||||
|
3. 文本中目标函数定义起点;
|
||||||
|
4. 作为官方 prompt 的 completion suffix。
|
||||||
|
|
||||||
|
每个 candidate 单独进入一个全新 Docker 容器:
|
||||||
|
|
||||||
|
```text
|
||||||
|
network = none
|
||||||
|
filesystem = read-only
|
||||||
|
user = 65534:65534
|
||||||
|
capabilities = drop ALL
|
||||||
|
no-new-privilege = true
|
||||||
|
memory / swap = 256 MiB / 256 MiB
|
||||||
|
pids = 64
|
||||||
|
cpus = 0.5
|
||||||
|
wall timeout = 5 s
|
||||||
|
/tmp = 16 MiB tmpfs, noexec,nosuid
|
||||||
|
Python = pinned image digest
|
||||||
|
```
|
||||||
|
|
||||||
|
容器没有 host mount,不读取仓库、Docker socket、凭据或网络。官方 `test` 和
|
||||||
|
`check(entry_point)` 只在容器内拼接;结果 JSON 不复制隐藏测试正文,只保存输入数据 hash、
|
||||||
|
harness hash、退出分类与运行时间。
|
||||||
|
|
||||||
|
退出分类:
|
||||||
|
|
||||||
|
- `passed`;
|
||||||
|
- `assertion_failed`;
|
||||||
|
- `runtime_error`;
|
||||||
|
- `timeout`;
|
||||||
|
- `ast_error`;
|
||||||
|
- `sandbox_error`。
|
||||||
|
|
||||||
|
HumanEval 官方仓库本身警告不要在不受信环境中直接执行生成代码;这里把容器隔离合同当作
|
||||||
|
结果的一部分,而不是一句“用了 sandbox”。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. 预注册汇总
|
||||||
|
|
||||||
|
每个 condition 与 domain 同时报告:
|
||||||
|
|
||||||
|
- natural EOS / budget truncated;
|
||||||
|
- explicit task terminal;
|
||||||
|
- evaluator coverage;
|
||||||
|
- math fixed-budget exact / strict-complete exact;
|
||||||
|
- code AST / executed / passed;
|
||||||
|
- completion class 计数;
|
||||||
|
- mean generated tokens。
|
||||||
|
|
||||||
|
成对比较继续报告:
|
||||||
|
|
||||||
|
- token IDs exact;
|
||||||
|
- common prefix;
|
||||||
|
- edit distance;
|
||||||
|
- normalized similarity。
|
||||||
|
|
||||||
|
另外新增:
|
||||||
|
|
||||||
|
- 128→512 completion gain;
|
||||||
|
- 128-token prefix exact;
|
||||||
|
- 32-cell 独立复跑 exact;
|
||||||
|
- 每个比较边两侧的 completion class,防止“一个完整、一个截断”被压成单个 edit distance。
|
||||||
|
|
||||||
|
每域只有 4 条,因此所有 task 分数都保留分子/分母,不报告总体能力置信区间。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. 仍然禁止的结论
|
||||||
|
|
||||||
|
- 512 tokens 足以代表模型最大能力;
|
||||||
|
- EOS 条件让答案更好;
|
||||||
|
- ordinary token 让回答更差;
|
||||||
|
- 4 条 GSM8K / HumanEval 等于 benchmark;
|
||||||
|
- completion-conditioned accuracy 可以与标准 pass@1 横比;
|
||||||
|
- greedy deterministic exact 等于 sampling robustness;
|
||||||
|
- HumanEval 通过说明代码安全;
|
||||||
|
- Chat 输出变化由 Base 前六层 route TV 造成;
|
||||||
|
- CPU offload 延迟代表生产吞吐。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. 与全 27 层 trace 的接口
|
||||||
|
|
||||||
|
完整 27 层 forward 是另一条证据线:
|
||||||
|
|
||||||
|
```text
|
||||||
|
completion evaluator → 回答“输出是否结束、可评测、正确”
|
||||||
|
27-layer trace → 回答“同一输入怎样经过全部层与 26 个 MoE gates”
|
||||||
|
```
|
||||||
|
|
||||||
|
二者只有在同 checkpoint、同完整输入、同 condition、同 prompt hash 下才能做预注册关联;
|
||||||
|
即使 route feature 与输出分叉相关,也不能自动升级为中介因果。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. 执行后登记(不回写预注册定义)
|
||||||
|
|
||||||
|
正式结果见 `DEEPSEEK_V2_LITE_CHAT_COMPLETION_DEPTH_AUDIT.md`。这里只登记协议闸门:
|
||||||
|
|
||||||
|
```text
|
||||||
|
512 formal
|
||||||
|
prompt hash 与 baseline exact 128 / 128
|
||||||
|
baseline generated prefix exact 128 / 128
|
||||||
|
natural EOS 121 / 128
|
||||||
|
budget truncated 7 / 128
|
||||||
|
|
||||||
|
512 independent subset
|
||||||
|
完整 generated token IDs exact 32 / 32
|
||||||
|
decoded text / EOS / truncation exact 32 / 32
|
||||||
|
|
||||||
|
full-depth independent subset
|
||||||
|
source object 去 runtime 后 exact 4 / 4
|
||||||
|
hidden tensor hashes exact 1,856 / 1,856
|
||||||
|
ordered route hashes exact 1,664 / 1,664
|
||||||
|
route-weight hashes exact 1,664 / 1,664
|
||||||
|
```
|
||||||
|
|
||||||
|
正式生成 SHA-256:
|
||||||
|
`6af40512c5868caab0ef58356aaa7728384f2b7acc7c502aa89478fdf5a2a468`。
|
||||||
|
|
||||||
|
正式全深度 trace SHA-256:
|
||||||
|
`5678ed238f13e3b0d5cf7a3db2268dbddf13f047cdc3730771ba1c66d96426e8`。
|
||||||
@@ -0,0 +1,461 @@
|
|||||||
|
import { createHash } from "node:crypto";
|
||||||
|
import { readFileSync, statSync, writeFileSync } from "node:fs";
|
||||||
|
import { resolve } from "node:path";
|
||||||
|
|
||||||
|
const root = resolve(import.meta.dirname, "..");
|
||||||
|
const paths = {
|
||||||
|
baseline: resolve(root, "src/data/deepseek-v2-lite-chat-behavior.json"),
|
||||||
|
completion: resolve(
|
||||||
|
root,
|
||||||
|
"src/data/deepseek-v2-lite-chat-completion-512.json",
|
||||||
|
),
|
||||||
|
completionEval: resolve(
|
||||||
|
root,
|
||||||
|
"src/data/deepseek-v2-lite-chat-completion-512-eval.json",
|
||||||
|
),
|
||||||
|
completionRepro: resolve(
|
||||||
|
root,
|
||||||
|
"src/data/deepseek-v2-lite-chat-completion-512-repro-1pd.json",
|
||||||
|
),
|
||||||
|
depth: resolve(
|
||||||
|
root,
|
||||||
|
"src/data/deepseek-v2-lite-chat-full-depth.json",
|
||||||
|
),
|
||||||
|
depthRepro: resolve(
|
||||||
|
root,
|
||||||
|
"src/data/deepseek-v2-lite-chat-full-depth-repro-1pd.json",
|
||||||
|
),
|
||||||
|
output: resolve(
|
||||||
|
root,
|
||||||
|
"src/data/deepseek-v2-lite-chat-completion-depth-compact.json",
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
const readJson = (path) => JSON.parse(readFileSync(path, "utf8"));
|
||||||
|
const sha256 = (path) => createHash("sha256")
|
||||||
|
.update(readFileSync(path))
|
||||||
|
.digest("hex");
|
||||||
|
const artifact = (path) => ({
|
||||||
|
bytes: statSync(path).size,
|
||||||
|
sha256: sha256(path),
|
||||||
|
});
|
||||||
|
|
||||||
|
const baseline = readJson(paths.baseline);
|
||||||
|
const completion = readJson(paths.completion);
|
||||||
|
const completionEval = readJson(paths.completionEval);
|
||||||
|
const completionRepro = readJson(paths.completionRepro);
|
||||||
|
const depth = readJson(paths.depth);
|
||||||
|
const depthRepro = readJson(paths.depthRepro);
|
||||||
|
|
||||||
|
const completionArtifact = artifact(paths.completion);
|
||||||
|
const baselineArtifact = artifact(paths.baseline);
|
||||||
|
if (
|
||||||
|
completionEval.input.behavior_sha256 !== completionArtifact.sha256
|
||||||
|
|| completionEval.input.baseline_sha256 !== baselineArtifact.sha256
|
||||||
|
) {
|
||||||
|
throw new Error("completion evaluator input hash contract failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
const outputKey = (sourceId, condition) => `${sourceId}\0${condition}`;
|
||||||
|
const completionByKey = new Map(
|
||||||
|
completion.sources.flatMap((source) => source.outputs.map((output) => [
|
||||||
|
outputKey(source.id, output.condition),
|
||||||
|
output,
|
||||||
|
])),
|
||||||
|
);
|
||||||
|
const completionReproduction = {
|
||||||
|
sources: completionRepro.sources.length,
|
||||||
|
cells: 0,
|
||||||
|
promptHashExact: 0,
|
||||||
|
generatedTokenIdsExact: 0,
|
||||||
|
generatedTextExact: 0,
|
||||||
|
eosStateExact: 0,
|
||||||
|
truncationStateExact: 0,
|
||||||
|
};
|
||||||
|
for (const source of completionRepro.sources) {
|
||||||
|
for (const output of source.outputs) {
|
||||||
|
const formal = completionByKey.get(outputKey(source.id, output.condition));
|
||||||
|
if (!formal) {
|
||||||
|
throw new Error(
|
||||||
|
`completion formal output missing: ${source.id}/${output.condition}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
completionReproduction.cells += 1;
|
||||||
|
completionReproduction.promptHashExact += (
|
||||||
|
formal.prompt_token_ids_sha256 === output.prompt_token_ids_sha256
|
||||||
|
);
|
||||||
|
completionReproduction.generatedTokenIdsExact += (
|
||||||
|
JSON.stringify(formal.generated_token_ids)
|
||||||
|
=== JSON.stringify(output.generated_token_ids)
|
||||||
|
);
|
||||||
|
completionReproduction.generatedTextExact += formal.text === output.text;
|
||||||
|
completionReproduction.eosStateExact += formal.hit_eos === output.hit_eos;
|
||||||
|
completionReproduction.truncationStateExact += (
|
||||||
|
formal.stopped_at_max_new_tokens
|
||||||
|
=== output.stopped_at_max_new_tokens
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const [name, value] of Object.entries(completionReproduction)) {
|
||||||
|
if (
|
||||||
|
!["sources", "cells"].includes(name)
|
||||||
|
&& value !== completionReproduction.cells
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`completion reproduction mismatch: ${name}=${value}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const stableDepthSource = (source) => {
|
||||||
|
const copy = structuredClone(source);
|
||||||
|
delete copy.forward_seconds;
|
||||||
|
delete copy.peak_cuda_memory_allocated_bytes;
|
||||||
|
return copy;
|
||||||
|
};
|
||||||
|
const depthSourceById = new Map(
|
||||||
|
depth.sources.map((source) => [source.id, source]),
|
||||||
|
);
|
||||||
|
const depthReproduction = {
|
||||||
|
sources: depthRepro.sources.length,
|
||||||
|
sourceObjectsExactAfterRuntimeStrip: 0,
|
||||||
|
hiddenStagesPerSource: 29,
|
||||||
|
routerLayersPerSource: 26,
|
||||||
|
hiddenTensorHashesExact: 0,
|
||||||
|
hiddenTensorHashesCompared: 0,
|
||||||
|
orderedRouteHashesExact: 0,
|
||||||
|
orderedRouteHashesCompared: 0,
|
||||||
|
routeWeightHashesExact: 0,
|
||||||
|
routeWeightHashesCompared: 0,
|
||||||
|
};
|
||||||
|
for (const rerunSource of depthRepro.sources) {
|
||||||
|
const formalSource = depthSourceById.get(rerunSource.id);
|
||||||
|
if (!formalSource) {
|
||||||
|
throw new Error(`depth formal source missing: ${rerunSource.id}`);
|
||||||
|
}
|
||||||
|
depthReproduction.sourceObjectsExactAfterRuntimeStrip += (
|
||||||
|
JSON.stringify(stableDepthSource(formalSource))
|
||||||
|
=== JSON.stringify(stableDepthSource(rerunSource))
|
||||||
|
);
|
||||||
|
for (const [stage, stageValue] of Object.entries(
|
||||||
|
rerunSource.hidden_stages,
|
||||||
|
)) {
|
||||||
|
for (const [condition, conditionValue] of Object.entries(
|
||||||
|
stageValue.conditions,
|
||||||
|
)) {
|
||||||
|
for (const scope of ["target_content", "full_input"]) {
|
||||||
|
depthReproduction.hiddenTensorHashesCompared += 1;
|
||||||
|
depthReproduction.hiddenTensorHashesExact += (
|
||||||
|
formalSource.hidden_stages[stage].conditions[condition][scope]
|
||||||
|
.tensor_sha256
|
||||||
|
=== conditionValue[scope].tensor_sha256
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const [layer, layerValue] of Object.entries(
|
||||||
|
rerunSource.router_layers,
|
||||||
|
)) {
|
||||||
|
for (const [condition, conditionValue] of Object.entries(
|
||||||
|
layerValue.conditions,
|
||||||
|
)) {
|
||||||
|
for (const scope of ["target_content", "full_input"]) {
|
||||||
|
const formalScope = (
|
||||||
|
formalSource.router_layers[layer].conditions[condition][scope]
|
||||||
|
);
|
||||||
|
depthReproduction.orderedRouteHashesCompared += 1;
|
||||||
|
depthReproduction.orderedRouteHashesExact += (
|
||||||
|
formalScope.ordered_route_sha256
|
||||||
|
=== conditionValue[scope].ordered_route_sha256
|
||||||
|
);
|
||||||
|
depthReproduction.routeWeightHashesCompared += 1;
|
||||||
|
depthReproduction.routeWeightHashesExact += (
|
||||||
|
formalScope.route_weight_sha256
|
||||||
|
=== conditionValue[scope].route_weight_sha256
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
depthReproduction.sourceObjectsExactAfterRuntimeStrip
|
||||||
|
!== depthReproduction.sources
|
||||||
|
|| depthReproduction.hiddenTensorHashesExact
|
||||||
|
!== depthReproduction.hiddenTensorHashesCompared
|
||||||
|
|| depthReproduction.orderedRouteHashesExact
|
||||||
|
!== depthReproduction.orderedRouteHashesCompared
|
||||||
|
|| depthReproduction.routeWeightHashesExact
|
||||||
|
!== depthReproduction.routeWeightHashesCompared
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`depth reproduction mismatch: ${JSON.stringify(depthReproduction)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const conditions = Object.keys(completion.generation_contract.conditions);
|
||||||
|
const edgeOrder = Object.keys(depth.trace_contract.edge_pairs);
|
||||||
|
const edgeLabels = {
|
||||||
|
system_eos: "System on − off · EOS",
|
||||||
|
system_bos: "System on − off · BOS",
|
||||||
|
system_x: "System on − off · x",
|
||||||
|
system_period: "System on − off · 句点",
|
||||||
|
bos_at_s0: "BOS − EOS · system off",
|
||||||
|
bos_at_s1: "BOS − EOS · system on",
|
||||||
|
x_at_s0: "x − EOS · system off",
|
||||||
|
x_at_s1: "x − EOS · system on",
|
||||||
|
period_at_s0: "句点 − EOS · system off",
|
||||||
|
period_at_s1: "句点 − EOS · system on",
|
||||||
|
};
|
||||||
|
const domains = ["all", "english", "chinese", "code", "math"];
|
||||||
|
const hiddenStages = [
|
||||||
|
"embedding",
|
||||||
|
...Array.from({ length: 27 }, (_, index) => (
|
||||||
|
`layer_${String(index).padStart(2, "0")}`
|
||||||
|
)),
|
||||||
|
"final_norm",
|
||||||
|
];
|
||||||
|
const routerLayers = Array.from({ length: 26 }, (_, index) => (
|
||||||
|
`layer_${String(index + 1).padStart(2, "0")}`
|
||||||
|
));
|
||||||
|
|
||||||
|
const sourcesForDomain = (domain) => (
|
||||||
|
domain === "all"
|
||||||
|
? depth.sources
|
||||||
|
: depth.sources.filter((source) => source.domain === domain)
|
||||||
|
);
|
||||||
|
const mean = (values) => (
|
||||||
|
values.reduce((sum, value) => sum + value, 0) / values.length
|
||||||
|
);
|
||||||
|
const aggregateHidden = (sources, stage, edge) => {
|
||||||
|
const rows = sources.map(
|
||||||
|
(source) => (
|
||||||
|
source.hidden_stages[stage].target_comparisons[edge]
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const tokens = rows.reduce((sum, row) => sum + row.tokens, 0);
|
||||||
|
return {
|
||||||
|
tokens,
|
||||||
|
exactRows: rows.reduce(
|
||||||
|
(sum, row) => sum + row.exact_hidden_rows,
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
meanCosine: rows.reduce(
|
||||||
|
(sum, row) => sum + row.mean_cosine_similarity * row.tokens,
|
||||||
|
0,
|
||||||
|
) / tokens,
|
||||||
|
meanRelativeL2: mean(rows.map((row) => row.mean_relative_l2)),
|
||||||
|
maxAbsDelta: Math.max(...rows.map((row) => row.max_abs_delta)),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const aggregateRouter = (sources, layer, edge) => {
|
||||||
|
const rows = sources.map(
|
||||||
|
(source) => (
|
||||||
|
source.router_layers[layer].target_comparisons[edge]
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const tokens = rows.reduce((sum, row) => sum + row.tokens, 0);
|
||||||
|
const orderedExact = rows.reduce(
|
||||||
|
(sum, row) => sum + row.ordered_topk_exact_tokens,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
const setExact = rows.reduce(
|
||||||
|
(sum, row) => sum + row.set_exact_tokens,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
tokens,
|
||||||
|
orderedExact,
|
||||||
|
orderedExactRate: orderedExact / tokens,
|
||||||
|
setExact,
|
||||||
|
setExactRate: setExact / tokens,
|
||||||
|
meanSetJaccard: rows.reduce(
|
||||||
|
(sum, row) => sum + row.mean_set_jaccard * row.tokens,
|
||||||
|
0,
|
||||||
|
) / tokens,
|
||||||
|
meanTokenWeightedTv: mean(
|
||||||
|
rows.map((row) => row.mean_token_weighted_tv),
|
||||||
|
),
|
||||||
|
meanAggregateLoadTv: mean(
|
||||||
|
rows.map((row) => row.aggregate_load_tv),
|
||||||
|
),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const hiddenSeries = Object.fromEntries(domains.map((domain) => {
|
||||||
|
const sources = sourcesForDomain(domain);
|
||||||
|
return [domain, Object.fromEntries(edgeOrder.map((edge) => [
|
||||||
|
edge,
|
||||||
|
hiddenStages.map((stage) => ({
|
||||||
|
stage,
|
||||||
|
...aggregateHidden(sources, stage, edge),
|
||||||
|
})),
|
||||||
|
]))];
|
||||||
|
}));
|
||||||
|
const routerSeries = Object.fromEntries(domains.map((domain) => {
|
||||||
|
const sources = sourcesForDomain(domain);
|
||||||
|
return [domain, Object.fromEntries(edgeOrder.map((edge) => [
|
||||||
|
edge,
|
||||||
|
routerLayers.map((layer) => ({
|
||||||
|
layer,
|
||||||
|
...aggregateRouter(sources, layer, edge),
|
||||||
|
})),
|
||||||
|
]))];
|
||||||
|
}));
|
||||||
|
|
||||||
|
const evaluationRows = completionEval.rows.map((row) => ({
|
||||||
|
sourceId: row.source_id,
|
||||||
|
domain: row.domain,
|
||||||
|
condition: row.condition,
|
||||||
|
generatedTokens: row.generated_tokens,
|
||||||
|
hitEos: row.hit_eos,
|
||||||
|
completionClass: row.completion_class,
|
||||||
|
taskEvaluation: row.task_evaluation,
|
||||||
|
}));
|
||||||
|
const incompleteRows = evaluationRows.filter((row) => !row.hitEos);
|
||||||
|
const codeRows = evaluationRows.filter((row) => row.domain === "code");
|
||||||
|
const mathRows = evaluationRows.filter((row) => row.domain === "math");
|
||||||
|
const codeStatuses = Object.groupBy(
|
||||||
|
codeRows,
|
||||||
|
(row) => row.taskEvaluation.execution?.status ?? "not_run",
|
||||||
|
);
|
||||||
|
const mathExtraction = Object.groupBy(
|
||||||
|
mathRows,
|
||||||
|
(row) => row.taskEvaluation.extraction_method,
|
||||||
|
);
|
||||||
|
|
||||||
|
const baselineNaturalEos = baseline.sources.reduce(
|
||||||
|
(sum, source) => (
|
||||||
|
sum + source.outputs.filter((output) => output.hit_eos).length
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
const boundaryCrossingTokens = depth.sources.reduce(
|
||||||
|
(sum, source) => (
|
||||||
|
sum + Object.values(source.boundary_crossing_tokens_by_condition)
|
||||||
|
.reduce((sourceSum, value) => sourceSum + value, 0)
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
const {
|
||||||
|
hidden: _hiddenSummary,
|
||||||
|
routes: _routeSummary,
|
||||||
|
...depthHeadline
|
||||||
|
} = depth.summary;
|
||||||
|
|
||||||
|
const compact = {
|
||||||
|
schemaVersion: 1,
|
||||||
|
artifacts: Object.fromEntries(
|
||||||
|
Object.entries(paths)
|
||||||
|
.filter(([name]) => name !== "output")
|
||||||
|
.map(([name, path]) => [name, artifact(path)]),
|
||||||
|
),
|
||||||
|
model: {
|
||||||
|
repo: completion.model.repo,
|
||||||
|
revision: completion.model.revision,
|
||||||
|
checkpointIdentity: completion.model.checkpoint_identity,
|
||||||
|
architecture: completion.model.architecture,
|
||||||
|
dtype: completion.model.dtype,
|
||||||
|
},
|
||||||
|
contract: {
|
||||||
|
conditions,
|
||||||
|
conditionFactors: completion.generation_contract.conditions,
|
||||||
|
edgeOrder,
|
||||||
|
edgePairs: depth.trace_contract.edge_pairs,
|
||||||
|
edgeLabels,
|
||||||
|
domains,
|
||||||
|
targetScope: depth.source_contract.target_scope,
|
||||||
|
decode: completion.generation_contract.decode,
|
||||||
|
maxNewTokens: completion.generation_contract.max_new_tokens,
|
||||||
|
useCacheGeneration: completion.generation_contract.use_cache,
|
||||||
|
useCacheTrace: depth.trace_contract.use_cache,
|
||||||
|
},
|
||||||
|
completion: {
|
||||||
|
budgetLadder: [
|
||||||
|
{
|
||||||
|
maxNewTokens: baseline.generation_contract.max_new_tokens,
|
||||||
|
naturalEos: baselineNaturalEos,
|
||||||
|
truncated: 128 - baselineNaturalEos,
|
||||||
|
outputs: 128,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
maxNewTokens: 512,
|
||||||
|
naturalEos: completionEval.summary.natural_eos,
|
||||||
|
truncated: completionEval.summary.budget_truncated,
|
||||||
|
outputs: completionEval.summary.outputs,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
summary: completionEval.summary,
|
||||||
|
incompleteRows,
|
||||||
|
taskRows: evaluationRows.filter(
|
||||||
|
(row) => ["code", "math"].includes(row.domain),
|
||||||
|
),
|
||||||
|
taskTotals: {
|
||||||
|
math: {
|
||||||
|
strictCorrect: mathRows.filter(
|
||||||
|
(row) => (
|
||||||
|
row.taskEvaluation.strict_complete_numeric_exact
|
||||||
|
),
|
||||||
|
).length,
|
||||||
|
total: mathRows.length,
|
||||||
|
extractionMethods: Object.fromEntries(
|
||||||
|
Object.entries(mathExtraction).map(([key, rows]) => [
|
||||||
|
key,
|
||||||
|
rows.length,
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
code: {
|
||||||
|
testsPassed: codeRows.filter(
|
||||||
|
(row) => row.taskEvaluation.fixed_budget_tests_pass,
|
||||||
|
).length,
|
||||||
|
total: codeRows.length,
|
||||||
|
statuses: Object.fromEntries(
|
||||||
|
Object.entries(codeStatuses).map(([key, rows]) => [
|
||||||
|
key,
|
||||||
|
rows.length,
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sandbox: completionEval.sandbox,
|
||||||
|
reproduction: completionReproduction,
|
||||||
|
execution: completion.execution,
|
||||||
|
claimBoundary: completionEval.claim_boundary,
|
||||||
|
},
|
||||||
|
depth: {
|
||||||
|
summary: depthHeadline,
|
||||||
|
hiddenSeries,
|
||||||
|
routerSeries,
|
||||||
|
hiddenStages,
|
||||||
|
routerLayers,
|
||||||
|
boundaryCrossingTokens,
|
||||||
|
sources: depth.sources.map((source) => ({
|
||||||
|
id: source.id,
|
||||||
|
domain: source.domain,
|
||||||
|
label: source.label,
|
||||||
|
contentTokens: source.content_tokens,
|
||||||
|
contentTokenIdsSha256: source.content_token_ids_sha256,
|
||||||
|
boundaryCrossingTokensByCondition: (
|
||||||
|
source.boundary_crossing_tokens_by_condition
|
||||||
|
),
|
||||||
|
})),
|
||||||
|
reproduction: depthReproduction,
|
||||||
|
execution: depth.execution,
|
||||||
|
claimBoundary: depth.claim_boundary,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
writeFileSync(
|
||||||
|
paths.output,
|
||||||
|
`${JSON.stringify(compact, null, 2)}\n`,
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
process.stdout.write(
|
||||||
|
`${paths.output}\n`
|
||||||
|
+ `${statSync(paths.output).size} bytes compact\n`
|
||||||
|
+ `${completionReproduction.generatedTokenIdsExact}`
|
||||||
|
+ ` / ${completionReproduction.cells} completion cells exact\n`
|
||||||
|
+ `${depthReproduction.sourceObjectsExactAfterRuntimeStrip}`
|
||||||
|
+ ` / ${depthReproduction.sources} depth sources exact`
|
||||||
|
+ " after runtime strip\n",
|
||||||
|
);
|
||||||
@@ -80,6 +80,10 @@ const overview = await evaluate(`(() => ({
|
|||||||
behaviorPanels: document.querySelectorAll("[data-behavior-panel]").length,
|
behaviorPanels: document.querySelectorAll("[data-behavior-panel]").length,
|
||||||
behaviorSources: document.querySelectorAll("[data-behavior-source] option").length,
|
behaviorSources: document.querySelectorAll("[data-behavior-source] option").length,
|
||||||
behaviorEdges: document.querySelectorAll("[data-behavior-map-edge]").length,
|
behaviorEdges: document.querySelectorAll("[data-behavior-map-edge]").length,
|
||||||
|
completionDepthTabs: document.querySelectorAll("[data-cd-tab]").length,
|
||||||
|
completionDepthPanels: document.querySelectorAll("[data-cd-panel]").length,
|
||||||
|
hiddenStages: document.querySelectorAll("[data-hidden-stage]").length,
|
||||||
|
routerLayers: document.querySelectorAll("[data-router-layer]").length,
|
||||||
branches: document.querySelectorAll(".branch-grid > a").length,
|
branches: document.querySelectorAll(".branch-grid > a").length,
|
||||||
followups: document.querySelectorAll(".lineage-row.followup").length,
|
followups: document.querySelectorAll(".lineage-row.followup").length,
|
||||||
navLinks: document.querySelectorAll(".top-nav a").length,
|
navLinks: document.querySelectorAll(".top-nav a").length,
|
||||||
@@ -879,6 +883,86 @@ await evaluate(`(() => {
|
|||||||
await pause(180);
|
await pause(180);
|
||||||
await screenshot("/tmp/llm-atlas-deepseek-behavior-desktop.png");
|
await screenshot("/tmp/llm-atlas-deepseek-behavior-desktop.png");
|
||||||
|
|
||||||
|
const completionDepth = await evaluate(`(() => {
|
||||||
|
const root = document.querySelector("[data-completion-depth-lab]");
|
||||||
|
const initial = {
|
||||||
|
panel: root.querySelector("[data-cd-panel]:not([hidden])").dataset.cdPanel,
|
||||||
|
conditionRows: root.querySelectorAll("[data-completion-condition]").length,
|
||||||
|
incompleteRows: root.querySelectorAll(".incomplete-ledger article").length,
|
||||||
|
prefixCards: root.querySelectorAll(".prefix-gate > article").length,
|
||||||
|
};
|
||||||
|
root.querySelector('[data-cd-tab="tasks"]').click();
|
||||||
|
const condition = root.querySelector("[data-task-condition]");
|
||||||
|
condition.value = "s1_eos";
|
||||||
|
condition.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
const tasks = {
|
||||||
|
panel: root.querySelector("[data-cd-panel]:not([hidden])").dataset.cdPanel,
|
||||||
|
mathCards: root.querySelectorAll("[data-math-task-grid] > article").length,
|
||||||
|
codeCards: root.querySelectorAll("[data-code-task-grid] > article").length,
|
||||||
|
mathTotal: root.querySelector("[data-math-condition-total]").textContent.trim(),
|
||||||
|
codeTotal: root.querySelector("[data-code-condition-total]").textContent.trim(),
|
||||||
|
sandboxSteps: root.querySelectorAll(".sandbox-flow > article").length,
|
||||||
|
};
|
||||||
|
root.querySelector('[data-cd-tab="hidden"]').click();
|
||||||
|
const hiddenEdge = root.querySelector("[data-hidden-edge]");
|
||||||
|
const hiddenDomain = root.querySelector("[data-hidden-domain]");
|
||||||
|
const hiddenMetric = root.querySelector("[data-hidden-metric]");
|
||||||
|
hiddenEdge.value = "period_at_s1";
|
||||||
|
hiddenEdge.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
hiddenDomain.value = "code";
|
||||||
|
hiddenDomain.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
hiddenMetric.value = "relative";
|
||||||
|
hiddenMetric.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
root.querySelector('[data-hidden-stage="8"]').click();
|
||||||
|
const hidden = {
|
||||||
|
panel: root.querySelector("[data-cd-panel]:not([hidden])").dataset.cdPanel,
|
||||||
|
stages: root.querySelectorAll("[data-hidden-stage]").length,
|
||||||
|
selected: root.querySelector("[data-hidden-stage-name]").textContent.trim(),
|
||||||
|
cosine: root.querySelector("[data-hidden-cosine]").textContent.trim(),
|
||||||
|
relative: root.querySelector("[data-hidden-relative]").textContent.trim(),
|
||||||
|
exact: root.querySelector("[data-hidden-exact]").textContent.trim(),
|
||||||
|
points: root.querySelector("[data-hidden-line]").getAttribute("points").split(" ").length,
|
||||||
|
};
|
||||||
|
root.querySelector('[data-cd-tab="router"]').click();
|
||||||
|
const routerEdge = root.querySelector("[data-router-edge]");
|
||||||
|
const routerDomain = root.querySelector("[data-router-domain]");
|
||||||
|
routerEdge.value = "period_at_s1";
|
||||||
|
routerEdge.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
routerDomain.value = "math";
|
||||||
|
routerDomain.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
root.querySelector('[data-router-layer="23"]').click();
|
||||||
|
const router = {
|
||||||
|
panel: root.querySelector("[data-cd-panel]:not([hidden])").dataset.cdPanel,
|
||||||
|
layers: root.querySelectorAll("[data-router-layer]").length,
|
||||||
|
selected: root.querySelector("[data-router-layer-name]").textContent.trim(),
|
||||||
|
ordered: root.querySelector("[data-router-ordered]").textContent.trim(),
|
||||||
|
setExact: root.querySelector("[data-router-set]").textContent.trim(),
|
||||||
|
tv: root.querySelector("[data-router-tv]").textContent.trim(),
|
||||||
|
points: root.querySelector("[data-router-line]").getAttribute("points").split(" ").length,
|
||||||
|
reproCards: root.querySelectorAll(".repro-proof > article").length,
|
||||||
|
links: root.querySelectorAll('[data-cd-panel="router"] .artifact-links > a').length,
|
||||||
|
};
|
||||||
|
const first = root.querySelector('[data-cd-tab="completion"]');
|
||||||
|
first.focus();
|
||||||
|
first.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowRight", bubbles: true }));
|
||||||
|
return {
|
||||||
|
initial,
|
||||||
|
tasks,
|
||||||
|
hidden,
|
||||||
|
router,
|
||||||
|
keyboardSelected: root.querySelector('[data-cd-tab][aria-selected="true"]').dataset.cdTab,
|
||||||
|
keyboardVisible: root.querySelector("[data-cd-panel]:not([hidden])").dataset.cdPanel,
|
||||||
|
};
|
||||||
|
})()`);
|
||||||
|
await evaluate(`(() => {
|
||||||
|
const root = document.querySelector("[data-completion-depth-lab]");
|
||||||
|
root.querySelector('[data-cd-tab="hidden"]').click();
|
||||||
|
root.scrollIntoView({ block: "start", behavior: "instant" });
|
||||||
|
window.scrollBy(0, -82);
|
||||||
|
})()`);
|
||||||
|
await pause(180);
|
||||||
|
await screenshot("/tmp/llm-atlas-deepseek-completion-depth-desktop.png");
|
||||||
|
|
||||||
await navigate("/");
|
await navigate("/");
|
||||||
const home = await evaluate(`(() => ({
|
const home = await evaluate(`(() => ({
|
||||||
releaseCards: document.querySelectorAll(".release-card").length,
|
releaseCards: document.querySelectorAll(".release-card").length,
|
||||||
@@ -912,6 +996,7 @@ const mobile = await evaluate(`(() => {
|
|||||||
const root = document.querySelector("[data-deepseek-lab]");
|
const root = document.querySelector("[data-deepseek-lab]");
|
||||||
const artifact = document.querySelector("[data-dsv2-lab]");
|
const artifact = document.querySelector("[data-dsv2-lab]");
|
||||||
const behavior = document.querySelector("[data-behavior-lab]");
|
const behavior = document.querySelector("[data-behavior-lab]");
|
||||||
|
const completionDepth = document.querySelector("[data-completion-depth-lab]");
|
||||||
root.scrollIntoView({ block: "start", behavior: "instant" });
|
root.scrollIntoView({ block: "start", behavior: "instant" });
|
||||||
const toggle = document.querySelector("#menu-toggle");
|
const toggle = document.querySelector("#menu-toggle");
|
||||||
toggle?.click();
|
toggle?.click();
|
||||||
@@ -926,6 +1011,9 @@ const mobile = await evaluate(`(() => {
|
|||||||
behaviorSources: behavior.querySelectorAll("[data-behavior-source] option").length,
|
behaviorSources: behavior.querySelectorAll("[data-behavior-source] option").length,
|
||||||
behaviorEdges: behavior.querySelectorAll("[data-behavior-map-edge]").length,
|
behaviorEdges: behavior.querySelectorAll("[data-behavior-map-edge]").length,
|
||||||
behaviorDeviceCells: behavior.querySelectorAll(".layer-device-map > span").length,
|
behaviorDeviceCells: behavior.querySelectorAll(".layer-device-map > span").length,
|
||||||
|
completionDepthTabs: completionDepth.querySelectorAll("[data-cd-tab]").length,
|
||||||
|
completionDepthHiddenStages: completionDepth.querySelectorAll("[data-hidden-stage]").length,
|
||||||
|
completionDepthRouterLayers: completionDepth.querySelectorAll("[data-router-layer]").length,
|
||||||
artifactHeatCells: artifact.querySelectorAll("[data-route-heatmap] > span").length,
|
artifactHeatCells: artifact.querySelectorAll("[data-route-heatmap] > span").length,
|
||||||
corpusCohorts: artifact.querySelectorAll("[data-corpus-cohort]").length,
|
corpusCohorts: artifact.querySelectorAll("[data-corpus-cohort]").length,
|
||||||
lengthDeltaCards: artifact.querySelectorAll("[data-length-delta-grid] > article").length,
|
lengthDeltaCards: artifact.querySelectorAll("[data-length-delta-grid] > article").length,
|
||||||
@@ -975,7 +1063,7 @@ const mobile = await evaluate(`(() => {
|
|||||||
roleBlockDomainCards: artifact.querySelectorAll("[data-role-block-domain-grid] > article").length,
|
roleBlockDomainCards: artifact.querySelectorAll("[data-role-block-domain-grid] > article").length,
|
||||||
roleBlockDepthCells: artifact.querySelectorAll("[data-role-block-depth-map] > div > span").length,
|
roleBlockDepthCells: artifact.querySelectorAll("[data-role-block-depth-map] > div > span").length,
|
||||||
offenders: [...document.querySelectorAll("body *")]
|
offenders: [...document.querySelectorAll("body *")]
|
||||||
.filter((node) => !node.closest(".paper-chain, .advantage-table, .precision-table, .mapping-table, [data-deepseek-lab], [data-dsv2-lab], [data-behavior-lab]"))
|
.filter((node) => !node.closest(".paper-chain, .advantage-table, .precision-table, .mapping-table, [data-deepseek-lab], [data-dsv2-lab], [data-behavior-lab], [data-completion-depth-lab]"))
|
||||||
.filter((node) => node.getBoundingClientRect().right > document.documentElement.clientWidth + 1)
|
.filter((node) => node.getBoundingClientRect().right > document.documentElement.clientWidth + 1)
|
||||||
.slice(0, 12)
|
.slice(0, 12)
|
||||||
.map((node) => ({
|
.map((node) => ({
|
||||||
@@ -1107,20 +1195,29 @@ await evaluate(`(() => {
|
|||||||
})()`);
|
})()`);
|
||||||
await pause(180);
|
await pause(180);
|
||||||
await screenshot("/tmp/llm-atlas-deepseek-behavior-mobile.png");
|
await screenshot("/tmp/llm-atlas-deepseek-behavior-mobile.png");
|
||||||
|
await evaluate(`(() => {
|
||||||
|
const completionDepth = document.querySelector("[data-completion-depth-lab]");
|
||||||
|
completionDepth.querySelector('[data-cd-tab="router"]').click();
|
||||||
|
completionDepth.scrollIntoView({ block: "start", behavior: "instant" });
|
||||||
|
window.scrollBy(0, -70);
|
||||||
|
})()`);
|
||||||
|
await pause(180);
|
||||||
|
await screenshot("/tmp/llm-atlas-deepseek-completion-depth-mobile.png");
|
||||||
|
|
||||||
const report = { overview, capacity, cache, codesign, rl, artifactRoute, artifactLoad, artifactCache, artifactAbsorb, artifactCorpus, artifactTemplate, artifactHistory, artifactDistance, artifactBoundary, artifactRole, artifactSpecial, artifactRoleBlock, artifactEvidence, behavior, home, papers, mobile, exceptions };
|
const report = { overview, capacity, cache, codesign, rl, artifactRoute, artifactLoad, artifactCache, artifactAbsorb, artifactCorpus, artifactTemplate, artifactHistory, artifactDistance, artifactBoundary, artifactRole, artifactSpecial, artifactRoleBlock, artifactEvidence, behavior, completionDepth, home, papers, mobile, exceptions };
|
||||||
console.log(JSON.stringify(report, null, 2));
|
console.log(JSON.stringify(report, null, 2));
|
||||||
|
|
||||||
const numeric = (text) => Number.parseFloat(text.replaceAll(",", ""));
|
const numeric = (text) => Number.parseFloat(text.replaceAll(",", ""));
|
||||||
const failures = [];
|
const failures = [];
|
||||||
if (!overview.title.includes("为什么转向")) failures.push("专题标题异常");
|
if (!overview.title.includes("为什么转向")) failures.push("专题标题异常");
|
||||||
if (overview.sections !== 27 || overview.tocLinks !== 27) failures.push("二十六个编号专题加阅读链的目录结构异常");
|
if (overview.sections !== 28 || overview.tocLinks !== 28) failures.push("二十七个编号专题加阅读链的目录结构异常");
|
||||||
if (overview.ledgers !== 24 || overview.waves !== 10) failures.push("二十四张问题账或十次转向结构异常");
|
if (overview.ledgers !== 24 || overview.waves !== 10) failures.push("二十四张问题账或十次转向结构异常");
|
||||||
if (overview.paperLinks !== 60 || overview.branches !== 5 || overview.followups !== 1) failures.push("论文链、旁支或公开后续标记异常");
|
if (overview.paperLinks !== 60 || overview.branches !== 5 || overview.followups !== 1) failures.push("论文链、旁支或公开后续标记异常");
|
||||||
if (overview.labTabs !== 4 || overview.labPanels !== 4) failures.push("四联实验结构异常");
|
if (overview.labTabs !== 4 || overview.labPanels !== 4) failures.push("四联实验结构异常");
|
||||||
if (overview.artifactTabs !== 13 || overview.artifactPanels !== 13 || overview.artifactLayers !== 27) failures.push("真实权重十三联实验结构异常");
|
if (overview.artifactTabs !== 13 || overview.artifactPanels !== 13 || overview.artifactLayers !== 27) failures.push("真实权重十三联实验结构异常");
|
||||||
if (overview.behaviorTabs !== 4 || overview.behaviorPanels !== 4 || overview.behaviorSources !== 16 || overview.behaviorEdges !== 10) failures.push("Chat 行为实验结构异常");
|
if (overview.behaviorTabs !== 4 || overview.behaviorPanels !== 4 || overview.behaviorSources !== 16 || overview.behaviorEdges !== 10) failures.push("Chat 行为实验结构异常");
|
||||||
if (overview.heroLabs !== "18 个可操作实验") failures.push("DeepSeek 实验总数账异常");
|
if (overview.completionDepthTabs !== 4 || overview.completionDepthPanels !== 4 || overview.hiddenStages !== 29 || overview.routerLayers !== 26) failures.push("Chat 完成度与全深度实验结构异常");
|
||||||
|
if (overview.heroLabs !== "19 个可操作实验") failures.push("DeepSeek 实验总数账异常");
|
||||||
if (overview.navLinks !== 20 || home.navLinks !== 20 || mobile.mobileLinks !== 20 || overview.activeNav !== "DeepSeek") failures.push("全站导航未同步 DeepSeek");
|
if (overview.navLinks !== 20 || home.navLinks !== 20 || mobile.mobileLinks !== 20 || overview.activeNav !== "DeepSeek") failures.push("全站导航未同步 DeepSeek");
|
||||||
if (overview.documentOverflow > 1 || mobile.documentOverflow > 1) failures.push("桌面或移动端存在文档级横向溢出");
|
if (overview.documentOverflow > 1 || mobile.documentOverflow > 1) failures.push("桌面或移动端存在文档级横向溢出");
|
||||||
if (capacity.initial.panel !== "capacity" || capacity.initial.total !== "32.1× FFN" || capacity.initial.active !== "1.13× FFN") failures.push("V3 稀疏容量初始账异常");
|
if (capacity.initial.panel !== "capacity" || capacity.initial.total !== "32.1× FFN" || capacity.initial.active !== "1.13× FFN") failures.push("V3 稀疏容量初始账异常");
|
||||||
@@ -1213,9 +1310,14 @@ if (behavior.mathMap.panel !== "map" || behavior.mathMap.rows !== 10 || !behavio
|
|||||||
if (behavior.execution.panel !== "execution" || behavior.execution.layers !== 29 || behavior.execution.gpu !== 25 || behavior.execution.cpu !== 4 || behavior.execution.runtimeCards !== 4) failures.push("Chat BF16 GPU / CPU offload 设备图异常");
|
if (behavior.execution.panel !== "execution" || behavior.execution.layers !== 29 || behavior.execution.gpu !== 25 || behavior.execution.cpu !== 4 || behavior.execution.runtimeCards !== 4) failures.push("Chat BF16 GPU / CPU offload 设备图异常");
|
||||||
if (behavior.boundary.panel !== "boundary" || behavior.boundary.ladder !== 3 || behavior.boundary.tokenCards !== 4 || behavior.boundary.reproCards !== 4 || behavior.boundary.links !== 3 || !behavior.boundary.forbidden.includes("route TV")) failures.push("Chat 行为证据阶梯或限制异常");
|
if (behavior.boundary.panel !== "boundary" || behavior.boundary.ladder !== 3 || behavior.boundary.tokenCards !== 4 || behavior.boundary.reproCards !== 4 || behavior.boundary.links !== 3 || !behavior.boundary.forbidden.includes("route TV")) failures.push("Chat 行为证据阶梯或限制异常");
|
||||||
if (behavior.keyboardSelected !== "map" || behavior.keyboardVisible !== "map") failures.push("Chat 行为实验键盘 tab 导航异常");
|
if (behavior.keyboardSelected !== "map" || behavior.keyboardVisible !== "map") failures.push("Chat 行为实验键盘 tab 导航异常");
|
||||||
|
if (completionDepth.initial.panel !== "completion" || completionDepth.initial.conditionRows !== 8 || completionDepth.initial.incompleteRows !== 7 || completionDepth.initial.prefixCards !== 3) failures.push("512-token 完成度阶梯结构异常");
|
||||||
|
if (completionDepth.tasks.panel !== "tasks" || completionDepth.tasks.mathCards !== 4 || completionDepth.tasks.codeCards !== 4 || completionDepth.tasks.mathTotal !== "3 / 4 PASS" || completionDepth.tasks.codeTotal !== "2 / 4 PASS" || completionDepth.tasks.sandboxSteps !== 4) failures.push("Math / HumanEval 完成感知评测切换异常");
|
||||||
|
if (completionDepth.hidden.panel !== "hidden" || completionDepth.hidden.stages !== 29 || completionDepth.hidden.selected !== "layer_07" || completionDepth.hidden.points !== 29 || completionDepth.hidden.exact === "1,537 / 1,537" || numeric(completionDepth.hidden.relative) <= 0) failures.push("29 阶段隐藏状态曲线或交互异常");
|
||||||
|
if (completionDepth.router.panel !== "router" || completionDepth.router.layers !== 26 || completionDepth.router.selected !== "layer 24" || completionDepth.router.points !== 26 || !completionDepth.router.ordered.includes("%") || !completionDepth.router.setExact.includes("%") || numeric(completionDepth.router.tv) <= 0 || completionDepth.router.reproCards !== 4 || completionDepth.router.links !== 4) failures.push("26 层 MoE 路由曲线或复跑证据异常");
|
||||||
|
if (completionDepth.keyboardSelected !== "tasks" || completionDepth.keyboardVisible !== "tasks") failures.push("完成度与全深度实验键盘 tab 导航异常");
|
||||||
if (home.releaseCards !== 17 || !home.firstRelease.includes("47 页不再压成摘要") || home.firstHref !== "/k3/" || home.paperCount !== "486") failures.push("首页 DeepSeek 首发入口或论文数异常");
|
if (home.releaseCards !== 17 || !home.firstRelease.includes("47 页不再压成摘要") || home.firstHref !== "/k3/" || home.paperCount !== "486") failures.push("首页 DeepSeek 首发入口或论文数异常");
|
||||||
if (papers.total !== 486 || !papers.hasFilter || papers.visible < 20 || !papers.hasCoder || !papers.hasEngram) failures.push("论文库 DeepSeek 聚光异常");
|
if (papers.total !== 486 || !papers.hasFilter || papers.visible < 20 || !papers.hasCoder || !papers.hasEngram) failures.push("论文库 DeepSeek 聚光异常");
|
||||||
if (!mobile.menuVisible || mobile.menuOpen !== "true" || mobile.tabs !== 4 || mobile.artifactTabs !== 13 || mobile.behaviorTabs !== 4 || mobile.behaviorSources !== 16 || mobile.behaviorEdges !== 10 || mobile.behaviorDeviceCells !== 29 || mobile.artifactHeatCells !== 64 || mobile.corpusCohorts !== 3 || mobile.lengthDeltaCards !== 4 || mobile.templateLayers !== 6 || mobile.templateScopes !== 2 || mobile.templateModes !== 2 || mobile.templateDomainCards !== 4 || mobile.templateDepthCells !== 24 || mobile.historyLayers !== 6 || mobile.historyScopes !== 2 || mobile.historyModes !== 2 || mobile.historyEffects !== 3 || mobile.historyDomainCards !== 4 || mobile.historyDepthCells !== 24 || mobile.distanceLayers !== 6 || mobile.distanceScopes !== 2 || mobile.distanceModes !== 2 || mobile.distanceContrasts !== 2 || mobile.distanceDomainCards !== 4 || mobile.distanceDepthCells !== 24 || mobile.boundaryLayers !== 6 || mobile.boundaryScopes !== 2 || mobile.boundaryModes !== 2 || mobile.boundaryContrasts !== 3 || mobile.boundaryTokenCards !== 4 || mobile.boundaryDomainCards !== 4 || mobile.boundaryDepthCells !== 24 || mobile.roleLayers !== 6 || mobile.roleScopes !== 2 || mobile.roleModes !== 2 || mobile.roleContrasts !== 3 || mobile.roleLevelCards !== 4 || mobile.roleDomainCards !== 4 || mobile.roleDepthCells !== 24 || mobile.specialLayers !== 6 || mobile.specialScopes !== 2 || mobile.specialModes !== 2 || mobile.specialContrasts !== 4 || mobile.specialTokenCards !== 4 || mobile.specialDomainCards !== 4 || mobile.specialDepthCells !== 24 || mobile.roleBlockLayers !== 6 || mobile.roleBlockScopes !== 2 || mobile.roleBlockModes !== 2 || mobile.roleBlockEffects !== 3 || mobile.roleBlockMatrixCards !== 4 || mobile.roleBlockDomainCards !== 4 || mobile.roleBlockDepthCells !== 24) failures.push("移动端导航或实验异常");
|
if (!mobile.menuVisible || mobile.menuOpen !== "true" || mobile.tabs !== 4 || mobile.artifactTabs !== 13 || mobile.behaviorTabs !== 4 || mobile.behaviorSources !== 16 || mobile.behaviorEdges !== 10 || mobile.behaviorDeviceCells !== 29 || mobile.completionDepthTabs !== 4 || mobile.completionDepthHiddenStages !== 29 || mobile.completionDepthRouterLayers !== 26 || mobile.artifactHeatCells !== 64 || mobile.corpusCohorts !== 3 || mobile.lengthDeltaCards !== 4 || mobile.templateLayers !== 6 || mobile.templateScopes !== 2 || mobile.templateModes !== 2 || mobile.templateDomainCards !== 4 || mobile.templateDepthCells !== 24 || mobile.historyLayers !== 6 || mobile.historyScopes !== 2 || mobile.historyModes !== 2 || mobile.historyEffects !== 3 || mobile.historyDomainCards !== 4 || mobile.historyDepthCells !== 24 || mobile.distanceLayers !== 6 || mobile.distanceScopes !== 2 || mobile.distanceModes !== 2 || mobile.distanceContrasts !== 2 || mobile.distanceDomainCards !== 4 || mobile.distanceDepthCells !== 24 || mobile.boundaryLayers !== 6 || mobile.boundaryScopes !== 2 || mobile.boundaryModes !== 2 || mobile.boundaryContrasts !== 3 || mobile.boundaryTokenCards !== 4 || mobile.boundaryDomainCards !== 4 || mobile.boundaryDepthCells !== 24 || mobile.roleLayers !== 6 || mobile.roleScopes !== 2 || mobile.roleModes !== 2 || mobile.roleContrasts !== 3 || mobile.roleLevelCards !== 4 || mobile.roleDomainCards !== 4 || mobile.roleDepthCells !== 24 || mobile.specialLayers !== 6 || mobile.specialScopes !== 2 || mobile.specialModes !== 2 || mobile.specialContrasts !== 4 || mobile.specialTokenCards !== 4 || mobile.specialDomainCards !== 4 || mobile.specialDepthCells !== 24 || mobile.roleBlockLayers !== 6 || mobile.roleBlockScopes !== 2 || mobile.roleBlockModes !== 2 || mobile.roleBlockEffects !== 3 || mobile.roleBlockMatrixCards !== 4 || mobile.roleBlockDomainCards !== 4 || mobile.roleBlockDepthCells !== 24) failures.push("移动端导航或实验异常");
|
||||||
if (mobile.offenders.length) failures.push(`移动端越界元素:${JSON.stringify(mobile.offenders)}`);
|
if (mobile.offenders.length) failures.push(`移动端越界元素:${JSON.stringify(mobile.offenders)}`);
|
||||||
if (exceptions.length) failures.push(`浏览器异常:${exceptions.join(" | ")}`);
|
if (exceptions.length) failures.push(`浏览器异常:${exceptions.join(" | ")}`);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,851 @@
|
|||||||
|
---
|
||||||
|
import rawLab from "@/data/deepseek-v2-lite-chat-completion-depth-compact.json";
|
||||||
|
|
||||||
|
const lab = rawLab as any;
|
||||||
|
const json = JSON.stringify(lab).replaceAll("<", "\\u003c");
|
||||||
|
const conditions = [
|
||||||
|
"s0_eos",
|
||||||
|
"s1_eos",
|
||||||
|
"s0_bos",
|
||||||
|
"s1_bos",
|
||||||
|
"s0_x",
|
||||||
|
"s1_x",
|
||||||
|
"s0_period",
|
||||||
|
"s1_period",
|
||||||
|
];
|
||||||
|
const conditionLabels: Record<string, string> = {
|
||||||
|
s0_eos: "S0 · EOS",
|
||||||
|
s1_eos: "S1 · EOS",
|
||||||
|
s0_bos: "S0 · BOS",
|
||||||
|
s1_bos: "S1 · BOS",
|
||||||
|
s0_x: "S0 · x",
|
||||||
|
s1_x: "S1 · x",
|
||||||
|
s0_period: "S0 · 句点",
|
||||||
|
s1_period: "S1 · 句点",
|
||||||
|
};
|
||||||
|
const firstHidden = lab.depth.hiddenSeries.all.system_eos;
|
||||||
|
const firstRouter = lab.depth.routerSeries.all.system_eos;
|
||||||
|
const shortStage = (stage: string) => (
|
||||||
|
stage === "embedding"
|
||||||
|
? "E"
|
||||||
|
: stage === "final_norm"
|
||||||
|
? "N"
|
||||||
|
: `L${Number(stage.slice(-2))}`
|
||||||
|
);
|
||||||
|
---
|
||||||
|
|
||||||
|
<figure class="completion-depth-lab" data-completion-depth-lab>
|
||||||
|
<header class="cd-head">
|
||||||
|
<div>
|
||||||
|
<p>ROUND 05 / COMPLETION × FULL DEPTH</p>
|
||||||
|
<h3>一句输出怎样穿过 27 层:完成、答对、表示、路由分四张账</h3>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
同一官方 SFT Chat checkpoint、同 16 条完整 source、同八格输入。
|
||||||
|
先把统一预算升到 512,再沿 embedding → 27 decoder layers → final norm
|
||||||
|
追踪隐藏状态,并读取 26 个 MoE gate。每个数字都能回到原始 JSON 与独立复跑。
|
||||||
|
</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="cd-ledger">
|
||||||
|
<article class="pass"><span>512 · NATURAL EOS</span><b>121 / 128</b><p>128-token 时只有 31 / 128</p></article>
|
||||||
|
<article><span>MATH · STRICT</span><b>23 / 32</b><p>4 tasks × 8 conditions</p></article>
|
||||||
|
<article><span>CODE · TESTS PASS</span><b>24 / 32</b><p>官方 HumanEval tests</p></article>
|
||||||
|
<article><span>HIDDEN TRACE</span><b>29 stages</b><p>embedding + 27 layers + norm</p></article>
|
||||||
|
<article><span>ROUTER TRACE</span><b>1,918,176</b><p>target top-6 decisions</p></article>
|
||||||
|
<article class="pass"><span>FRESH-PROCESS RERUN</span><b>5,184 hashes</b><p>hidden + route + weights exact</p></article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cd-tabs" role="tablist" aria-label="选择完整生成与深度追踪视图">
|
||||||
|
<button type="button" role="tab" data-cd-tab="completion" aria-selected="true">
|
||||||
|
<span>01</span><b>完成度阶梯</b><small>128 → 512</small>
|
||||||
|
</button>
|
||||||
|
<button type="button" role="tab" data-cd-tab="tasks" aria-selected="false" tabindex="-1">
|
||||||
|
<span>02</span><b>答案真的对吗</b><small>Math + Code</small>
|
||||||
|
</button>
|
||||||
|
<button type="button" role="tab" data-cd-tab="hidden" aria-selected="false" tabindex="-1">
|
||||||
|
<span>03</span><b>表示怎样分叉</b><small>29 hidden stages</small>
|
||||||
|
</button>
|
||||||
|
<button type="button" role="tab" data-cd-tab="router" aria-selected="false" tabindex="-1">
|
||||||
|
<span>04</span><b>专家怎样换路</b><small>26 MoE gates</small>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section class="cd-panel" data-cd-panel="completion">
|
||||||
|
<div class="cd-panel-lead">
|
||||||
|
<div><span>I / STOPPING LEDGER</span><h4>长度上限不是 EOS,更不是错误答案</h4></div>
|
||||||
|
<p>
|
||||||
|
两次运行都对全部 128 格使用统一预算;不是只给先前截断的 97 格“续杯”。
|
||||||
|
512 解决了大部分截断,但仍有 7 格没有自然结束。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="budget-ladder" aria-label="128 与 512 token 完成度比较">
|
||||||
|
{lab.completion.budgetLadder.map((budget: any) => (
|
||||||
|
<article>
|
||||||
|
<header><span>MAX NEW TOKENS</span><b>{budget.maxNewTokens}</b></header>
|
||||||
|
<div class="budget-track">
|
||||||
|
<i style={`--complete:${budget.naturalEos / budget.outputs * 100}%`}></i>
|
||||||
|
</div>
|
||||||
|
<dl>
|
||||||
|
<div><dt>NATURAL EOS</dt><dd>{budget.naturalEos} / {budget.outputs}</dd></div>
|
||||||
|
<div><dt>BUDGET TRUNCATED</dt><dd>{budget.truncated} / {budget.outputs}</dd></div>
|
||||||
|
</dl>
|
||||||
|
</article>
|
||||||
|
))}
|
||||||
|
<div class="budget-arrow"><span>统一重跑</span><b>+90</b><small>新增自然 EOS</small></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="condition-table">
|
||||||
|
<header><b>CONDITION</b><b>NATURAL EOS</b><b>MEAN TOKENS</b><b>MATH STRICT</b><b>CODE PASS</b></header>
|
||||||
|
{conditions.map((condition) => {
|
||||||
|
const row = lab.completion.summary.by_condition[condition];
|
||||||
|
return (
|
||||||
|
<div data-completion-condition={condition}>
|
||||||
|
<span>{conditionLabels[condition]}</span>
|
||||||
|
<b class={row.natural_eos === 16 ? "good" : ""}>{row.natural_eos} / 16</b>
|
||||||
|
<b>{row.mean_generated_tokens.toFixed(1)}</b>
|
||||||
|
<b>{row.math_strict_complete_exact} / {row.math_sources}</b>
|
||||||
|
<b>{row.code_tests_pass} / {row.code_sources}</b>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="incomplete-ledger">
|
||||||
|
<header><span>仍未解决的 7 格</span><p>6 个 English continuation + 1 个未闭合的 HumanEval code fence</p></header>
|
||||||
|
<div>
|
||||||
|
{lab.completion.incompleteRows.map((row: any) => (
|
||||||
|
<article>
|
||||||
|
<b>{row.sourceId}</b>
|
||||||
|
<span>{conditionLabels[row.condition]} · {row.generatedTokens} tokens</span>
|
||||||
|
<em>{row.domain === "code" ? "AST FAIL · NOT RUN" : "NO EOS"}</em>
|
||||||
|
</article>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="prefix-gate">
|
||||||
|
<article><span>BASELINE PROMPT HASH</span><b>128 / 128 EXACT</b><p>输入身份没有漂移</p></article>
|
||||||
|
<article><span>FIRST 128 GENERATED TOKENS</span><b>128 / 128 EXACT</b><p>512 运行完整复现短预算前缀</p></article>
|
||||||
|
<article><span>INDEPENDENT LONG RERUN</span><b>32 / 32 EXACT</b><p>完整 token IDs、文本与停止状态</p></article>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="cd-panel" data-cd-panel="tasks" hidden>
|
||||||
|
<div class="cd-panel-lead">
|
||||||
|
<div><span>II / TASK LEDGER</span><h4>把“可解析”与“通过官方测试”分开</h4></div>
|
||||||
|
<p>
|
||||||
|
数学按 final marker 优先抽取,最后数字只作 fallback;代码先抽取与 AST parse,
|
||||||
|
再逐 candidate 进入无网络、只读、无 host mount 的新容器。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="task-control">
|
||||||
|
<label>
|
||||||
|
<span>选择八格条件</span>
|
||||||
|
<select data-task-condition aria-label="选择任务评测条件">
|
||||||
|
{conditions.map((condition) => (
|
||||||
|
<option value={condition}>{conditionLabels[condition]}</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<div>
|
||||||
|
<span>读格子</span>
|
||||||
|
<p><i class="pass"></i>通过 / exact <i class="fail"></i>执行但失败 <i class="warn"></i>fallback 或未执行</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="task-columns">
|
||||||
|
<article>
|
||||||
|
<header><span>GSM8K · 4 SOURCES</span><b data-math-condition-total>—</b></header>
|
||||||
|
<div class="task-grid" data-math-task-grid></div>
|
||||||
|
<div class="task-summary">
|
||||||
|
<div><span>STRICT EXACT / ALL CELLS</span><b>{lab.completion.taskTotals.math.strictCorrect} / 32</b></div>
|
||||||
|
<p>20 boxed · 8 answer phrase · 4 last-number fallback</p>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
<article>
|
||||||
|
<header><span>HUMANEVAL · 4 SOURCES</span><b data-code-condition-total>—</b></header>
|
||||||
|
<div class="task-grid" data-code-task-grid></div>
|
||||||
|
<div class="task-summary">
|
||||||
|
<div><span>OFFICIAL TESTS PASS / ALL CELLS</span><b>{lab.completion.taskTotals.code.testsPassed} / 32</b></div>
|
||||||
|
<p>24 pass · 5 assertion · 2 runtime · 1 not run</p>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sandbox-flow">
|
||||||
|
<article><span>01 / EXTRACT</span><b>final marker / code fence</b><p>gold 与 tests 从不进入 prompt</p></article>
|
||||||
|
<i>→</i>
|
||||||
|
<article><span>02 / STATIC</span><b>Decimal / Python AST</b><p>先确认结果能被判定</p></article>
|
||||||
|
<i>→</i>
|
||||||
|
<article class="active"><span>03 / FRESH CONTAINER</span><b>network none · read-only</b><p>65534 · cap drop ALL · no mounts</p></article>
|
||||||
|
<i>→</i>
|
||||||
|
<article><span>04 / OFFICIAL CHECK</span><b>5s · 256MiB · 0.5 CPU</b><p>pass 只是功能证据,不是安全证明</p></article>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="cd-panel" data-cd-panel="hidden" hidden>
|
||||||
|
<div class="cd-panel-lead">
|
||||||
|
<div><span>III / REPRESENTATION DEPTH</span><h4>目标 token 相同,何时开始“不再是同一个状态”</h4></div>
|
||||||
|
<p>
|
||||||
|
embedding 是逐 token lookup,所以 10 条 edge 的 15,370 个目标行全部 exact;
|
||||||
|
进入 layer 00 后,前文开始通过 attention 混入,十条 edge 的 exact rows 都变成 0。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="depth-controls">
|
||||||
|
<label><span>对比边</span><select data-hidden-edge aria-label="选择隐藏状态对比边">
|
||||||
|
{lab.contract.edgeOrder.map((edge: string) => (
|
||||||
|
<option value={edge}>{lab.contract.edgeLabels[edge]}</option>
|
||||||
|
))}
|
||||||
|
</select></label>
|
||||||
|
<label><span>聚合域</span><select data-hidden-domain aria-label="选择隐藏状态聚合域">
|
||||||
|
<option value="all">四域合计 · n=16</option>
|
||||||
|
<option value="english">English · n=4</option>
|
||||||
|
<option value="chinese">Chinese · n=4</option>
|
||||||
|
<option value="code">Code · n=4</option>
|
||||||
|
<option value="math">Math · n=4</option>
|
||||||
|
</select></label>
|
||||||
|
<label><span>纵轴</span><select data-hidden-metric aria-label="选择隐藏状态指标">
|
||||||
|
<option value="divergence">1 − cosine · %</option>
|
||||||
|
<option value="relative">relative L2 · %</option>
|
||||||
|
<option value="maxabs">max absolute delta</option>
|
||||||
|
</select></label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="depth-chart">
|
||||||
|
<header><span data-hidden-chart-title>System on − off · EOS</span><b data-hidden-chart-domain>四域合计</b></header>
|
||||||
|
<svg viewBox="0 0 840 270" role="img" aria-label="29 个隐藏状态阶段的差异曲线">
|
||||||
|
<g class="chart-grid">
|
||||||
|
<line x1="42" y1="34" x2="820" y2="34"></line>
|
||||||
|
<line x1="42" y1="126" x2="820" y2="126"></line>
|
||||||
|
<line x1="42" y1="218" x2="820" y2="218"></line>
|
||||||
|
</g>
|
||||||
|
<text x="4" y="38" data-hidden-ymax>—</text>
|
||||||
|
<text x="4" y="130" data-hidden-ymid>—</text>
|
||||||
|
<text x="18" y="222">0</text>
|
||||||
|
<polyline data-hidden-line points="" />
|
||||||
|
<circle data-hidden-focus cx="42" cy="218" r="5" />
|
||||||
|
<text x="42" y="249">E</text><text x="70" y="249">L0</text>
|
||||||
|
<text x="182" y="249">L4</text><text x="294" y="249">L8</text>
|
||||||
|
<text x="406" y="249">L12</text><text x="518" y="249">L16</text>
|
||||||
|
<text x="630" y="249">L20</text><text x="742" y="249">L24</text>
|
||||||
|
<text x="808" y="249">N</text>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="depth-strip" data-hidden-strip>
|
||||||
|
{firstHidden.map((row: any, index: number) => (
|
||||||
|
<button type="button" data-hidden-stage={index} title={row.stage}>
|
||||||
|
<span>{shortStage(row.stage)}</span><i></i>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="depth-reading">
|
||||||
|
<article><span>SELECTED STAGE</span><b data-hidden-stage-name>embedding</b><p data-hidden-stage-note>逐 token lookup;目标 IDs 相同</p></article>
|
||||||
|
<article><span>MEAN COSINE</span><b data-hidden-cosine>1.000000</b><p>token-weighted</p></article>
|
||||||
|
<article><span>MEAN RELATIVE L2</span><b data-hidden-relative>0.0000%</b><p>4/16 source mean</p></article>
|
||||||
|
<article><span>EXACT ROWS</span><b data-hidden-exact>1,537 / 1,537</b><p>byte-exact BF16 rows</p></article>
|
||||||
|
<article><span>MAX |Δ|</span><b data-hidden-maxabs>0</b><p>本阶段目标内容范围</p></article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="depth-boundary">
|
||||||
|
<b>为什么只看 interior content token</b>
|
||||||
|
<p>
|
||||||
|
tokenizer 有 56 个 token 横跨字符边界,已排除;留下的 1,537 个 token / condition
|
||||||
|
在八格中 ID 序列完全一致。否则“同位置”未必是“同 token”。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="cd-panel" data-cd-panel="router" hidden>
|
||||||
|
<div class="cd-panel-lead">
|
||||||
|
<div><span>IV / ROUTER DEPTH</span><h4>表示轻微转动,也可能换掉 top-6 专家排序</h4></div>
|
||||||
|
<p>
|
||||||
|
ordered exact 要求六个专家与顺序都相同;set exact 只要求集合相同;
|
||||||
|
weighted TV 还读取门控权重。三者回答不同问题,不能只挑一列讲故事。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="depth-controls">
|
||||||
|
<label><span>对比边</span><select data-router-edge aria-label="选择路由对比边">
|
||||||
|
{lab.contract.edgeOrder.map((edge: string) => (
|
||||||
|
<option value={edge}>{lab.contract.edgeLabels[edge]}</option>
|
||||||
|
))}
|
||||||
|
</select></label>
|
||||||
|
<label><span>聚合域</span><select data-router-domain aria-label="选择路由聚合域">
|
||||||
|
<option value="all">四域合计 · n=16</option>
|
||||||
|
<option value="english">English · n=4</option>
|
||||||
|
<option value="chinese">Chinese · n=4</option>
|
||||||
|
<option value="code">Code · n=4</option>
|
||||||
|
<option value="math">Math · n=4</option>
|
||||||
|
</select></label>
|
||||||
|
<label><span>纵轴</span><select data-router-metric aria-label="选择路由指标">
|
||||||
|
<option value="ordered">ordered top-6 divergence · %</option>
|
||||||
|
<option value="set">expert-set divergence · %</option>
|
||||||
|
<option value="weighted">token-weighted TV · %</option>
|
||||||
|
<option value="load">aggregate load TV · %</option>
|
||||||
|
</select></label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="depth-chart router-chart">
|
||||||
|
<header><span data-router-chart-title>System on − off · EOS</span><b data-router-chart-domain>四域合计</b></header>
|
||||||
|
<svg viewBox="0 0 840 270" role="img" aria-label="26 个 MoE gate 的路由差异曲线">
|
||||||
|
<g class="chart-grid">
|
||||||
|
<line x1="42" y1="34" x2="820" y2="34"></line>
|
||||||
|
<line x1="42" y1="126" x2="820" y2="126"></line>
|
||||||
|
<line x1="42" y1="218" x2="820" y2="218"></line>
|
||||||
|
</g>
|
||||||
|
<text x="4" y="38" data-router-ymax>—</text>
|
||||||
|
<text x="4" y="130" data-router-ymid>—</text>
|
||||||
|
<text x="18" y="222">0</text>
|
||||||
|
<polyline data-router-line points="" />
|
||||||
|
<circle data-router-focus cx="42" cy="218" r="5" />
|
||||||
|
<text x="42" y="249">L1</text><text x="162" y="249">L5</text>
|
||||||
|
<text x="312" y="249">L10</text><text x="462" y="249">L15</text>
|
||||||
|
<text x="612" y="249">L20</text><text x="762" y="249">L25</text>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="depth-strip router-strip" data-router-strip>
|
||||||
|
{firstRouter.map((row: any, index: number) => (
|
||||||
|
<button type="button" data-router-layer={index} title={row.layer}>
|
||||||
|
<span>L{index + 1}</span><i></i>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="depth-reading router-reading">
|
||||||
|
<article><span>SELECTED GATE</span><b data-router-layer-name>layer 01</b><p>64 routed experts · top-6</p></article>
|
||||||
|
<article><span>ORDERED EXACT</span><b data-router-ordered>—</b><p>六个专家及顺序完全相同</p></article>
|
||||||
|
<article><span>SET EXACT</span><b data-router-set>—</b><p>忽略六个专家的顺序</p></article>
|
||||||
|
<article><span>MEAN JACCARD</span><b data-router-jaccard>—</b><p>逐 token 专家集合</p></article>
|
||||||
|
<article><span>WEIGHTED TV</span><b data-router-tv>—</b><p>top-6 门控质量变化</p></article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="repro-proof">
|
||||||
|
<article class="pass"><span>HIDDEN TENSOR HASHES</span><b>1,856 / 1,856</b><p>target + full input · fresh process</p></article>
|
||||||
|
<article class="pass"><span>ORDERED ROUTE HASHES</span><b>1,664 / 1,664</b><p>26 gates × 8 cells × 2 scopes × 4</p></article>
|
||||||
|
<article class="pass"><span>ROUTE-WEIGHT HASHES</span><b>1,664 / 1,664</b><p>BF16 gate weights exact</p></article>
|
||||||
|
<article><span>CLAIM BOUNDARY</span><b>association ≠ mediation</b><p>路由分叉不能自动解释输出或能力</p></article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="artifact-links">
|
||||||
|
<a href="https://huggingface.co/deepseek-ai/DeepSeek-V2-Lite-Chat" rel="noreferrer">官方 Chat checkpoint ↗</a>
|
||||||
|
<a href="https://git.k1412.top/wuyang/llm-atlas/src/branch/main/src/data/deepseek-v2-lite-chat-completion-512.json" rel="noreferrer">512 正式 generation JSON ↗</a>
|
||||||
|
<a href="https://git.k1412.top/wuyang/llm-atlas/src/branch/main/src/data/deepseek-v2-lite-chat-full-depth.json" rel="noreferrer">36MB 全深度原始 JSON ↗</a>
|
||||||
|
<a href="https://git.k1412.top/wuyang/llm-atlas/src/branch/main/research/DEEPSEEK_V2_LITE_CHAT_COMPLETION_DEPTH_AUDIT.md" rel="noreferrer">完整审计与非结论 ↗</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<figcaption>
|
||||||
|
<span>X / OFFICIAL BF16 CHAT · COMPLETION-AWARE FULL-DEPTH TRACE</span>
|
||||||
|
revision <code>{lab.model.revision}</code>;512 formal
|
||||||
|
<code>{lab.artifacts.completion.sha256.slice(0, 16)}…</code>;
|
||||||
|
full-depth formal <code>{lab.artifacts.depth.sha256.slice(0, 16)}…</code>。
|
||||||
|
四域各 4 条是机制显微镜,不是 benchmark。
|
||||||
|
</figcaption>
|
||||||
|
|
||||||
|
<script is:inline type="application/json" data-cd-data set:html={json}></script>
|
||||||
|
</figure>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const cdRoots = document.querySelectorAll<HTMLElement>(
|
||||||
|
"[data-completion-depth-lab]",
|
||||||
|
);
|
||||||
|
const cdDomainLabels: Record<string, string> = {
|
||||||
|
all: "四域合计",
|
||||||
|
english: "English · n=4",
|
||||||
|
chinese: "Chinese · n=4",
|
||||||
|
code: "Code · n=4",
|
||||||
|
math: "Math · n=4",
|
||||||
|
};
|
||||||
|
|
||||||
|
cdRoots.forEach((root) => {
|
||||||
|
const payload = root.querySelector<HTMLScriptElement>("[data-cd-data]");
|
||||||
|
if (!payload) return;
|
||||||
|
const data = JSON.parse(payload.textContent ?? "{}");
|
||||||
|
const one = <T extends Element>(selector: string) => (
|
||||||
|
root.querySelector<T>(selector)
|
||||||
|
);
|
||||||
|
const all = <T extends Element>(selector: string) => (
|
||||||
|
[...root.querySelectorAll<T>(selector)]
|
||||||
|
);
|
||||||
|
const set = (selector: string, value: string) => {
|
||||||
|
const node = one<HTMLElement>(selector);
|
||||||
|
if (node) node.textContent = value;
|
||||||
|
};
|
||||||
|
const percent = (value: number, digits = 1) => (
|
||||||
|
`${(value * 100).toFixed(digits)}%`
|
||||||
|
);
|
||||||
|
|
||||||
|
const tabs = all<HTMLButtonElement>("[data-cd-tab]");
|
||||||
|
const panels = all<HTMLElement>("[data-cd-panel]");
|
||||||
|
const selectTab = (tab: HTMLButtonElement) => {
|
||||||
|
tabs.forEach((candidate) => {
|
||||||
|
const active = candidate === tab;
|
||||||
|
candidate.setAttribute("aria-selected", String(active));
|
||||||
|
candidate.tabIndex = active ? 0 : -1;
|
||||||
|
});
|
||||||
|
panels.forEach((panel) => {
|
||||||
|
panel.hidden = panel.dataset.cdPanel !== tab.dataset.cdTab;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
tabs.forEach((tab, index) => {
|
||||||
|
tab.addEventListener("click", () => selectTab(tab));
|
||||||
|
tab.addEventListener("keydown", (event) => {
|
||||||
|
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
let next = index;
|
||||||
|
if (event.key === "ArrowRight") next = (index + 1) % tabs.length;
|
||||||
|
if (event.key === "ArrowLeft") {
|
||||||
|
next = (index - 1 + tabs.length) % tabs.length;
|
||||||
|
}
|
||||||
|
if (event.key === "Home") next = 0;
|
||||||
|
if (event.key === "End") next = tabs.length - 1;
|
||||||
|
tabs[next].focus();
|
||||||
|
selectTab(tabs[next]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const taskCondition = one<HTMLSelectElement>("[data-task-condition]");
|
||||||
|
const taskRows = data.completion.taskRows;
|
||||||
|
const taskClass = (row: any) => {
|
||||||
|
if (row.domain === "math") {
|
||||||
|
if (row.taskEvaluation.strict_complete_numeric_exact) return "pass";
|
||||||
|
if (
|
||||||
|
row.taskEvaluation.fixed_budget_numeric_exact
|
||||||
|
|| row.taskEvaluation.extraction_method === "last_number_fallback"
|
||||||
|
) return "warn";
|
||||||
|
return "fail";
|
||||||
|
}
|
||||||
|
const status = row.taskEvaluation.execution?.status;
|
||||||
|
if (status === "passed") return "pass";
|
||||||
|
if (status === "not_run") return "warn";
|
||||||
|
return "fail";
|
||||||
|
};
|
||||||
|
const taskLabel = (row: any) => {
|
||||||
|
if (row.domain === "math") {
|
||||||
|
const evaluation = row.taskEvaluation;
|
||||||
|
if (evaluation.strict_complete_numeric_exact) {
|
||||||
|
return `${evaluation.predicted_final} · EXACT`;
|
||||||
|
}
|
||||||
|
if (evaluation.predicted_final != null) {
|
||||||
|
return `${evaluation.predicted_final} · WRONG/FALLBACK`;
|
||||||
|
}
|
||||||
|
return "UNRESOLVED";
|
||||||
|
}
|
||||||
|
return (row.taskEvaluation.execution?.status ?? "not_run")
|
||||||
|
.replaceAll("_", " ")
|
||||||
|
.toUpperCase();
|
||||||
|
};
|
||||||
|
const renderTaskGrid = (
|
||||||
|
domain: "math" | "code",
|
||||||
|
selector: string,
|
||||||
|
totalSelector: string,
|
||||||
|
) => {
|
||||||
|
const condition = taskCondition?.value ?? "s0_eos";
|
||||||
|
const rows = taskRows.filter(
|
||||||
|
(row: any) => (
|
||||||
|
row.domain === domain && row.condition === condition
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const container = one<HTMLElement>(selector);
|
||||||
|
if (!container) return;
|
||||||
|
container.replaceChildren(...rows.map((row: any) => {
|
||||||
|
const article = document.createElement("article");
|
||||||
|
article.className = taskClass(row);
|
||||||
|
const source = document.createElement("b");
|
||||||
|
source.textContent = row.sourceId;
|
||||||
|
const result = document.createElement("span");
|
||||||
|
result.textContent = taskLabel(row);
|
||||||
|
const completion = document.createElement("em");
|
||||||
|
completion.textContent = row.hitEos
|
||||||
|
? `${row.generatedTokens} TOKENS · EOS`
|
||||||
|
: `${row.generatedTokens} TOKENS · TRUNCATED`;
|
||||||
|
article.append(source, result, completion);
|
||||||
|
return article;
|
||||||
|
}));
|
||||||
|
const passing = rows.filter((row: any) => taskClass(row) === "pass").length;
|
||||||
|
set(totalSelector, `${passing} / ${rows.length} PASS`);
|
||||||
|
};
|
||||||
|
const renderTasks = () => {
|
||||||
|
renderTaskGrid(
|
||||||
|
"math",
|
||||||
|
"[data-math-task-grid]",
|
||||||
|
"[data-math-condition-total]",
|
||||||
|
);
|
||||||
|
renderTaskGrid(
|
||||||
|
"code",
|
||||||
|
"[data-code-task-grid]",
|
||||||
|
"[data-code-condition-total]",
|
||||||
|
);
|
||||||
|
};
|
||||||
|
taskCondition?.addEventListener("change", renderTasks);
|
||||||
|
|
||||||
|
type ChartConfig = {
|
||||||
|
kind: "hidden" | "router";
|
||||||
|
edge: HTMLSelectElement | null;
|
||||||
|
domain: HTMLSelectElement | null;
|
||||||
|
metric: HTMLSelectElement | null;
|
||||||
|
line: SVGPolylineElement | null;
|
||||||
|
focus: SVGCircleElement | null;
|
||||||
|
strip: HTMLElement | null;
|
||||||
|
selected: number;
|
||||||
|
};
|
||||||
|
const hiddenChart: ChartConfig = {
|
||||||
|
kind: "hidden",
|
||||||
|
edge: one("[data-hidden-edge]"),
|
||||||
|
domain: one("[data-hidden-domain]"),
|
||||||
|
metric: one("[data-hidden-metric]"),
|
||||||
|
line: one("[data-hidden-line]"),
|
||||||
|
focus: one("[data-hidden-focus]"),
|
||||||
|
strip: one("[data-hidden-strip]"),
|
||||||
|
selected: 0,
|
||||||
|
};
|
||||||
|
const routerChart: ChartConfig = {
|
||||||
|
kind: "router",
|
||||||
|
edge: one("[data-router-edge]"),
|
||||||
|
domain: one("[data-router-domain]"),
|
||||||
|
metric: one("[data-router-metric]"),
|
||||||
|
line: one("[data-router-line]"),
|
||||||
|
focus: one("[data-router-focus]"),
|
||||||
|
strip: one("[data-router-strip]"),
|
||||||
|
selected: 0,
|
||||||
|
};
|
||||||
|
const chartValues = (chart: ChartConfig, rows: any[]) => {
|
||||||
|
const metric = chart.metric?.value;
|
||||||
|
if (chart.kind === "hidden") {
|
||||||
|
if (metric === "relative") {
|
||||||
|
return rows.map((row) => row.meanRelativeL2 * 100);
|
||||||
|
}
|
||||||
|
if (metric === "maxabs") {
|
||||||
|
return rows.map((row) => row.maxAbsDelta);
|
||||||
|
}
|
||||||
|
return rows.map((row) => (1 - row.meanCosine) * 100);
|
||||||
|
}
|
||||||
|
if (metric === "set") {
|
||||||
|
return rows.map((row) => (1 - row.setExactRate) * 100);
|
||||||
|
}
|
||||||
|
if (metric === "weighted") {
|
||||||
|
return rows.map((row) => row.meanTokenWeightedTv * 100);
|
||||||
|
}
|
||||||
|
if (metric === "load") {
|
||||||
|
return rows.map((row) => row.meanAggregateLoadTv * 100);
|
||||||
|
}
|
||||||
|
return rows.map((row) => (1 - row.orderedExactRate) * 100);
|
||||||
|
};
|
||||||
|
const chartRows = (chart: ChartConfig) => {
|
||||||
|
const edge = chart.edge?.value ?? "system_eos";
|
||||||
|
const domain = chart.domain?.value ?? "all";
|
||||||
|
return chart.kind === "hidden"
|
||||||
|
? data.depth.hiddenSeries[domain][edge]
|
||||||
|
: data.depth.routerSeries[domain][edge];
|
||||||
|
};
|
||||||
|
const renderChart = (chart: ChartConfig) => {
|
||||||
|
const rows = chartRows(chart);
|
||||||
|
const values = chartValues(chart, rows);
|
||||||
|
const maxValue = Math.max(...values, 0.000001) * 1.12;
|
||||||
|
const x = (index: number) => (
|
||||||
|
42 + index * 778 / Math.max(1, rows.length - 1)
|
||||||
|
);
|
||||||
|
const y = (value: number) => 218 - value / maxValue * 184;
|
||||||
|
chart.line?.setAttribute(
|
||||||
|
"points",
|
||||||
|
values.map((value: number, index: number) => (
|
||||||
|
`${x(index).toFixed(2)},${y(value).toFixed(2)}`
|
||||||
|
)).join(" "),
|
||||||
|
);
|
||||||
|
const selected = Math.min(chart.selected, rows.length - 1);
|
||||||
|
chart.focus?.setAttribute("cx", x(selected).toFixed(2));
|
||||||
|
chart.focus?.setAttribute("cy", y(values[selected]).toFixed(2));
|
||||||
|
const prefix = chart.kind === "hidden" ? "hidden" : "router";
|
||||||
|
set(
|
||||||
|
`[data-${prefix}-ymax]`,
|
||||||
|
maxValue >= 10 ? maxValue.toFixed(0) : maxValue.toFixed(2),
|
||||||
|
);
|
||||||
|
set(
|
||||||
|
`[data-${prefix}-ymid]`,
|
||||||
|
maxValue >= 10
|
||||||
|
? (maxValue / 2).toFixed(0)
|
||||||
|
: (maxValue / 2).toFixed(2),
|
||||||
|
);
|
||||||
|
set(
|
||||||
|
`[data-${prefix}-chart-title]`,
|
||||||
|
data.contract.edgeLabels[chart.edge?.value ?? "system_eos"],
|
||||||
|
);
|
||||||
|
set(
|
||||||
|
`[data-${prefix}-chart-domain]`,
|
||||||
|
cdDomainLabels[chart.domain?.value ?? "all"],
|
||||||
|
);
|
||||||
|
const buttons = [
|
||||||
|
...(chart.strip?.querySelectorAll<HTMLButtonElement>("button") ?? []),
|
||||||
|
];
|
||||||
|
buttons.forEach((button, index) => {
|
||||||
|
const level = Math.max(0.04, values[index] / maxValue);
|
||||||
|
button.style.setProperty("--level", String(level));
|
||||||
|
button.classList.toggle("selected", index === selected);
|
||||||
|
const bar = button.querySelector<HTMLElement>("i");
|
||||||
|
if (bar) bar.style.height = `${Math.max(4, level * 100)}%`;
|
||||||
|
});
|
||||||
|
const row = rows[selected];
|
||||||
|
if (chart.kind === "hidden") {
|
||||||
|
set("[data-hidden-stage-name]", row.stage);
|
||||||
|
set("[data-hidden-stage-note]", row.stage === "embedding"
|
||||||
|
? "逐 token lookup;目标 IDs 相同"
|
||||||
|
: "上下文已通过 attention / residual 混入");
|
||||||
|
set("[data-hidden-cosine]", row.meanCosine.toFixed(6));
|
||||||
|
set("[data-hidden-relative]", percent(row.meanRelativeL2, 2));
|
||||||
|
set(
|
||||||
|
"[data-hidden-exact]",
|
||||||
|
`${row.exactRows.toLocaleString()} / ${row.tokens.toLocaleString()}`,
|
||||||
|
);
|
||||||
|
set("[data-hidden-maxabs]", row.maxAbsDelta.toFixed(5));
|
||||||
|
} else {
|
||||||
|
set("[data-router-layer-name]", row.layer.replace("_", " "));
|
||||||
|
set(
|
||||||
|
"[data-router-ordered]",
|
||||||
|
`${row.orderedExact.toLocaleString()} / ${row.tokens.toLocaleString()} · ${percent(row.orderedExactRate)}`,
|
||||||
|
);
|
||||||
|
set(
|
||||||
|
"[data-router-set]",
|
||||||
|
`${row.setExact.toLocaleString()} / ${row.tokens.toLocaleString()} · ${percent(row.setExactRate)}`,
|
||||||
|
);
|
||||||
|
set("[data-router-jaccard]", row.meanSetJaccard.toFixed(5));
|
||||||
|
set("[data-router-tv]", percent(row.meanTokenWeightedTv, 2));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
for (const chart of [hiddenChart, routerChart]) {
|
||||||
|
chart.edge?.addEventListener("change", () => renderChart(chart));
|
||||||
|
chart.domain?.addEventListener("change", () => renderChart(chart));
|
||||||
|
chart.metric?.addEventListener("change", () => renderChart(chart));
|
||||||
|
const attribute = chart.kind === "hidden"
|
||||||
|
? "data-hidden-stage"
|
||||||
|
: "data-router-layer";
|
||||||
|
chart.strip?.querySelectorAll<HTMLButtonElement>("button").forEach(
|
||||||
|
(button) => {
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
chart.selected = Number(button.getAttribute(attribute));
|
||||||
|
renderChart(chart);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderTasks();
|
||||||
|
renderChart(hiddenChart);
|
||||||
|
renderChart(routerChart);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.completion-depth-lab {
|
||||||
|
margin: 2.2rem 0 0;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(30, 38, 43, .16);
|
||||||
|
background: #f7f4ec;
|
||||||
|
box-shadow: 0 28px 70px rgba(22, 35, 43, .1);
|
||||||
|
}
|
||||||
|
.cd-head {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 2.4rem;
|
||||||
|
align-items: end;
|
||||||
|
padding: 2rem;
|
||||||
|
color: #f8f4e9;
|
||||||
|
background:
|
||||||
|
radial-gradient(circle at 76% 24%, rgba(178, 102, 64, .28), transparent 26%),
|
||||||
|
radial-gradient(circle at 18% 80%, rgba(67, 145, 132, .2), transparent 28%),
|
||||||
|
linear-gradient(135deg, #172c35, #253f47);
|
||||||
|
}
|
||||||
|
.cd-head p { margin: 0; color: rgba(255,255,255,.72); font-size: .77rem; line-height: 1.7; }
|
||||||
|
.cd-head > div > p { color: #84c6bb; font: 750 .61rem/1.2 var(--font-mono); letter-spacing: .1em; }
|
||||||
|
.cd-head h3 { max-width: 650px; margin: .75rem 0 0; color: white; font: 760 clamp(1.55rem,3vw,2.45rem)/1.14 var(--font-display); }
|
||||||
|
.cd-ledger { display: grid; grid-template-columns: repeat(6, 1fr); border-bottom: 1px solid rgba(30,38,43,.14); }
|
||||||
|
.cd-ledger article { min-width: 0; padding: 1rem; border-right: 1px solid rgba(30,38,43,.12); background: #ece8dd; }
|
||||||
|
.cd-ledger article:last-child { border-right: 0; }
|
||||||
|
.cd-ledger article.pass { background: rgba(54,128,108,.12); }
|
||||||
|
.cd-ledger span,
|
||||||
|
.task-summary span,
|
||||||
|
.depth-reading span,
|
||||||
|
.repro-proof span { display: block; color: #60706e; font: 720 .51rem/1.25 var(--font-mono); letter-spacing: .07em; }
|
||||||
|
.cd-ledger b { display: block; margin-top: .45rem; color: #182b33; font: 760 .78rem/1.25 var(--font-mono); }
|
||||||
|
.cd-ledger p { margin: .35rem 0 0; color: #68716f; font-size: .58rem; line-height: 1.4; }
|
||||||
|
.cd-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid rgba(30,38,43,.14); }
|
||||||
|
.cd-tabs button { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .75rem; min-width: 0; padding: .9rem 1rem; border: 0; border-right: 1px solid rgba(30,38,43,.14); color: #25363c; text-align: left; background: #fbf8f1; cursor: pointer; }
|
||||||
|
.cd-tabs button:last-child { border-right: 0; }
|
||||||
|
.cd-tabs button[aria-selected="true"] { color: white; background: #ad5935; }
|
||||||
|
.cd-tabs span { grid-row: 1 / 3; opacity: .72; font: 720 .55rem/1.2 var(--font-mono); }
|
||||||
|
.cd-tabs b { min-width: 0; font: 720 .76rem/1.25 var(--font-display); }
|
||||||
|
.cd-tabs small { opacity: .68; font: .54rem/1.3 var(--font-mono); }
|
||||||
|
.cd-panel { padding: 1.55rem; }
|
||||||
|
.cd-panel[hidden] { display: none; }
|
||||||
|
.cd-panel-lead { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: end; margin-bottom: 1.25rem; }
|
||||||
|
.cd-panel-lead span { color: #a75231; font: 750 .56rem/1.2 var(--font-mono); letter-spacing: .09em; }
|
||||||
|
.cd-panel-lead h4 { margin: .35rem 0 0; color: #1c3037; font: 750 1.25rem/1.2 var(--font-display); }
|
||||||
|
.cd-panel-lead p { margin: 0; color: #65716f; font-size: .7rem; line-height: 1.65; }
|
||||||
|
.budget-ladder { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: rgba(30,38,43,.15); border: 1px solid rgba(30,38,43,.15); }
|
||||||
|
.budget-ladder > article { padding: 1.1rem; background: #eeeae0; }
|
||||||
|
.budget-ladder header { display: flex; justify-content: space-between; align-items: end; }
|
||||||
|
.budget-ladder header span { color: #697572; font: 700 .52rem/1 var(--font-mono); }
|
||||||
|
.budget-ladder header b { color: #ad5935; font: 780 1.55rem/1 var(--font-display); }
|
||||||
|
.budget-track { height: 1rem; margin-top: 1rem; background: rgba(175,83,49,.22); }
|
||||||
|
.budget-track i { display: block; width: var(--complete); height: 100%; background: #347d6f; }
|
||||||
|
.budget-ladder dl { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: .8rem 0 0; background: rgba(30,38,43,.1); }
|
||||||
|
.budget-ladder dl div { padding: .65rem; background: #faf7ef; }
|
||||||
|
.budget-ladder dt { color: #737c79; font: .48rem/1 var(--font-mono); }
|
||||||
|
.budget-ladder dd { margin: .35rem 0 0; color: #283c42; font: 740 .7rem/1 var(--font-mono); }
|
||||||
|
.budget-arrow { position: absolute; top: 50%; left: 50%; z-index: 2; display: grid; place-items: center; width: 5.2rem; height: 5.2rem; transform: translate(-50%,-50%); color: white; border: .35rem solid #f7f4ec; border-radius: 50%; background: #ab5b39; text-align: center; }
|
||||||
|
.budget-arrow span,
|
||||||
|
.budget-arrow small { font: .44rem/1.2 var(--font-mono); }
|
||||||
|
.budget-arrow b { font: 780 1.1rem/1.1 var(--font-display); }
|
||||||
|
.condition-table { margin-top: 1rem; border: 1px solid rgba(30,38,43,.14); }
|
||||||
|
.condition-table > header,
|
||||||
|
.condition-table > div { display: grid; grid-template-columns: 1.25fr repeat(4, 1fr); gap: .7rem; align-items: center; padding: .65rem .8rem; border-bottom: 1px solid rgba(30,38,43,.1); }
|
||||||
|
.condition-table > header { color: #dfe9e6; background: #27434a; font: 680 .48rem/1.2 var(--font-mono); }
|
||||||
|
.condition-table > div:last-child { border-bottom: 0; }
|
||||||
|
.condition-table > div:nth-child(odd) { background: #efebe1; }
|
||||||
|
.condition-table span { color: #293d42; font: 690 .64rem/1.2 var(--font-mono); }
|
||||||
|
.condition-table b { color: #596663; font: 680 .6rem/1.2 var(--font-mono); }
|
||||||
|
.condition-table b.good { color: #277563; }
|
||||||
|
.incomplete-ledger { margin-top: 1rem; border: 1px solid rgba(164,81,46,.2); background: rgba(178,91,50,.08); }
|
||||||
|
.incomplete-ledger > header { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem .9rem; color: #653d30; border-bottom: 1px solid rgba(164,81,46,.14); }
|
||||||
|
.incomplete-ledger > header span { font: 730 .58rem/1.2 var(--font-mono); }
|
||||||
|
.incomplete-ledger > header p { margin: 0; font-size: .61rem; }
|
||||||
|
.incomplete-ledger > div { display: grid; grid-template-columns: repeat(4, 1fr); }
|
||||||
|
.incomplete-ledger article { min-width: 0; padding: .7rem; border-right: 1px solid rgba(164,81,46,.12); border-bottom: 1px solid rgba(164,81,46,.12); }
|
||||||
|
.incomplete-ledger article b,
|
||||||
|
.incomplete-ledger article span,
|
||||||
|
.incomplete-ledger article em { display: block; overflow-wrap: anywhere; }
|
||||||
|
.incomplete-ledger article b { color: #3b4a4c; font: 670 .56rem/1.3 var(--font-mono); }
|
||||||
|
.incomplete-ledger article span { margin-top: .35rem; color: #6e706b; font-size: .54rem; }
|
||||||
|
.incomplete-ledger article em { margin-top: .45rem; color: #a34f30; font: 720 .48rem/1 var(--font-mono); }
|
||||||
|
.prefix-gate,
|
||||||
|
.repro-proof { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 1rem; background: rgba(30,38,43,.13); border: 1px solid rgba(30,38,43,.13); }
|
||||||
|
.prefix-gate article,
|
||||||
|
.repro-proof article { padding: .85rem; background: rgba(54,128,108,.1); }
|
||||||
|
.prefix-gate span { color: #52716b; font: 710 .5rem/1.2 var(--font-mono); }
|
||||||
|
.prefix-gate b,
|
||||||
|
.repro-proof b { display: block; margin-top: .4rem; color: #245d53; font: 760 .72rem/1.2 var(--font-mono); }
|
||||||
|
.prefix-gate p,
|
||||||
|
.repro-proof p { margin: .4rem 0 0; color: #68736f; font-size: .58rem; line-height: 1.45; }
|
||||||
|
.task-control,
|
||||||
|
.depth-controls { display: grid; grid-template-columns: minmax(14rem,.8fr) 1.2fr; gap: 1px; border: 1px solid rgba(30,38,43,.14); background: rgba(30,38,43,.14); }
|
||||||
|
.task-control > *,
|
||||||
|
.depth-controls label { min-width: 0; padding: .75rem; background: #eeeae0; }
|
||||||
|
.task-control span,
|
||||||
|
.depth-controls span { display: block; margin-bottom: .4rem; color: #65716f; font: 720 .52rem/1.2 var(--font-mono); }
|
||||||
|
.task-control select,
|
||||||
|
.depth-controls select { width: 100%; min-width: 0; padding: .57rem; color: #24383e; border: 1px solid rgba(30,38,43,.2); background: #fffdf8; font: 670 .62rem/1.3 var(--font-mono); }
|
||||||
|
.task-control p { margin: .55rem 0 0; color: #66716e; font-size: .6rem; }
|
||||||
|
.task-control p i { display: inline-block; width: .55rem; height: .55rem; margin: 0 .25rem 0 .6rem; }
|
||||||
|
.task-control p i:first-child { margin-left: 0; }
|
||||||
|
.task-control .pass { background: #3b8778; }
|
||||||
|
.task-control .fail { background: #aa5435; }
|
||||||
|
.task-control .warn { background: #b68b42; }
|
||||||
|
.task-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 1rem; background: rgba(30,38,43,.15); border: 1px solid rgba(30,38,43,.15); }
|
||||||
|
.task-columns > article { min-width: 0; padding: 1rem; background: #f1ede3; }
|
||||||
|
.task-columns > article > header { display: flex; justify-content: space-between; gap: 1rem; color: #304349; font: 720 .58rem/1.2 var(--font-mono); }
|
||||||
|
.task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: .75rem; background: rgba(30,38,43,.12); }
|
||||||
|
.task-grid article { min-width: 0; padding: .75rem; background: #faf7ef; box-shadow: inset .25rem 0 #aa5435; }
|
||||||
|
.task-grid article.pass { box-shadow: inset .25rem 0 #3b8778; }
|
||||||
|
.task-grid article.warn { box-shadow: inset .25rem 0 #b68b42; }
|
||||||
|
.task-grid b,
|
||||||
|
.task-grid span,
|
||||||
|
.task-grid em { display: block; overflow-wrap: anywhere; }
|
||||||
|
.task-grid b { color: #34474c; font: 660 .53rem/1.3 var(--font-mono); }
|
||||||
|
.task-grid span { margin-top: .45rem; color: #263e43; font: 740 .58rem/1.2 var(--font-mono); }
|
||||||
|
.task-grid em { margin-top: .32rem; color: #737b77; font: .45rem/1.2 var(--font-mono); }
|
||||||
|
.task-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: end; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid rgba(30,38,43,.1); }
|
||||||
|
.task-summary b { display: block; margin-top: .35rem; color: #2f7266; font: 760 .82rem/1 var(--font-mono); }
|
||||||
|
.task-summary p { margin: 0; color: #6c7571; font-size: .57rem; line-height: 1.5; }
|
||||||
|
.sandbox-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; gap: .55rem; align-items: center; margin-top: 1rem; }
|
||||||
|
.sandbox-flow article { min-height: 8.5rem; padding: .8rem; border: 1px solid rgba(30,38,43,.14); background: #eeeae0; }
|
||||||
|
.sandbox-flow article.active { color: white; background: #285249; }
|
||||||
|
.sandbox-flow > i { color: #a75534; }
|
||||||
|
.sandbox-flow span { color: #a65434; font: 720 .48rem/1.2 var(--font-mono); }
|
||||||
|
.sandbox-flow article.active span { color: #85c8bc; }
|
||||||
|
.sandbox-flow b { display: block; margin-top: .55rem; font: 730 .62rem/1.35 var(--font-mono); }
|
||||||
|
.sandbox-flow p { margin: .65rem 0 0; color: #69736f; font-size: .57rem; line-height: 1.5; }
|
||||||
|
.sandbox-flow article.active p { color: rgba(255,255,255,.75); }
|
||||||
|
.depth-controls { grid-template-columns: 1.25fr .85fr 1fr; }
|
||||||
|
.depth-chart { margin-top: 1rem; border: 1px solid rgba(30,38,43,.14); background: #fdfaf3; }
|
||||||
|
.depth-chart header { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem .9rem; color: #dfe9e6; background: #27434a; font: 690 .55rem/1.2 var(--font-mono); }
|
||||||
|
.depth-chart svg { display: block; width: 100%; height: auto; }
|
||||||
|
.depth-chart svg text { fill: #78817d; font: 18px var(--font-mono); }
|
||||||
|
.depth-chart .chart-grid line { stroke: rgba(39,67,74,.14); stroke-width: 1; }
|
||||||
|
.depth-chart polyline { fill: none; stroke: #ac5736; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
|
||||||
|
.depth-chart circle { fill: #2f8071; stroke: #fff; stroke-width: 3; }
|
||||||
|
.router-chart polyline { stroke: #347b6e; }
|
||||||
|
.router-chart circle { fill: #ad5935; }
|
||||||
|
.depth-strip { display: grid; grid-template-columns: repeat(29, 1fr); gap: 2px; margin-top: .5rem; }
|
||||||
|
.depth-strip button { position: relative; display: flex; align-items: end; justify-content: center; min-width: 0; height: 3.7rem; padding: 0; overflow: hidden; color: #586562; border: 1px solid rgba(30,38,43,.1); background: #e4e0d6; cursor: pointer; }
|
||||||
|
.depth-strip button i { position: absolute; inset: auto 0 0; height: 4%; background: rgba(175,83,49,.7); }
|
||||||
|
.depth-strip button span { position: relative; z-index: 1; padding-bottom: .25rem; font: 680 .43rem/1 var(--font-mono); }
|
||||||
|
.depth-strip button.selected { color: white; border-color: #263f46; background: #263f46; }
|
||||||
|
.depth-strip button.selected i { background: #b66d48; }
|
||||||
|
.router-strip { grid-template-columns: repeat(26, 1fr); }
|
||||||
|
.router-strip button i { background: rgba(47,126,109,.72); }
|
||||||
|
.depth-reading { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; margin-top: .8rem; background: rgba(30,38,43,.13); border: 1px solid rgba(30,38,43,.13); }
|
||||||
|
.depth-reading article { min-width: 0; padding: .8rem; background: #eeeae0; }
|
||||||
|
.depth-reading b { display: block; margin-top: .4rem; color: #243b41; font: 750 .68rem/1.25 var(--font-mono); overflow-wrap: anywhere; }
|
||||||
|
.depth-reading p { margin: .35rem 0 0; color: #6e7773; font-size: .54rem; line-height: 1.4; }
|
||||||
|
.depth-boundary { display: grid; grid-template-columns: 13rem 1fr; gap: 1rem; margin-top: 1rem; padding: .9rem; color: white; background: #44322e; }
|
||||||
|
.depth-boundary b { color: #e3a77c; font: 720 .58rem/1.3 var(--font-mono); }
|
||||||
|
.depth-boundary p { margin: 0; color: rgba(255,255,255,.74); font-size: .64rem; line-height: 1.55; }
|
||||||
|
.repro-proof { grid-template-columns: repeat(4, 1fr); }
|
||||||
|
.repro-proof article { background: #eeeae0; }
|
||||||
|
.repro-proof article.pass { background: rgba(54,128,108,.11); }
|
||||||
|
.artifact-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
|
||||||
|
.artifact-links a { padding: .55rem .7rem; color: #2d625b; border: 1px solid rgba(45,98,91,.25); background: rgba(45,98,91,.06); font: 680 .57rem/1.2 var(--font-mono); }
|
||||||
|
.completion-depth-lab figcaption { padding: .9rem 1.55rem; color: #75807c; border-top: 1px solid rgba(30,38,43,.13); background: #e8e4d9; font-size: .59rem; line-height: 1.5; }
|
||||||
|
.completion-depth-lab figcaption span { color: #a65031; font-weight: 750; }
|
||||||
|
.completion-depth-lab figcaption code { font-size: .55rem; overflow-wrap: anywhere; }
|
||||||
|
@media (max-width: 1040px) {
|
||||||
|
.cd-ledger { grid-template-columns: repeat(3,1fr); }
|
||||||
|
.cd-ledger article:nth-child(-n+3) { border-bottom: 1px solid rgba(30,38,43,.12); }
|
||||||
|
.incomplete-ledger > div { grid-template-columns: repeat(2,1fr); }
|
||||||
|
.depth-strip { overflow-x: auto; grid-template-columns: repeat(29, 2rem); }
|
||||||
|
.router-strip { grid-template-columns: repeat(26, 2rem); }
|
||||||
|
}
|
||||||
|
@media (max-width: 820px) {
|
||||||
|
.cd-head,
|
||||||
|
.cd-panel-lead,
|
||||||
|
.task-columns { grid-template-columns: 1fr; }
|
||||||
|
.cd-tabs { grid-template-columns: repeat(2,1fr); }
|
||||||
|
.budget-ladder { grid-template-columns: 1fr; }
|
||||||
|
.budget-arrow { display: none; }
|
||||||
|
.prefix-gate,
|
||||||
|
.repro-proof { grid-template-columns: 1fr; }
|
||||||
|
.depth-reading { grid-template-columns: repeat(2,1fr); }
|
||||||
|
.sandbox-flow { grid-template-columns: 1fr; }
|
||||||
|
.sandbox-flow > i { transform: rotate(90deg); text-align: center; }
|
||||||
|
}
|
||||||
|
@media (max-width: 620px) {
|
||||||
|
.cd-head,
|
||||||
|
.cd-panel { padding: 1rem; }
|
||||||
|
.cd-ledger { grid-template-columns: 1fr; }
|
||||||
|
.cd-ledger article { border-right: 0; border-bottom: 1px solid rgba(30,38,43,.12); }
|
||||||
|
.cd-tabs { display: flex; overflow-x: auto; }
|
||||||
|
.cd-tabs button { flex: 1 0 10.5rem; }
|
||||||
|
.condition-table { overflow-x: auto; }
|
||||||
|
.condition-table > header,
|
||||||
|
.condition-table > div { min-width: 38rem; }
|
||||||
|
.incomplete-ledger > header { display: block; }
|
||||||
|
.incomplete-ledger > header p { margin-top: .35rem; }
|
||||||
|
.incomplete-ledger > div,
|
||||||
|
.task-control,
|
||||||
|
.depth-controls,
|
||||||
|
.task-grid,
|
||||||
|
.depth-reading { grid-template-columns: 1fr; }
|
||||||
|
.task-summary,
|
||||||
|
.depth-boundary { grid-template-columns: 1fr; }
|
||||||
|
.depth-chart { overflow-x: auto; }
|
||||||
|
.depth-chart svg { min-width: 43rem; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@ import DeepSeekLineage from "@/components/DeepSeekLineage.astro";
|
|||||||
import DeepSeekLab from "@/components/DeepSeekLab.astro";
|
import DeepSeekLab from "@/components/DeepSeekLab.astro";
|
||||||
import DeepSeekArtifactLab from "@/components/DeepSeekArtifactLab.astro";
|
import DeepSeekArtifactLab from "@/components/DeepSeekArtifactLab.astro";
|
||||||
import DeepSeekBehaviorLab from "@/components/DeepSeekBehaviorLab.astro";
|
import DeepSeekBehaviorLab from "@/components/DeepSeekBehaviorLab.astro";
|
||||||
|
import DeepSeekCompletionDepthLab from "@/components/DeepSeekCompletionDepthLab.astro";
|
||||||
import { deepseekBranches, deepseekLedgers, deepseekPaperChain, deepseekWaves } from "@/data/deepseek";
|
import { deepseekBranches, deepseekLedgers, deepseekPaperChain, deepseekWaves } from "@/data/deepseek";
|
||||||
|
|
||||||
const toc = [
|
const toc = [
|
||||||
@@ -31,21 +32,22 @@ const toc = [
|
|||||||
["21", "lab", "四联交互实验"],
|
["21", "lab", "四联交互实验"],
|
||||||
["22", "artifact", "真实权重执行"],
|
["22", "artifact", "真实权重执行"],
|
||||||
["23", "behavior", "Chat:最终生成行为"],
|
["23", "behavior", "Chat:最终生成行为"],
|
||||||
["24", "branches", "别漏掉旁支"],
|
["24", "completion-depth", "Chat:完成度与全深度"],
|
||||||
["25", "audit", "事实、推导与教学模型"],
|
["25", "branches", "别漏掉旁支"],
|
||||||
|
["26", "audit", "事实、推导与教学模型"],
|
||||||
["↳", "papers", "六十节点阅读链"],
|
["↳", "papers", "六十节点阅读链"],
|
||||||
];
|
];
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout
|
<BaseLayout
|
||||||
title="DeepSeek 技术谱系与真实权重深读:从 Dense、MoE、MLA 到 R1 与 V4"
|
title="DeepSeek 技术谱系与真实权重深读:从 Dense、MoE、MLA 到 R1 与 V4"
|
||||||
description="用二十四张问题账、十次技术转向、十八个交互实验、真实 V2-Lite Base / Chat 权重、公开语料路由区间、官方模板、消息历史、等长 filler、特殊词元家族、完整角色块与最终生成行为控制、吸收式缓存 trace 和六十个一手节点,完整理解 DeepSeek 的 MoE、MLA、FP8、DualPipe、GRPO、R1、V3.2 与 V4。"
|
description="用二十四张问题账、十次技术转向、十九个交互实验、真实 V2-Lite Base / Chat 权重、512-token 完成度评测、29 阶段隐藏状态与 26 层 MoE 路由追踪、吸收式缓存 trace 和六十个一手节点,完整理解 DeepSeek 的 MoE、MLA、FP8、DualPipe、GRPO、R1、V3.2 与 V4。"
|
||||||
section="deepseek"
|
section="deepseek"
|
||||||
>
|
>
|
||||||
<header class="page-hero deepseek-hero">
|
<header class="page-hero deepseek-hero">
|
||||||
<div class="page-hero-inner">
|
<div class="page-hero-inner">
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow"><span>SPOTLIGHT / DEEPSEEK · ROUND 04</span> ROUTING × CHAT OUTPUT × REAL WEIGHTS</p>
|
<p class="eyebrow"><span>SPOTLIGHT / DEEPSEEK · ROUND 05</span> COMPLETION × FULL DEPTH × REAL WEIGHTS</p>
|
||||||
<h1>不要背模型名<br />要看懂每次为什么转向</h1>
|
<h1>不要背模型名<br />要看懂每次为什么转向</h1>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
这不是七篇报告的摘要,而是一套可追问、可计算、可反驳的技术谱系:
|
这不是七篇报告的摘要,而是一套可追问、可计算、可反驳的技术谱系:
|
||||||
@@ -57,9 +59,9 @@ const toc = [
|
|||||||
<div><dt>SPAN</dt><dd>2024.01 → 2026.06</dd></div>
|
<div><dt>SPAN</dt><dd>2024.01 → 2026.06</dd></div>
|
||||||
<div><dt>LEDGERS</dt><dd>24 张问题账</dd></div>
|
<div><dt>LEDGERS</dt><dd>24 张问题账</dd></div>
|
||||||
<div><dt>LINEAGE</dt><dd>10 次技术转向</dd></div>
|
<div><dt>LINEAGE</dt><dd>10 次技术转向</dd></div>
|
||||||
<div><dt>LABS</dt><dd>18 个可操作实验</dd></div>
|
<div><dt>LABS</dt><dd>19 个可操作实验</dd></div>
|
||||||
<div><dt>EVIDENCE</dt><dd>60 个一手 / 官方节点</dd></div>
|
<div><dt>EVIDENCE</dt><dd>60 个一手 / 官方节点</dd></div>
|
||||||
<div><dt>STATUS</dt><dd>三轮 · 真实权重执行</dd></div>
|
<div><dt>STATUS</dt><dd>五轮 · 全 27 层执行</dd></div>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@@ -795,8 +797,21 @@ const toc = [
|
|||||||
<DeepSeekBehaviorLab />
|
<DeepSeekBehaviorLab />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="article-section" id="completion-depth">
|
||||||
|
<p class="eyebrow"><span>24</span> COMPLETION IS NOT CORRECTNESS</p>
|
||||||
|
<h2>把 128-token 的截断账补齐,再沿完整 27 层看差异怎样传播</h2>
|
||||||
|
<p class="lede">
|
||||||
|
上一轮证明固定 Chat checkpoint 的 greedy 输出会分叉,却有 97 / 128 格在 128-token
|
||||||
|
上限处停止。这一轮对全部 128 格统一重跑 512-token 预算,用官方 GSM8K gold 与
|
||||||
|
HumanEval tests 分开记录完成、可评测和正确;同时在相同输入上执行 prompt-only
|
||||||
|
全深度 forward,追踪 29 个隐藏状态阶段、26 个 MoE gate 与 1,918,176 次 top-6
|
||||||
|
目标路由决定。隐藏状态、路由与任务结果仍是三类证据,不互相冒充因果解释。
|
||||||
|
</p>
|
||||||
|
<DeepSeekCompletionDepthLab />
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="article-section" id="branches">
|
<section class="article-section" id="branches">
|
||||||
<p class="eyebrow"><span>24</span> THE MAIN LINE IS NOT THE WHOLE TREE</p>
|
<p class="eyebrow"><span>25</span> THE MAIN LINE IS NOT THE WHOLE TREE</p>
|
||||||
<h2>如果只读 V2 → V3 → R1 → V4,会漏掉五条反过来影响主线的旁支</h2>
|
<h2>如果只读 V2 → V3 → R1 → V4,会漏掉五条反过来影响主线的旁支</h2>
|
||||||
<div class="branch-grid">
|
<div class="branch-grid">
|
||||||
{deepseekBranches.map(([name, line, text, url]) => (
|
{deepseekBranches.map(([name, line, text, url]) => (
|
||||||
@@ -816,7 +831,7 @@ const toc = [
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="article-section" id="audit">
|
<section class="article-section" id="audit">
|
||||||
<p class="eyebrow"><span>25</span> EVIDENCE AUDIT</p>
|
<p class="eyebrow"><span>26</span> EVIDENCE AUDIT</p>
|
||||||
<h2>同一张页面里有三种知识,它们的语气必须不同</h2>
|
<h2>同一张页面里有三种知识,它们的语气必须不同</h2>
|
||||||
<div class="audit-grid">
|
<div class="audit-grid">
|
||||||
<article class="reported">
|
<article class="reported">
|
||||||
|
|||||||
@@ -145,18 +145,18 @@ const paths = [
|
|||||||
</a>
|
</a>
|
||||||
<a class="release-card deepseek-release" href="/deepseek/">
|
<a class="release-card deepseek-release" href="/deepseek/">
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow"><span>NEW / DEEPSEEK ROUND 04</span> LINEAGE · REAL WEIGHTS · ROUTES · GENERATION</p>
|
<p class="eyebrow"><span>NEW / DEEPSEEK ROUND 05</span> COMPLETION · TASK TESTS · FULL DEPTH</p>
|
||||||
<h2>从 Dense 到百万上下文:每次创新都在偿还上一代最贵的一张账</h2>
|
<h2>从 Dense 到百万上下文:每次创新都在偿还上一代最贵的一张账</h2>
|
||||||
<p>
|
<p>
|
||||||
用二十四张问题账和十次技术转向走完 Dense→V4,再把 Base 路由证据接到官方
|
用二十四张问题账和十次技术转向走完 Dense→V4,再把官方 V2-Lite-Chat 的
|
||||||
V2-Lite-Chat 的 31.4 GB 完整 BF16 权重:16 个公开来源、8 种边界条件生成
|
128 个输出统一延长到 512-token:121 个自然 EOS、Math / Code 真实 evaluator;
|
||||||
128 个输出,并把 31 个自然 EOS 与 97 个长度截断分开解释。
|
同时沿 29 个隐藏阶段与 26 个 MoE gate 追踪 1,918,176 次目标路由决定。
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<dl>
|
<dl>
|
||||||
<div><dt>LINEAGE</dt><dd>1991 → 2026 · 10 次转向</dd></div>
|
<div><dt>LINEAGE</dt><dd>1991 → 2026 · 10 次转向</dd></div>
|
||||||
<div><dt>NODES</dt><dd>60 个一手 / 官方节点</dd></div>
|
<div><dt>NODES</dt><dd>60 个一手 / 官方节点</dd></div>
|
||||||
<div><dt>LAB</dt><dd>4 公式 · 13 Base 工件 · 1 Chat 行为</dd></div>
|
<div><dt>LAB</dt><dd>19 · Base / Chat / full depth</dd></div>
|
||||||
</dl>
|
</dl>
|
||||||
<span class="release-arrow" aria-hidden="true">进入 DeepSeek 完整技术谱系 →</span>
|
<span class="release-arrow" aria-hidden="true">进入 DeepSeek 完整技术谱系 →</span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const workstreams = [
|
|||||||
{ label: "表示、位置与残差高速公路", value: 81, next: "加入真实 hidden-state / norm traces、长上下文位置外推复现与更多深层稳定性消融" },
|
{ label: "表示、位置与残差高速公路", value: 81, next: "加入真实 hidden-state / norm traces、长上下文位置外推复现与更多深层稳定性消融" },
|
||||||
{ label: "Scaling Laws", value: 74, next: "加入真实拟合复现、置信区间与更多模型族对照" },
|
{ label: "Scaling Laws", value: 74, next: "加入真实拟合复现、置信区间与更多模型族对照" },
|
||||||
{ label: "数据工程与预训练配方", value: 73, next: "逐图精读 FineWeb / DCLM,加入真实去重与 mixture traces" },
|
{ label: "数据工程与预训练配方", value: 73, next: "逐图精读 FineWeb / DCLM,加入真实去重与 mixture traces" },
|
||||||
{ label: "DeepSeek 专题", value: 98, next: "completion-aware 生成评测、完整 27 层与固定 batch content,再推进 SM90 FlashMLA、FP8/pipeline 与 R1-like RL" },
|
{ label: "DeepSeek 专题", value: 99, next: "扩大 completion/task 样本、sampling robustness 与干预式 mediation,再推进 SM90 FlashMLA、FP8/pipeline 与 R1-like RL" },
|
||||||
{ label: "指令微调与人类偏好", value: 75, next: "加入真实偏好分歧样本、RM 长度偏置与 PPO/DPO 小模型复现" },
|
{ label: "指令微调与人类偏好", value: 75, next: "加入真实偏好分歧样本、RM 长度偏置与 PPO/DPO 小模型复现" },
|
||||||
{ label: "推理与测试时扩展", value: 76, next: "真实模型采样曲线、PRM 案例与逐篇图表精读" },
|
{ label: "推理与测试时扩展", value: 76, next: "真实模型采样曲线、PRM 案例与逐篇图表精读" },
|
||||||
{ label: "工具使用与长程 Agent", value: 74, next: "补真实环境 traces、cross-harness 对照、Agent RL 训练曲线与安全案例" },
|
{ label: "工具使用与长程 Agent", value: 74, next: "补真实环境 traces、cross-harness 对照、Agent RL 训练曲线与安全案例" },
|
||||||
@@ -97,12 +97,12 @@ const workstreams = [
|
|||||||
<article><span>✓</span><h3>K3 报告已结构化拆解</h3><p>47 页报告目录、151 条参考来源和架构/后训练/系统主线已经提取。</p></article>
|
<article><span>✓</span><h3>K3 报告已结构化拆解</h3><p>47 页报告目录、151 条参考来源和架构/后训练/系统主线已经提取。</p></article>
|
||||||
<article><span>✓</span><h3>17 专题知识图</h3><p>从语言模型基础到评测安全,包含先修依赖和三条贯穿案例。</p></article>
|
<article><span>✓</span><h3>17 专题知识图</h3><p>从语言模型基础到评测安全,包含先修依赖和三条贯穿案例。</p></article>
|
||||||
<article><span>✓</span><h3>编辑式网站系统</h3><p>响应式导航、章节模板、侧栏、进度、论文链和证据提示组件。</p></article>
|
<article><span>✓</span><h3>编辑式网站系统</h3><p>响应式导航、章节模板、侧栏、进度、论文链和证据提示组件。</p></article>
|
||||||
<article><span>✓</span><h3>八十五个原创交互视图</h3><p>K3 三轴图、八联报告实验与四联开放工件实验,DeepSeek 四联公式实验、十三联 Base 工件实验与一联完整 Chat 行为实验,以及语言模型前史、Transformer、表示深度、长上下文、MoE、推理、Agent、多模态、训练系统、推理服务、Scaling、数据工程、数值、Alignment 与评测安全专题。</p></article>
|
<article><span>✓</span><h3>八十六个原创交互视图</h3><p>K3 三轴图、八联报告实验与四联开放工件实验,DeepSeek 四联公式实验、十三联 Base 工件实验、Chat 行为与 completion/full-depth 两轮实验,以及语言模型前史、Transformer、表示深度、长上下文、MoE、推理、Agent、多模态、训练系统、推理服务、Scaling、数据工程、数值、Alignment 与评测安全专题。</p></article>
|
||||||
<article><span>✓</span><h3>十七篇首版长文</h3><p>K3、语言模型前史、Transformer、表示/位置/残差、DeepSeek、Scaling、数据工程、长上下文、MoE、后训练、推理、Agent、原生多模态、训练系统、推理服务、数值优化与评测安全专题。</p></article>
|
<article><span>✓</span><h3>十七篇首版长文</h3><p>K3、语言模型前史、Transformer、表示/位置/残差、DeepSeek、Scaling、数据工程、长上下文、MoE、后训练、推理、Agent、原生多模态、训练系统、推理服务、数值优化与评测安全专题。</p></article>
|
||||||
<article><span>✓</span><h3>语言模型前史深度专题</h3><p>八张独立问题账、33 个正式节点、20 段长文与概率—向量—记忆—对齐四联实验。</p></article>
|
<article><span>✓</span><h3>语言模型前史深度专题</h3><p>八张独立问题账、33 个正式节点、20 段长文与概率—向量—记忆—对齐四联实验。</p></article>
|
||||||
<article><span>✓</span><h3>Transformer 深度专题</h3><p>十张独立问题账、40 个正式节点、21 段正文与 QKV—Mask—多头位置—Block 成本四联实验。</p></article>
|
<article><span>✓</span><h3>Transformer 深度专题</h3><p>十张独立问题账、40 个正式节点、21 段正文与 QKV—Mask—多头位置—Block 成本四联实验。</p></article>
|
||||||
<article><span>✓</span><h3>表示、位置与残差高速公路深度专题</h3><p>二十张问题账、66 个一手节点、DeepSeek/Kimi 双谱系,以及 Token—位置—Norm—Residual/FFN 四联实验。</p></article>
|
<article><span>✓</span><h3>表示、位置与残差高速公路深度专题</h3><p>二十张问题账、66 个一手节点、DeepSeek/Kimi 双谱系,以及 Token—位置—Norm—Residual/FFN 四联实验。</p></article>
|
||||||
<article><span>✓</span><h3>DeepSeek 四轮真实权重里程碑</h3><p>在 Base 路由与缓存实证上,新增官方 V2-Lite-Chat 的 31.4 GB 完整 BF16 生成:16 个公开来源 × 8 条件得到 128 个输出,31 个自然 EOS、97 个长度截断;独立复跑的 32 / 32 token 序列 exact。逐来源双输出、十边分歧、GPU/CPU offload 与证据边界共同组成第十八个实验,不把生成差异越界写成能力。</p></article>
|
<article><span>✓</span><h3>DeepSeek 五轮真实权重里程碑</h3><p>统一 512-token 预算让自然 EOS 从 31 / 128 增至 121 / 128;GSM8K strict exact 23 / 32、HumanEval 官方 tests pass 24 / 32,并保留四任务/域的样本边界。相同 Chat checkpoint 再执行 29-stage hidden 与 26-gate route trace;1,856 个 hidden hashes、1,664 个 route hashes 和 1,664 个 weight hashes 在新进程子集复跑中全部 exact。</p></article>
|
||||||
<article><span>✓</span><h3>Kimi K3 技术报告二轮深读</h3><p>三十二张问题账、Figure 1–16 / Table 1–5 审计、100 节点阅读链,以及 Delta—Decay—AttnRes—LatentMoE—SiTU—QB—MOPD—Cache 八联实验。</p></article>
|
<article><span>✓</span><h3>Kimi K3 技术报告二轮深读</h3><p>三十二张问题账、Figure 1–16 / Table 1–5 审计、100 节点阅读链,以及 Delta—Decay—AttnRes—LatentMoE—SiTU—QB—MOPD—Cache 八联实验。</p></article>
|
||||||
<article><span>✓</span><h3>Kimi K3 三轮开放工件里程碑</h3><p>固定官方 revisions,审计 96 个 shards、497,220 个 tensor entries 与真实 KDA / MLA / MoE / MoonViT shapes;四联实验分开显示层型、tensor anatomy、参数范围和复现边界。</p></article>
|
<article><span>✓</span><h3>Kimi K3 三轮开放工件里程碑</h3><p>固定官方 revisions,审计 96 个 shards、497,220 个 tensor entries 与真实 KDA / MLA / MoE / MoonViT shapes;四联实验分开显示层型、tensor anatomy、参数范围和复现边界。</p></article>
|
||||||
<article><span>✓</span><h3>FlashKDA RTX 5090 执行闸门</h3><p>隔离 CUDA 13.0 / glibc 2.39 编译 sm_120a wheel;6/6 官方参考逐元素相等,并完成 fixed / varlen、三种 state mode 的 1,800 个 CUDA Event samples。</p></article>
|
<article><span>✓</span><h3>FlashKDA RTX 5090 执行闸门</h3><p>隔离 CUDA 13.0 / glibc 2.39 编译 sm_120a wheel;6/6 官方参考逐元素相等,并完成 fixed / varlen、三种 state mode 的 1,800 个 CUDA Event samples。</p></article>
|
||||||
@@ -134,7 +134,7 @@ const workstreams = [
|
|||||||
<div class="queue-table">
|
<div class="queue-table">
|
||||||
<div class="head"><b>优先级</b><b>专题</b><b>本轮交付</b><b>完成闸门</b></div>
|
<div class="head"><b>优先级</b><b>专题</b><b>本轮交付</b><b>完成闸门</b></div>
|
||||||
<div><span>P0</span><strong>K3 三轮</strong><p>开放权重 traces → FlashKDA / AttnRes / MoE 真实行为 → Figure 1–16 数值重绘与独立复现</p><em>运行证据 + 逐图复现</em></div>
|
<div><span>P0</span><strong>K3 三轮</strong><p>开放权重 traces → FlashKDA / AttnRes / MoE 真实行为 → Figure 1–16 数值重绘与独立复现</p><em>运行证据 + 逐图复现</em></div>
|
||||||
<div><span>P0</span><strong>DeepSeek 四轮</strong><p>completion-aware 行为评测 → 完整 27 层与固定 batch content → SM90 FlashMLA / FP8 / pipeline traces → R1-like RL 小模型复现</p><em>运行证据 + 独立复现</em></div>
|
<div><span>P0</span><strong>DeepSeek 五轮后续</strong><p>扩大任务与语言 source → sampling robustness → 干预式 mediation → SM90 FlashMLA / FP8 / pipeline traces → R1-like RL 小模型复现</p><em>运行证据 + 独立复现</em></div>
|
||||||
<div><span>P0</span><strong>Transformer 二轮</strong><p>多头电路逐图 → Pre/Post-LN 真实 traces → Flash/KV 配置与 kernel 对照</p><em>逐图笔记 + 实测边界</em></div>
|
<div><span>P0</span><strong>Transformer 二轮</strong><p>多头电路逐图 → Pre/Post-LN 真实 traces → Flash/KV 配置与 kernel 对照</p><em>逐图笔记 + 实测边界</em></div>
|
||||||
<div><span>P0</span><strong>表示、位置与残差二轮</strong><p>真实 hidden-state / norm traces → 长上下文位置外推 → mHC / AttnRes 深层稳定性消融</p><em>可复现实验 + 逐图笔记</em></div>
|
<div><span>P0</span><strong>表示、位置与残差二轮</strong><p>真实 hidden-state / norm traces → 长上下文位置外推 → mHC / AttnRes 深层稳定性消融</p><em>可复现实验 + 逐图笔记</em></div>
|
||||||
<div><span>P0</span><strong>语言模型前史二轮</strong><p>Kneser–Ney / LSTM / Bahdanau 逐图 → 真实小语料复现 → tokenizer 公平性</p><em>可复现实验 + 逐图笔记</em></div>
|
<div><span>P0</span><strong>语言模型前史二轮</strong><p>Kneser–Ney / LSTM / Bahdanau 逐图 → 真实小语料复现 → tokenizer 公平性</p><em>可复现实验 + 逐图笔记</em></div>
|
||||||
@@ -229,6 +229,10 @@ const workstreams = [
|
|||||||
<div><time>2026-07-29</time><b>Chat、生成行为与能力永久分层</b><p>完整官方 Chat 权重可以支撑真实生成;成对输出分歧只证明干预传播,没有 evaluator 与足够 completion 就不升级成能力判断。</p></div>
|
<div><time>2026-07-29</time><b>Chat、生成行为与能力永久分层</b><p>完整官方 Chat 权重可以支撑真实生成;成对输出分歧只证明干预传播,没有 evaluator 与足够 completion 就不升级成能力判断。</p></div>
|
||||||
<div><time>2026-07-29</time><b>completion 是生成实验的首要审计字段</b><p>31 / 128 自然 EOS 与 97 / 128 长度截断同时显示;截断答案不冒充完整回答。</p></div>
|
<div><time>2026-07-29</time><b>completion 是生成实验的首要审计字段</b><p>31 / 128 自然 EOS 与 97 / 128 长度截断同时显示;截断答案不冒充完整回答。</p></div>
|
||||||
<div><time>2026-07-29</time><b>offload 拓扑进入复现合同</b><p>31.4 GB BF16 权重按 GPU 25 层、CPU 2 层 + norm / lm_head 执行;设备切分不被写成模型结构。</p></div>
|
<div><time>2026-07-29</time><b>offload 拓扑进入复现合同</b><p>31.4 GB BF16 权重按 GPU 25 层、CPU 2 层 + norm / lm_head 执行;设备切分不被写成模型结构。</p></div>
|
||||||
|
<div><time>2026-07-29</time><b>更长预算统一重跑全部八格</b><p>不选择性续写 97 个截断格;128→512 的 prompt hash 与前 128 generated tokens 必须全 exact。</p></div>
|
||||||
|
<div><time>2026-07-29</time><b>停止、终点、可评测与正确分四张账</b><p>自然 EOS 不等于答对;fallback 不冒充 strict completion;HumanEval tests pass 不冒充代码安全。</p></div>
|
||||||
|
<div><time>2026-07-29</time><b>全深度比较只保留 exact interior tokens</b><p>1,537 个 content tokens / condition 在八格中 ID exact;56 个跨字符边界 token 排除,不拿不同 token 比隐藏状态。</p></div>
|
||||||
|
<div><time>2026-07-29</time><b>表示与路由分叉不是中介因果</b><p>29-stage hidden 与 26-gate route 曲线描述传播;没有干预式 mediation 前不解释输出或能力因果。</p></div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user