feat: trace DeepSeek V2-Lite real routes

This commit is contained in:
wuyang
2026-07-29 14:18:45 +08:00
parent a97653af69
commit e86420556f
14 changed files with 25897 additions and 34 deletions
+10 -3
View File
@@ -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 专题 | 完成二轮 | 83% | 真实专家负载 / MLA kernel / RL 训练 traces 与独立复现 | | DeepSeek 专题 | 三轮实证进行中 | 87% | 真实 latent-cache kernel、更大样本负载、FP8/pipeline 与 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 研究账本。
@@ -169,11 +169,15 @@
- [x] RTX 5090 K3 形状受控计时完成:fixed / varlen、BF16 / no-state / FP32 state 共 1,800 个 CUDA Event samples;fixed BF16 mean 2.6210 ms、P95 2.6437 ms,varlen BF16 mean 2.3335 ms、P95 2.3574 ms。 - [x] RTX 5090 K3 形状受控计时完成:fixed / varlen、BF16 / no-state / FP32 state 共 1,800 个 CUDA Event samples;fixed BF16 mean 2.6210 ms、P95 2.6437 ms,varlen BF16 mean 2.3335 ms、P95 2.3574 ms。
- [x] 可复现 Dockerfile、运行脚本与机器可读 JSON 接入开源树;网站第四视图把作者 H20/GB200 表、本机 RTX 5090 值、exact suite、构建链、synthetic router 和 `A_log` 未决冲突分开显示。 - [x] 可复现 Dockerfile、运行脚本与机器可读 JSON 接入开源树;网站第四视图把作者 H20/GB200 表、本机 RTX 5090 值、exact suite、构建链、synthetic router 和 `A_log` 未决冲突分开显示。
- [x] K3 FlashKDA 执行里程碑以源提交 `2ef846f`、不可变镜像 `20260729T053852Z-2ef846f` 发布;OCI digest `sha256:08ad5b55…32e6`,NAS、VPS/Tailscale、NPM、DNS、HTTPS、证书、门户与十六套生产 Chrome 回归全链路通过;保留 `20260729T044605Z-be2b291` 回滚。 - [x] K3 FlashKDA 执行里程碑以源提交 `2ef846f`、不可变镜像 `20260729T053852Z-2ef846f` 发布;OCI digest `sha256:08ad5b55…32e6`,NAS、VPS/Tailscale、NPM、DNS、HTTPS、证书、门户与十六套生产 Chrome 回归全链路通过;保留 `20260729T044605Z-be2b291` 回滚。
- [x] 启动 DeepSeek 三轮真实权重执行:固定官方 V2-Lite revision `604d5664…82de0`,审计 29.261 GiB / 4 shards,并以第一分片的完整层边界执行 layer 0–6。
- [x] RTX 5090 连续 forward 闭环:4 条固定 prompt、90 个有效 token、6 个 MoE 层产生 3,240 次真实 top-6 路由;记录每层 `[4,27,576]` MLA 投影与 HF eager 展开 K/V shapes。
- [x] 独立复跑 31/31 exact:来源、配置、tokenization、逐层 hidden hashes、MLA shapes、aggregate loads 与全部 token routes 完全一致;计时明确不比较。
- [x] DeepSeek 新四视图本地真实 Chrome 回归通过:逐 token 路由、覆盖/均衡分账、latent/HF eager cache 计算、27 层执行断面、键盘 tabs 与 390px 移动端均无异常。
## 正在进行 ## 正在进行
- [ ] 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 三轮:真实专家负载、MLA kernel、FP8 / pipeline 与 R1-like RL traces,外加独立小模型复现。 - [ ] DeepSeek 三轮下一闸门:真实 latent-cache kernel、更大样本 expert-load 置信区间、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 复现。
@@ -289,6 +293,9 @@
| 2026-07-29 | 论文库扩充到 486 篇 | 新增 DeepSeek-Coder/Coder-V2、ESFT、Prover-V1.5/V2 与 Engram 6 个旁支节点 | | 2026-07-29 | 论文库扩充到 486 篇 | 新增 DeepSeek-Coder/Coder-V2、ESFT、Prover-V1.5/V2 与 Engram 6 个旁支节点 |
| 2026-07-29 | DeepSeek 二轮用四个独立实验闭环 | 稀疏容量、MLA 缓存、V3 协同与 RL 偏差分别操作;精确公式、作者报告和 teaching model 永久分级 | | 2026-07-29 | DeepSeek 二轮用四个独立实验闭环 | 稀疏容量、MLA 缓存、V3 协同与 RL 偏差分别操作;精确公式、作者报告和 teaching model 永久分级 |
| 2026-07-29 | DeepSeek 二轮用不可变镜像 `20260729T031901Z-cd96dab` 发布 | OCI digest `sha256:4bfb3faf…fa3968`;复用 `12010→8080`、NPM host 31 / cert 41、门户 order 180 与公开 Forgejo;保留 `20260729T023329Z-a2c9298` 回滚 | | 2026-07-29 | DeepSeek 二轮用不可变镜像 `20260729T031901Z-cd96dab` 发布 | OCI digest `sha256:4bfb3faf…fa3968`;复用 `12010→8080`、NPM host 31 / cert 41、门户 order 180 与公开 Forgejo;保留 `20260729T023329Z-a2c9298` 回滚 |
| 2026-07-29 | DeepSeek 三轮以官方 V2-Lite 第一分片建立真实执行证据 | layer 0–6 是完整连续边界;layer 7 跨分片即停止,不把部分下载写成完整生成 |
| 2026-07-29 | MLA 算法状态与框架物化格式分两张账 | V2-Lite latent 576 元素与 HF eager 5,120 元素同时报告;88.75% 不冒充 V2 论文 93.3% |
| 2026-07-29 | 专家覆盖、负载均衡与语义永久分开 | 60–64/64 used 不推出 balanced;CV/Gini/effective 同报;expert ID 不跨层连线或命名 |
| 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 标签 |
+6 -3
View File
@@ -19,7 +19,7 @@
当前里程碑包含 17 专题学习地图、486 篇关键论文索引、Kimi K3 完整导读, 当前里程碑包含 17 专题学习地图、486 篇关键论文索引、Kimi K3 完整导读,
语言模型前史、Transformer 基础、表示/位置/残差、DeepSeek 技术谱系、Scaling Laws、数据工程、长上下文、MoE、指令微调与人类偏好、推理、工具使用与长程 Agent、原生多模态、训练系统、推理服务、数值优化,以及评测与安全深度专题, 语言模型前史、Transformer 基础、表示/位置/残差、DeepSeek 技术谱系、Scaling Laws、数据工程、长上下文、MoE、指令微调与人类偏好、推理、工具使用与长程 Agent、原生多模态、训练系统、推理服务、数值优化,以及评测与安全深度专题,
以及 71 个覆盖核心机制的原创交互视图。K3 二轮导读以 32 张问题账、16 图 / 5 表审计、 以及 75 个覆盖核心机制的原创交互视图。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,11 @@
`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 次技术转向、
4 个交互实验和 60 个一手/官方节点,串起 Dense、MoE、MLA、V3 协同、R1 与 V4。 8 个交互实验和 60 个一手/官方节点,串起 Dense、MoE、MLA、V3 协同、R1 与 V4;
并固定官方 V2-Lite revision,在 RTX 5090 上连续执行 7/27 层,记录 3,240 次真实专家选择、
MLA/HF eager cache shapes 与 `31/31` exact 独立复跑。详见
[DEEPSEEK_V2_LITE_TRACE.md](./research/DEEPSEEK_V2_LITE_TRACE.md)。
其余专题按进度账本持续扩建。 其余专题按进度账本持续扩建。
## 本地开发 ## 本地开发
+56
View File
@@ -0,0 +1,56 @@
# DeepSeek real-weight execution probes
The probes in this directory use official DeepSeek artifacts and keep their
scope deliberately narrower than a full-model benchmark.
## DeepSeek-V2-Lite truncated trace
`v2_lite_trace.py` executes layers 0–6 from the official BF16 checkpoint. Those
seven layers are fully contained in shard 1; layer 7 is split across shards 1
and 2 and is therefore outside the default evidence boundary.
Pinned model:
```text
deepseek-ai/DeepSeek-V2-Lite@604d5664dddd88a0433dbae533b7fe9472482de0
```
Required Python stack:
```text
torch==2.11.0+cu128
transformers==4.41.2
safetensors==0.8.0
```
The 2024 remote code does not import under Transformers 5.5 because
`is_torch_fx_available` was removed. The probe imports the official files as a
read-only local package; it does not patch the model source.
Download the metadata, tokenizer, remote code, index, and first shard with the
Hugging Face CLI, then run:
```bash
python experiments/deepseek/v2_lite_trace.py \
--artifact-dir /path/to/deepseek-v2-lite \
--output src/data/deepseek-v2-lite-trace.json
```
The result contains:
- real tokenizer pieces and model-derived hidden states;
- the actual `[B,T,576]` MLA compressed projection at each executed layer;
- the expanded key/value tensors stored by the Hugging Face eager cache;
- token-level top-6 routed expert IDs and weights for six MoE layers;
- per-layer and per-prompt expert-load summaries;
- explicit boundaries against global load, expert semantics, training traces,
full-model generation, and production serving claims.
Run the probe twice and compare deterministic evidence while excluding timing:
```bash
python experiments/deepseek/compare_v2_lite_traces.py \
--first /path/to/trace-1.json \
--second /path/to/trace-2.json \
--output src/data/deepseek-v2-lite-trace-repro.json
```
@@ -0,0 +1,110 @@
#!/usr/bin/env python3
"""Compare deterministic evidence from two DeepSeek-V2-Lite trace runs."""
from __future__ import annotations
import argparse
import hashlib
import json
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument("--first", type=Path, required=True)
parser.add_argument("--second", type=Path, required=True)
parser.add_argument("--output", type=Path, required=True)
parser.add_argument("--captured-at", default=None)
return parser.parse_args()
def read(path: Path) -> dict[str, Any]:
return json.loads(path.read_text())
def sha256(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def main() -> None:
args = parse_args()
first = read(args.first)
second = read(args.second)
checks: list[dict[str, Any]] = []
def check(name: str, left: Any, right: Any) -> None:
checks.append({"name": name, "exact": left == right})
check("provenance", first["provenance"], second["provenance"])
check("configuration", first["configuration"], second["configuration"])
check("prompt_tokenization", first["prompts"], second["prompts"])
check(
"initial_hidden_hash",
first["execution"]["initial_hidden"]["sha256_fp32"],
second["execution"]["initial_hidden"]["sha256_fp32"],
)
check(
"final_hidden_hash",
first["execution"]["final_hidden"]["sha256_fp32"],
second["execution"]["final_hidden"]["sha256_fp32"],
)
for left, right in zip(
first["execution"]["layers"],
second["execution"]["layers"],
strict=True,
):
layer = left["layer"]
check(
f"layer_{layer}_hidden_hash",
left["hidden_after"]["sha256_fp32"],
right["hidden_after"]["sha256_fp32"],
)
check(f"layer_{layer}_mla_shapes", left["mla"], right["mla"])
if "routing" in left:
check(
f"layer_{layer}_aggregate_load",
left["routing"]["aggregate_load"],
right["routing"]["aggregate_load"],
)
check(
f"layer_{layer}_token_routes",
[
prompt["token_routes"]
for prompt in left["routing"]["per_prompt"]
],
[
prompt["token_routes"]
for prompt in right["routing"]["per_prompt"]
],
)
captured_at = args.captured_at or datetime.now(timezone.utc).isoformat()
result = {
"schema_version": 1,
"captured_at": captured_at,
"first": {
"captured_at": first["captured_at"],
"sha256": sha256(args.first),
},
"second": {
"captured_at": second["captured_at"],
"sha256": sha256(args.second),
},
"timing_compared": False,
"checks": checks,
"exact_checks": sum(item["exact"] for item in checks),
"total_checks": len(checks),
"all_exact": all(item["exact"] for item in checks),
}
if not result["all_exact"]:
failed = [item["name"] for item in checks if not item["exact"]]
raise AssertionError(f"trace mismatch: {failed}")
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(json.dumps(result, indent=2) + "\n")
print(json.dumps(result, indent=2))
if __name__ == "__main__":
main()
+588
View File
@@ -0,0 +1,588 @@
#!/usr/bin/env python3
"""Trace real DeepSeek-V2-Lite MLA states and MoE routes from official weights.
The script deliberately executes only the contiguous layers fully contained in
the first official safetensors shard (layers 0 through 6). It loads one decoder
layer at a time, so a 32 GB workstation GPU can produce model-derived hidden
states without downloading or materializing the complete 15.7B-parameter model.
No model source is patched. The pinned remote-code files are imported as a
read-only local package, and every decoder layer is the official class.
"""
from __future__ import annotations
import argparse
import gc
import hashlib
import importlib.util
import json
import math
import platform
import statistics
import subprocess
import sys
import time
import types
from datetime import datetime, timezone
from itertools import combinations
from pathlib import Path
from typing import Any
import torch
import torch.nn.functional as F
from safetensors import safe_open
from transformers import AutoTokenizer, DynamicCache
DEFAULT_PROMPTS = [
{
"id": "zh_explanation",
"label": "中文解释",
"text": "用通俗的语言解释,为什么稀疏专家模型可以拥有很多参数,但每个 token 只使用其中一小部分。",
},
{
"id": "en_architecture",
"label": "English architecture",
"text": "Explain how a compressed key-value latent changes the memory cost of autoregressive decoding.",
},
{
"id": "code",
"label": "Python code",
"text": "Write a Python function that returns the first repeated element in a list and explain its complexity.",
},
{
"id": "math",
"label": "数学推理",
"text": "若正数 x 满足 x 加上它的倒数等于 3,求 x 的平方加上倒数的平方。",
},
]
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument("--artifact-dir", type=Path, required=True)
parser.add_argument("--output", type=Path, required=True)
parser.add_argument("--layers", type=int, default=7)
parser.add_argument("--device", default="cuda")
parser.add_argument("--captured-at", default=None)
return parser.parse_args()
def sha256(path: Path) -> str:
digest = hashlib.sha256()
with path.open("rb") as handle:
for block in iter(lambda: handle.read(1024 * 1024), b""):
digest.update(block)
return digest.hexdigest()
def tensor_sha256(tensor: torch.Tensor) -> str:
value = tensor.detach().float().contiguous().cpu().numpy()
return hashlib.sha256(value.tobytes()).hexdigest()
def load_official_modules(root: Path) -> tuple[Any, Any]:
"""Import relative official files without Transformers' remote-code scanner."""
package_name = "deepseek_v2_lite_official"
package = types.ModuleType(package_name)
package.__path__ = [str(root)]
sys.modules[package_name] = package
loaded = {}
for leaf in ("configuration_deepseek", "modeling_deepseek"):
name = f"{package_name}.{leaf}"
spec = importlib.util.spec_from_file_location(name, root / f"{leaf}.py")
if spec is None or spec.loader is None:
raise RuntimeError(f"cannot load official module: {leaf}")
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
spec.loader.exec_module(module)
loaded[leaf] = module
return loaded["configuration_deepseek"], loaded["modeling_deepseek"]
def percentile(values: torch.Tensor, q: float) -> float:
return torch.quantile(values.float(), q).item()
def hidden_stats(hidden: torch.Tensor, mask: torch.Tensor) -> dict[str, Any]:
valid = hidden[mask.bool()]
rms = valid.float().square().mean(dim=-1).sqrt()
norms = valid.float().norm(dim=-1)
return {
"valid_tokens": valid.shape[0],
"hidden_rms": {
"mean": rms.mean().item(),
"p10": percentile(rms, 0.10),
"p50": percentile(rms, 0.50),
"p90": percentile(rms, 0.90),
},
"l2_norm": {
"mean": norms.mean().item(),
"p10": percentile(norms, 0.10),
"p50": percentile(norms, 0.50),
"p90": percentile(norms, 0.90),
},
"finite": bool(torch.isfinite(valid).all()),
"sha256_fp32": tensor_sha256(valid),
}
def load_metrics(load: torch.Tensor) -> dict[str, Any]:
values = load.float()
mean = values.mean()
ordered = values.sort().values
count = values.numel()
indices = torch.arange(1, count + 1, dtype=torch.float32)
denominator = count * ordered.sum()
gini = (
((2 * indices - count - 1) * ordered).sum() / denominator
if denominator
else torch.tensor(0.0)
)
probabilities = values / values.sum().clamp_min(1)
nonzero = probabilities[probabilities > 0]
entropy = -(nonzero * nonzero.log()).sum()
return {
"routes": int(values.sum()),
"used_experts": int((values > 0).sum()),
"zero_experts": int((values == 0).sum()),
"mean": mean.item(),
"std": values.std().item(),
"cv": (values.std() / mean).item() if mean else 0.0,
"gini": gini.item(),
"entropy_nats": entropy.item(),
"effective_experts": math.exp(entropy.item()),
"min": values.min().item(),
"p50": percentile(values, 0.50),
"p90": percentile(values, 0.90),
"max": values.max().item(),
}
def route_trace(
tokenizer: Any,
input_ids: torch.Tensor,
attention_mask: torch.Tensor,
topk_ids: torch.Tensor,
topk_weights: torch.Tensor,
prompts: list[dict[str, str]],
expert_count: int,
) -> dict[str, Any]:
batch, sequence, top_k = topk_ids.shape
valid_routes = attention_mask.bool().unsqueeze(-1).expand_as(topk_ids)
aggregate_load = torch.bincount(
topk_ids[valid_routes].cpu(), minlength=expert_count
)
per_prompt = []
used_sets: dict[str, set[int]] = {}
for batch_index, prompt in enumerate(prompts):
length = int(attention_mask[batch_index].sum())
ids = input_ids[batch_index, :length].tolist()
tokens = tokenizer.convert_ids_to_tokens(ids)
routes = topk_ids[batch_index, :length].cpu()
weights = topk_weights[batch_index, :length].float().cpu()
load = torch.bincount(routes.flatten(), minlength=expert_count)
used_sets[prompt["id"]] = set(torch.nonzero(load, as_tuple=False).flatten().tolist())
token_rows = []
for position, (token_id, token, experts, scores) in enumerate(
zip(ids, tokens, routes.tolist(), weights.tolist(), strict=True)
):
ordered = sorted(
zip(experts, scores, strict=True),
key=lambda pair: pair[1],
reverse=True,
)
token_rows.append(
{
"position": position,
"token_id": token_id,
"token": token,
"decoded_piece": tokenizer.decode(
[token_id],
skip_special_tokens=False,
clean_up_tokenization_spaces=False,
),
"experts_by_weight": [
{"expert": expert, "weight": weight}
for expert, weight in ordered
],
"selected_weight_sum": sum(scores),
"top1_top2_margin": ordered[0][1] - ordered[1][1],
}
)
top_experts = sorted(
enumerate(load.tolist()), key=lambda pair: pair[1], reverse=True
)[:8]
per_prompt.append(
{
"id": prompt["id"],
"label": prompt["label"],
"tokens": length,
"load": load.tolist(),
"metrics": load_metrics(load),
"top_experts": [
{"expert": expert, "routes": routes}
for expert, routes in top_experts
if routes
],
"token_routes": token_rows,
}
)
jaccard = []
for left, right in combinations(prompts, 2):
a = used_sets[left["id"]]
b = used_sets[right["id"]]
jaccard.append(
{
"left": left["id"],
"right": right["id"],
"used_expert_jaccard": len(a & b) / len(a | b),
"shared_experts": len(a & b),
"union_experts": len(a | b),
}
)
valid_weights = topk_weights[valid_routes].float().cpu().view(-1, top_k)
weight_sums = valid_weights.sum(dim=-1)
ordered_weights = valid_weights.sort(dim=-1, descending=True).values
top_experts = sorted(
enumerate(aggregate_load.tolist()), key=lambda pair: pair[1], reverse=True
)[:12]
return {
"aggregate_load": aggregate_load.tolist(),
"aggregate_metrics": load_metrics(aggregate_load),
"top_experts": [
{"expert": expert, "routes": routes}
for expert, routes in top_experts
if routes
],
"selected_weight_sum": {
"mean": weight_sums.mean().item(),
"p10": percentile(weight_sums, 0.10),
"p50": percentile(weight_sums, 0.50),
"p90": percentile(weight_sums, 0.90),
},
"top1_top2_margin": {
"mean": (ordered_weights[:, 0] - ordered_weights[:, 1]).mean().item(),
"p50": percentile(ordered_weights[:, 0] - ordered_weights[:, 1], 0.50),
"p90": percentile(ordered_weights[:, 0] - ordered_weights[:, 1], 0.90),
},
"per_prompt": per_prompt,
"prompt_pair_jaccard": jaccard,
}
def nvidia_smi() -> dict[str, str]:
fields = [
"name",
"driver_version",
"memory.total",
"power.limit",
"clocks.max.sm",
]
output = subprocess.check_output(
[
"nvidia-smi",
f"--query-gpu={','.join(fields)}",
"--format=csv,noheader,nounits",
],
text=True,
).strip()
return dict(zip(fields, [item.strip() for item in output.split(",")], strict=True))
def main() -> None:
args = parse_args()
root = args.artifact_dir.resolve()
shard = root / "model-00001-of-000004.safetensors"
required = [
root / "config.json",
root / "configuration_deepseek.py",
root / "modeling_deepseek.py",
root / "model.safetensors.index.json",
root / "tokenizer.json",
shard,
]
missing = [str(path) for path in required if not path.exists()]
if missing:
raise FileNotFoundError(f"missing official artifacts: {missing}")
if args.device.startswith("cuda") and not torch.cuda.is_available():
raise RuntimeError("CUDA requested but unavailable")
if not 1 <= args.layers <= 7:
raise ValueError("shard 1 fully contains only layers 0 through 6")
configuration, modeling = load_official_modules(root)
config = configuration.DeepseekV2Config.from_pretrained(root)
config._attn_implementation = "eager"
tokenizer = AutoTokenizer.from_pretrained(
root,
trust_remote_code=True,
local_files_only=True,
)
if tokenizer.pad_token_id is None:
tokenizer.pad_token = tokenizer.eos_token
tokenizer.padding_side = "right"
encoded = tokenizer(
[prompt["text"] for prompt in DEFAULT_PROMPTS],
add_special_tokens=True,
padding=True,
return_tensors="pt",
)
input_ids = encoded.input_ids
attention_mask_cpu = encoded.attention_mask
device = torch.device(args.device)
start = time.perf_counter()
with safe_open(shard, framework="pt", device="cpu") as handle:
embedding = handle.get_tensor("model.embed_tokens.weight")
hidden = F.embedding(input_ids, embedding).to(device)
embedding_ms = (time.perf_counter() - start) * 1000
attention_mask = attention_mask_cpu.to(device)
sequence = input_ids.shape[1]
position_ids = torch.arange(sequence, device=device).unsqueeze(0)
causal_mask = modeling._prepare_4d_causal_attention_mask(
attention_mask,
input_ids.shape,
hidden,
0,
)
cache = DynamicCache()
layer_results = []
initial_hidden = hidden_stats(hidden, attention_mask)
for layer_index in range(args.layers):
prefix = f"model.layers.{layer_index}."
load_start = time.perf_counter()
with safe_open(shard, framework="pt", device="cpu") as handle:
state = {
key[len(prefix) :]: handle.get_tensor(key)
for key in handle.keys()
if key.startswith(prefix)
}
state_numel = sum(value.numel() for value in state.values())
state_bytes = sum(value.numel() * value.element_size() for value in state.values())
with torch.device("meta"):
layer = modeling.DeepseekV2DecoderLayer(config, layer_index)
layer.to_empty(device="cpu")
layer.load_state_dict(state, strict=True, assign=True)
del state
load_ms = (time.perf_counter() - load_start) * 1000
torch.cuda.reset_peak_memory_stats(device) if device.type == "cuda" else None
transfer_start = time.perf_counter()
layer = layer.to(device=device, dtype=torch.bfloat16).eval()
if device.type == "cuda":
torch.cuda.synchronize(device)
transfer_ms = (time.perf_counter() - transfer_start) * 1000
captures: dict[str, torch.Tensor] = {}
def capture_kv(_module: Any, _inputs: Any, output: torch.Tensor) -> None:
captures["compressed_kv"] = output.detach()
handles = [
layer.self_attn.kv_a_proj_with_mqa.register_forward_hook(capture_kv)
]
if layer_index > 0:
def capture_gate(_module: Any, _inputs: Any, output: Any) -> None:
captures["topk_ids"] = output[0].detach()
captures["topk_weights"] = output[1].detach()
handles.append(layer.mlp.gate.register_forward_hook(capture_gate))
before = hidden_stats(hidden, attention_mask)
if device.type == "cuda":
torch.cuda.synchronize(device)
forward_start = time.perf_counter()
with torch.inference_mode():
outputs = layer(
hidden,
attention_mask=causal_mask,
position_ids=position_ids,
past_key_value=cache,
use_cache=True,
)
hidden = outputs[0]
if device.type == "cuda":
torch.cuda.synchronize(device)
forward_ms = (time.perf_counter() - forward_start) * 1000
after = hidden_stats(hidden, attention_mask)
for handle in handles:
handle.remove()
compressed = captures["compressed_kv"]
latent = compressed[..., : config.kv_lora_rank]
rope_key = compressed[..., config.kv_lora_rank :]
key_cache = cache.key_cache[layer_index]
value_cache = cache.value_cache[layer_index]
result: dict[str, Any] = {
"layer": layer_index,
"ffn": "dense" if layer_index == 0 else "moe",
"state_tensors": len(layer.state_dict()),
"state_numel": state_numel,
"state_bytes": state_bytes,
"timing_ms": {
"load_cpu": load_ms,
"transfer_to_device": transfer_ms,
"forward": forward_ms,
},
"peak_device_allocated_mib": (
torch.cuda.max_memory_allocated(device) / 2**20
if device.type == "cuda"
else None
),
"hidden_before": before,
"hidden_after": after,
"mla": {
"compressed_projection_shape": list(compressed.shape),
"latent_shape": list(latent.shape),
"rope_key_shape": list(rope_key.shape),
"latent_rms": latent.float().square().mean().sqrt().item(),
"rope_key_rms": rope_key.float().square().mean().sqrt().item(),
"eager_key_cache_shape": list(key_cache.shape),
"eager_value_cache_shape": list(value_cache.shape),
"eager_cache_bytes": key_cache.numel() * key_cache.element_size()
+ value_cache.numel() * value_cache.element_size(),
},
}
if layer_index > 0:
topk_ids = captures["topk_ids"].view(
input_ids.shape[0], input_ids.shape[1], -1
)
topk_weights = captures["topk_weights"].view(
input_ids.shape[0], input_ids.shape[1], -1
)
result["routing"] = route_trace(
tokenizer,
input_ids,
attention_mask_cpu,
topk_ids.cpu(),
topk_weights.cpu(),
DEFAULT_PROMPTS,
config.n_routed_experts,
)
layer_results.append(result)
del layer, compressed, latent, rope_key, key_cache, value_cache
captures.clear()
gc.collect()
if device.type == "cuda":
torch.cuda.empty_cache()
valid_token_count = int(attention_mask_cpu.sum())
latent_elements = config.kv_lora_rank + config.qk_rope_head_dim
eager_elements = config.num_attention_heads * (
config.qk_nope_head_dim + config.qk_rope_head_dim + config.v_head_dim
)
captured_at = args.captured_at or datetime.now(timezone.utc).isoformat()
index = json.loads((root / "model.safetensors.index.json").read_text())
result = {
"schema_version": 1,
"captured_at": captured_at,
"evidence_identity": "X / official BF16 weights and tokenizer, local truncated forward",
"boundary": {
"model": "DeepSeek-V2-Lite base",
"executed_layers": list(range(args.layers)),
"total_model_layers": config.num_hidden_layers,
"full_model_generation": False,
"training_or_global_expert_load": False,
"expert_semantics_inferred": False,
"prompt_sample": "four authored prompts; descriptive trace, not population estimate",
"cache_note": "HF eager materializes expanded K/V; latent-cache arithmetic is derived from official dimensions",
},
"provenance": {
"huggingface_model": "deepseek-ai/DeepSeek-V2-Lite",
"huggingface_revision": "604d5664dddd88a0433dbae533b7fe9472482de0",
"sha256": {
"config": sha256(root / "config.json"),
"modeling_code": sha256(root / "modeling_deepseek.py"),
"tokenizer": sha256(root / "tokenizer.json"),
"index": sha256(root / "model.safetensors.index.json"),
"shard_1": sha256(shard),
},
"checkpoint_tensor_bytes": index["metadata"]["total_size"],
"shard_1_bytes": shard.stat().st_size,
},
"environment": {
"python": platform.python_version(),
"platform": platform.platform(),
"libc": list(platform.libc_ver()),
"torch": torch.__version__,
"torch_cuda": torch.version.cuda,
"transformers": __import__("transformers").__version__,
"safetensors": __import__("safetensors").__version__,
"device": str(device),
"nvidia_smi": nvidia_smi() if device.type == "cuda" else None,
"matmul_allow_tf32": torch.backends.cuda.matmul.allow_tf32
if device.type == "cuda"
else None,
},
"configuration": {
"total_parameters_reported": "15.7B",
"activated_parameters_reported": "2.4B",
"layers": config.num_hidden_layers,
"hidden": config.hidden_size,
"attention_heads": config.num_attention_heads,
"qk_nope_head_dim": config.qk_nope_head_dim,
"qk_rope_head_dim": config.qk_rope_head_dim,
"v_head_dim": config.v_head_dim,
"kv_lora_rank": config.kv_lora_rank,
"routed_experts": config.n_routed_experts,
"active_routed_experts": config.num_experts_per_tok,
"shared_experts": config.n_shared_experts,
"expert_intermediate": config.moe_intermediate_size,
"first_dense_layers": config.first_k_dense_replace,
"router_scoring": config.scoring_func,
"router_topk_method": config.topk_method,
"normalize_selected_weights": config.norm_topk_prob,
},
"prompts": [
{
**prompt,
"token_ids": input_ids[index, : int(attention_mask_cpu[index].sum())].tolist(),
"tokens": tokenizer.convert_ids_to_tokens(
input_ids[index, : int(attention_mask_cpu[index].sum())].tolist()
),
}
for index, prompt in enumerate(DEFAULT_PROMPTS)
],
"execution": {
"batch": input_ids.shape[0],
"padded_sequence": input_ids.shape[1],
"valid_tokens": valid_token_count,
"embedding_ms": embedding_ms,
"initial_hidden": initial_hidden,
"layers": layer_results,
"final_hidden": hidden_stats(hidden, attention_mask),
},
"cache_accounting": {
"dtype": "BF16",
"latent_elements_per_token_layer": latent_elements,
"latent_bytes_per_token_layer": latent_elements * 2,
"hf_eager_elements_per_token_layer": eager_elements,
"hf_eager_bytes_per_token_layer": eager_elements * 2,
"eager_over_latent_ratio": eager_elements / latent_elements,
"latent_reduction_vs_eager": 1 - latent_elements / eager_elements,
"components": {
"latent_content": config.kv_lora_rank,
"rope_key": config.qk_rope_head_dim,
"expanded_key": config.num_attention_heads
* (config.qk_nope_head_dim + config.qk_rope_head_dim),
"expanded_value": config.num_attention_heads * config.v_head_dim,
},
},
}
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(json.dumps(result, ensure_ascii=False, indent=2) + "\n")
print(json.dumps(result, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()
+30 -3
View File
@@ -1,7 +1,7 @@
# DeepSeek 技术谱系二轮正式研究账本 # DeepSeek 技术谱系正式研究账本(含三轮真实权重执行)
> 研究截止:2026-07-29 > 研究截止:2026-07-29
> 课程角色:DeepSeek 聚光专题二轮;与 MoE、长上下文、训练系统、数值、推理、Agent、评测专题互相链接,但不替代各专题完整推导。 > 课程角色:DeepSeek 聚光专题三轮;与 MoE、长上下文、训练系统、数值、推理、Agent、评测专题互相链接,但不替代各专题完整推导。
> 证据规则:正文事实只来自一手论文、作者官方仓库和 Kimi K3 官方报告;Grok 产物仅见 `DEEPSEEK_GROK_LEADS.md`,不承担证据。 > 证据规则:正文事实只来自一手论文、作者官方仓库和 Kimi K3 官方报告;Grok 产物仅见 `DEEPSEEK_GROK_LEADS.md`,不承担证据。
> 简化规则:所有二维图、成本滑条和训练曲线若非论文复跑,必须标“教学模型”。 > 简化规则:所有二维图、成本滑条和训练曲线若非论文复跑,必须标“教学模型”。
@@ -557,7 +557,7 @@ total bytes = per-token-layer · L · T · B · bytes
- 至少 24 张问题账; - 至少 24 张问题账;
- 至少 20 个正文目录; - 至少 20 个正文目录;
- 60 个一手/官方阅读节点; - 60 个一手/官方阅读节点;
- 四个独立可操作实验; - 八个独立可操作实验:四个公式/教学实验 + 四个真实工件实验;
- DeepSeekMath 必须在主时间线中; - DeepSeekMath 必须在主时间线中;
- DAPO / Dr.GRPO 必须标后续公开研究; - DAPO / Dr.GRPO 必须标后续公开研究;
- MLA 实验必须把 RoPE cache 算进去; - MLA 实验必须把 RoPE cache 算进去;
@@ -568,3 +568,30 @@ total bytes = per-token-layer · L · T · B · bytes
- tabs 支持键盘方向键; - tabs 支持键盘方向键;
- toy model、作者报告和公式推导使用不同标签; - toy model、作者报告和公式推导使用不同标签;
- 专属 Chrome 回归并纳入全站回归。 - 专属 Chrome 回归并纳入全站回归。
## 8. 第三轮真实权重执行增量
第三轮固定官方 `deepseek-ai/DeepSeek-V2-Lite` revision
`604d5664dddd88a0433dbae533b7fe9472482de0`,在 RTX 5090 上用官方 tokenizer、
模型代码与 BF16 第一分片连续执行 layer 0–6。
已闭合:
- 4 条固定 prompt、90 个有效 token;
- 6 个 MoE 层、每 token top-6,共 3,240 次真实 routed-expert 选择;
- 每层 `[4,27,576]` MLA 压缩投影;
- HF eager 实际 key `[4,16,27,192]`、value `[4,16,27,128]`;
- V2-Lite 逐 token/层 BF16 的 1,152-byte latent 合同与 10,240-byte eager 物化账;
- 两次独立执行在来源、tokenization、hidden hashes、MLA shapes、loads 与全部 routes 上
`31/31 exact`,计时排除。
永久边界:
- 覆盖率不等于均衡,必须同时看 CV、Gini 与 effective experts;
- expert ID 不赋予语义,跨层同号 ID 不是同一参数;
- `88.75%` 是 V2-Lite latent vs HF eager 的 shape 算术,不冒充 V2 报告 `93.3%`;
- layer 7 因跨 shard 停止,不把 7/27 层写成完整模型生成;
- 原始权重不进 Git,工件以 revision、SHA-256、脚本、trace 与复跑比较固定。
完整方法、数值表与复现入口见
`research/DEEPSEEK_V2_LITE_TRACE.md`。
+340
View File
@@ -0,0 +1,340 @@
# DeepSeek-V2-Lite 真实权重执行审计
> 状态:DeepSeek 专题第三轮工件;2026-07-29
> 目的:把“MLA 会压缩缓存”“MoE 会选择专家”从论文概念推进到固定官方权重、真实 tokenizer、真实 hidden states 和逐 token 路由记录。
> 边界:这不是完整模型 benchmark、训练 trace、生产服务复现、专家语义分析或总体负载估计。
## 0. 一页结论
这次实验固定官方 `deepseek-ai/DeepSeek-V2-Lite` revision
`604d5664dddd88a0433dbae533b7fe9472482de0`,使用官方 tokenizer、配置、模型代码和
BF16 checkpoint 第一分片,在 RTX 5090 上依次执行 embedding 与 decoder layer 0–6。
第 0 层是 dense FFN,第 1–6 层是完整 MoE 层;第 7 层横跨第一、第二分片,因此明确停止。
四条最重要的结果:
1. 4 条人工固定 prompt 共 90 个有效 token,在 6 个 MoE 层产生
`6 layers × 90 tokens × top-6 = 3,240` 次真实 routed-expert 选择。
2. 每个执行层都实际观测到 MLA 的 `[B,T,576]` 压缩投影;其中 512 是
KV latent,64 是 decoupled RoPE key。
3. 官方 Hugging Face eager 实现仍把 cache 物化为
key `[4,16,27,192]` 和 value `[4,16,27,128]`。以 BF16 计,
每 token、每层是 10,240 bytes;按配置保存 latent + RoPE key 只需 1,152 bytes,
相差 `8.8889×`,后者相对前者减少 `88.75%`。
4. 两次独立执行的来源、配置、tokenization、hidden-state hashes、MLA shapes、
aggregate loads 与全部 token routes 共 `31/31` 项完全一致;计时明确不参与一致性检查。
这里最反直觉的发现不是某个“神奇专家”,而是:
- **覆盖不等于均衡。** 90 个 token 在单层可触达 60–64/64 个专家,但各层
CV 为 0.549–0.925,Gini 为 0.303–0.420。
- **路由 ID 不等于语义标签。** `E8` 只表示某一层内部数组的第 8 号专家;跨层的
`E8` 是不同参数,四条 prompt 也不足以赋予“代码专家”等语义。
- **算法压缩不等于实现已经压缩存储。** MLA 的低秩状态合同与 HF eager cache
的实际物化格式是两张账,必须同时报告。
## 1. 证据身份
### 1.1 官方工件
| 工件 | 固定值 |
|---|---|
| Hugging Face model | `deepseek-ai/DeepSeek-V2-Lite` |
| revision | `604d5664dddd88a0433dbae533b7fe9472482de0` |
| checkpoint tensor bytes | `31,412,968,448`,约 29.261 GiB |
| shard 1 bytes | `8,594,887,408`,约 8.005 GiB |
| config SHA-256 | `f346286b0f1c8b044252fd54cb4fa78b9fab6472a6e8bebb9edfe03d414ea03d` |
| modeling code SHA-256 | `7d8e5221095286eea991137760893fd7ba52727c0b4ebf48ec09e8bc56b45b9c` |
| tokenizer SHA-256 | `41f3bf64213da8c012d8bd0871a58a1fdf70463e8f08f110ddbb1082f529f669` |
| index SHA-256 | `d2cdb2f325f6682cf3ad1ad2526a9f979d857390b579380c0331d975136e0acf` |
| shard 1 SHA-256 | `0d7e9f39bde40111a4c0f390b87497dce4565cf578d916395e6b2c7851f1e8da` |
第一分片完整容纳 embedding、layer 0–6 和 layer 7 的一部分。为了不把缺参数的
layer 7 冒充完整执行,本实验把证据边界钉在 layer 6。
原始 checkpoint 分片不进入 Git;仓库只提交:
- 可复现执行脚本;
- 机器可读 trace;
- 独立复跑比较结果;
- 研究审计与网页可视化。
### 1.2 模型配置
| 对象 | 官方配置 |
|---|---:|
| reported total / active | 15.7B / 2.4B |
| decoder layers | 27 |
| hidden size | 2048 |
| attention heads | 16 |
| qk NoPE / RoPE head dim | 128 / 64 |
| value head dim | 128 |
| KV LoRA rank | 512 |
| routed experts / active | 64 / 6 |
| shared experts | 2 |
| expert intermediate | 1408 |
| dense prefix | 1 layer |
| router | softmax + greedy top-k |
| selected top-k normalization | false |
`max_position_embeddings=163840` 与 YaRN 配置属于 checkpoint config;
官方发布表中的上下文口径不应被本实验自行改写成同一个数字。
### 1.3 软件与硬件
| 对象 | 值 |
|---|---|
| GPU | NVIDIA GeForce RTX 5090,32,607 MiB |
| driver | 595.84 |
| Python | 3.10.14 |
| PyTorch | 2.11.0+cu128 |
| CUDA runtime | 12.8 |
| Transformers | 4.41.2 |
| safetensors | 0.8.0 |
| TF32 matmul | disabled |
官方 2024 remote code 在当前 Transformers 5.5 环境中会因已移除的
`is_torch_fx_available` 入口而导入失败。因此实验使用隔离的 Transformers 4.41.2。
模型源码保持只读、不打补丁;runner 只通过本地 package 方式导入官方
`configuration_deepseek.py` 与 `modeling_deepseek.py`。
这条版本边界很重要:**“模型代码公开”不等于“任意未来依赖版本都可直接运行”。**
## 2. 实验设计
### 2.1 为什么选择截断的精确 forward
完整 15.7B BF16 权重与运行时状态虽然可能勉强接近单卡边界,但没有必要为了观察
前六层真实路由而把“全模型能否高效生成”混进同一实验。本 runner:
1. 用官方 tokenizer 一次编码 4 条 prompt;
2. 从第一分片读取官方 embedding;
3. 每次在 meta device 构造一个官方 decoder layer;
4. 为这一层绑定真实 safetensors 参数并传到 GPU;
5. 用上层输出作为下一层输入;
6. 通过 hook 捕获实际 `kv_a_proj_with_mqa` 与实际 MoE gate 输出;
7. 释放当前层,再加载下一层。
因此得到的是**真实权重、真实层类、真实连续 hidden states**,而不是随机初始化、
只读 config 或合成 router;但它仍不是完整 27 层生成。
### 2.2 固定 prompt
| ID | 标签 | token |
|---|---|---:|
| `zh_explanation` | 中文解释 | 26 |
| `en_architecture` | English architecture | 18 |
| `code` | Python code | 19 |
| `math` | 数学推理 | 27 |
batch padding 后形状为 `B=4, T=27`,有效 token 共 90。prompt 是用于建立可复现
探针的人工样本,不是自然语料分布、benchmark 数据集或统计代表样本。
## 3. MLA:一张算法状态账,一张实现物化账
### 3.1 实际观测
每个执行层的 `kv_a_proj_with_mqa` 输出都是:
```text
[batch, sequence, kv_lora_rank + qk_rope_head_dim]
= [4, 27, 512 + 64]
= [4, 27, 576]
```
这 576 个元素可以分为:
- `c_t^KV`:512 维 joint latent;
- `k_t^R`:64 维 decoupled RoPE key。
后者不能因为体积小就从缓存公式中消失。
### 3.2 HF eager 实际保存了什么
本次 `use_cache=True` 的官方 Hugging Face eager 路径实际返回:
```text
key [4, 16, 27, 192]
value [4, 16, 27, 128]
```
所以每 token、每层的缓存元素是:
```text
expanded eager = 16 × (192 + 128) = 5,120 elements
latent contract = 512 + 64 = 576 elements
```
在 BF16 下:
```text
eager bytes = 5,120 × 2 = 10,240
latent bytes = 576 × 2 = 1,152
ratio = 10,240 / 1,152 = 8.8889×
reduction = 1 - 1,152 / 10,240 = 88.75%
```
### 3.3 为什么这不是论文 93.3% 的复跑
V2 报告的 `93.3%` 是完整 V2 相对 DeepSeek 67B、在论文指定配置和比较口径下的
作者报告结果。本实验的 `88.75%` 是 V2-Lite 配置中:
- HF eager 展开 K/V 元素;
- 与 latent + RoPE key 理论存储元素;
之间的逐 token、逐层 BF16 算术比较。模型、维度、基线和实现口径都不同,
二者不能互相替代。
进一步说,低秩架构只定义“可以保存什么最小状态”;生产系统是否真的只保存 latent,
还取决于 attention kernel、权重吸收、RoPE 分叉、paged cache 和服务框架。
## 4. MoE:真实路由显微镜
### 4.1 总量守恒
每个 MoE 层都满足:
```text
90 valid tokens × top-6 = 540 routed selections
```
6 个层合计 `3,240` 次。两条 shared expert 等价路径始终运行,但它们不属于 router
输出的 0–63 routed expert ID,因此不写进 top-6 列表。
### 4.2 六层聚合负载
| layer | selections | used / 64 | zero | CV | Gini | effective experts | top expert |
|---:|---:|---:|---:|---:|---:|---:|---|
| 1 | 540 | 63 | 1 | 0.925 | 0.420 | 46.66 | E8 · 48 |
| 2 | 540 | 64 | 0 | 0.549 | 0.303 | 55.08 | E62 · 23 |
| 3 | 540 | 62 | 2 | 0.569 | 0.322 | 53.51 | E54 · 19 |
| 4 | 540 | 62 | 2 | 0.866 | 0.417 | 47.03 | E48 · 40 |
| 5 | 540 | 60 | 4 | 0.642 | 0.332 | 52.14 | E14 · 32 |
| 6 | 540 | 61 | 3 | 0.765 | 0.378 | 49.48 | E25 · 40 |
三个指标回答不同问题:
- `used experts`:这批 token 是否至少触达某专家一次;
- `CV = std / mean`:计数离散程度;
- `effective experts = exp(entropy)`:若把当前熵换算成均匀分布,相当于多少个专家。
因此 layer 1 触达 63 个专家,却只有 46.66 个 effective experts,且 E8 承担 48/540
次选择。只报“63/64 被使用”会掩盖负载长尾。
### 4.3 prompt 之间看到的差异
同一层内,四条 prompt 的 used-expert set Jaccard 与 CV 会变化。例如:
- layer 1:中文 prompt 使用 54 个专家、CV 0.898;英文架构 prompt 使用 40 个、
CV 1.360;代码 prompt 44 个、CV 1.263;数学 prompt 45 个、CV 1.184。
- layer 4:聚合 top expert 是 E48;英文和代码各把 E48 路由 11 次,
中文 prompt 的 top expert 却是 E29、16 次。
- layer 6:英文 prompt 使用 42 个专家、CV 1.439;中文为 49 个、1.031;
数学为 48 个、0.915。
这些是**描述性 route traces**,说明 token 与上下文确实改变 gate 输出;它们不证明
“E48 是代码专家”,更不允许以四条 prompt 推断训练语料上的领域分工。
### 4.4 top-6 权重没有重新归一
配置 `norm_topk_prob=false`。router 先对 64 个专家做 softmax,再选 top-6;
被选中的 6 个概率不会重新缩放到和为 1。各层选中权重和的均值:
| layer | mean selected top-6 weight sum |
|---:|---:|
| 1 | 0.3949 |
| 2 | 0.4801 |
| 3 | 0.4898 |
| 4 | 0.4749 |
| 5 | 0.4832 |
| 6 | 0.4440 |
所以网页显示某 token 的六个权重和小于 1 是真实配置行为,不是漏算。
## 5. 可复现性闸门
正式 trace:
```text
src/data/deepseek-v2-lite-trace.json
SHA-256 81ff4ab34d20121fe42219c566dd4780f4c7f74252a31b596f90e5280e1f1aef
captured 2026-07-29T05:55:35.599912+00:00
```
第二次独立执行:
```text
SHA-256 b5e2e7567e17765195313473499522a4529b9d37ea96963ba2b9455c3c0b86e6
captured 2026-07-29T05:56:32.527770+00:00
```
比较结果:
```text
31 / 31 exact
timing compared: false
```
精确检查覆盖:
- provenance、configuration、prompt tokenization;
- initial / final hidden hashes;
- layer 0–6 hidden hashes 与 MLA shapes;
- layer 1–6 aggregate loads;
- layer 1–6 全部 token routes。
计时会受首次 kernel、频率、温度、后台进程与同步位置影响,因此没有伪装成 deterministic
evidence。本轮只把计时保留在原始 trace,网站不把它包装成性能 benchmark。
## 6. 绝对禁止的外推
| 本实验能够说 | 本实验不能说 |
|---|---|
| 固定 revision 的前 7 层产生了这些 hidden states | 完整模型会生成什么回答 |
| 四条 prompt 在 6 层产生这些 top-6 routes | 训练集或线上请求的总体专家负载 |
| 某层某 expert ID 被选中多少次 | 该专家具有什么稳定语义 |
| HF eager 物化了展开 K/V | 所有 MLA serving kernel 都这样缓存 |
| V2-Lite 配置可导出 576 元素 latent state | 完整 V2 的 93.3% 已被复跑 |
| 两次相同环境执行 31/31 exact | 跨 GPU、依赖版本和 kernel 仍 bitwise identical |
| layer 0–6 在第一分片内完整 | layer 7 或 layer 8–26 已执行 |
跨层连线也被禁止:layer 1 的 E8 与 layer 2 的 E8 是不同参数对象。可视化只能在同一层内
比较 expert load,不能画一条 “E8 专长” 纵贯 6 层。
## 7. 复现入口
环境与命令见:
- `experiments/deepseek/README.md`
- `experiments/deepseek/v2_lite_trace.py`
- `experiments/deepseek/compare_v2_lite_traces.py`
执行一次:
```bash
python experiments/deepseek/v2_lite_trace.py \
--artifact-dir /path/to/deepseek-v2-lite \
--output /path/to/trace.json
```
比较两次:
```bash
python experiments/deepseek/compare_v2_lite_traces.py \
--first /path/to/trace-1.json \
--second /path/to/trace-2.json \
--output /path/to/repro.json
```
## 8. 下一道研究闸门
本轮已经把 DeepSeek 第三轮从“计划真实 trace”推进到真实 tokenizer、MLA state、
MoE routes 与确定性复跑,但仍有四块未闭合:
1. 用真正只保存 latent 的 MLA kernel 对照 HF eager materialization;
2. 扩大公开语料样本,给 aggregate load 置信区间,并考察 batch / padding / sequence
对 expert parallel 的影响;
3. 复跑 FP8、pipeline 或通信 trace,而不是继续用教学 schedule;
4. 做可审计的 R1-like 小模型训练实验,记录 rollout、reward、KL、长度与梯度统计。
在这些闸门完成之前,DeepSeek 专题保持“第三轮进行中”,不写成完整独立复现。
+124 -7
View File
@@ -73,6 +73,9 @@ const overview = await evaluate(`(() => ({
paperLinks: document.querySelectorAll("[data-deepseek-paper-chain] a").length, paperLinks: document.querySelectorAll("[data-deepseek-paper-chain] a").length,
labTabs: document.querySelectorAll("[data-ds-tab]").length, labTabs: document.querySelectorAll("[data-ds-tab]").length,
labPanels: document.querySelectorAll("[data-ds-panel]").length, labPanels: document.querySelectorAll("[data-ds-panel]").length,
artifactTabs: document.querySelectorAll("[data-artifact-tab]").length,
artifactPanels: document.querySelectorAll("[data-artifact-panel]").length,
artifactLayers: document.querySelectorAll(".layer-evidence > span").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,
@@ -195,12 +198,111 @@ const rl = await evaluate(`(() => {
}; };
})()`); })()`);
const artifactRoute = await evaluate(`(() => {
const root = document.querySelector("[data-dsv2-lab]");
const read = () => ({
panel: root.querySelector("[data-artifact-panel]:not([hidden])").dataset.artifactPanel,
position: root.querySelector("[data-route-position]").textContent.trim(),
piece: root.querySelector("[data-route-piece]").textContent.trim(),
tokenId: root.querySelector("[data-route-token-id]").textContent.trim(),
weightSum: root.querySelector("[data-route-weight-sum]").textContent.trim(),
chosen: [...root.querySelectorAll("[data-route-experts] article")].map((node) => ({
expert: node.querySelector("b").textContent.trim(),
weight: node.querySelector("small").textContent.trim(),
})),
heatCells: root.querySelectorAll("[data-route-heatmap] > span").length,
selectedCells: root.querySelectorAll("[data-route-heatmap] > span.selected").length,
routes: root.querySelector("[data-route-count]").textContent.trim(),
used: root.querySelector("[data-route-used]").textContent.trim(),
cv: root.querySelector("[data-route-cv]").textContent.trim(),
effective: root.querySelector("[data-route-effective]").textContent.trim(),
});
const initial = read();
const layer = root.querySelector("[data-route-layer]");
const prompt = root.querySelector("[data-route-prompt]");
const token = root.querySelector("[data-route-token]");
layer.value = "4";
layer.dispatchEvent(new Event("change", { bubbles: true }));
prompt.value = "en_architecture";
prompt.dispatchEvent(new Event("change", { bubbles: true }));
token.value = String(token.options.length - 1);
token.dispatchEvent(new Event("change", { bubbles: true }));
const switched = read();
return { initial, switched, tokenOptions: token.options.length };
})()`);
const artifactLoad = await evaluate(`(() => {
const root = document.querySelector("[data-dsv2-lab]");
root.querySelector('[data-artifact-tab="load"]').click();
const read = () => ({
panel: root.querySelector("[data-artifact-panel]:not([hidden])").dataset.artifactPanel,
used: root.querySelector("[data-load-used]").textContent.trim(),
zero: root.querySelector("[data-load-zero]").textContent.trim(),
cv: root.querySelector("[data-load-cv]").textContent.trim(),
gini: root.querySelector("[data-load-gini]").textContent.trim(),
effective: root.querySelector("[data-load-effective]").textContent.trim(),
rows: root.querySelectorAll("[data-load-rows] > div").length,
jaccards: root.querySelectorAll("[data-load-jaccard] > article").length,
});
const layer1 = read();
root.querySelector('[data-load-layer="2"]').click();
const layer2 = read();
root.querySelector('[data-load-layer="4"]').click();
const layer4 = read();
return { layer1, layer2, layer4 };
})()`);
const artifactCache = await evaluate(`(() => {
const root = document.querySelector("[data-dsv2-lab]");
root.querySelector('[data-artifact-tab="cache"]').click();
const read = () => ({
panel: root.querySelector("[data-artifact-panel]:not([hidden])").dataset.artifactPanel,
latent: root.querySelector("[data-cache-latent-bytes]").textContent.trim(),
eager: root.querySelector("[data-cache-eager-bytes]").textContent.trim(),
ratio: root.querySelector("[data-cache-ratio]").textContent.trim(),
reduction: root.querySelector("[data-cache-reduction]").textContent.trim(),
});
const trace = read();
const context = root.querySelector("[data-cache-context]");
const batch = root.querySelector("[data-cache-batch]");
const layers = root.querySelector("[data-cache-layers]");
context.value = "1048576";
context.dispatchEvent(new Event("change", { bubbles: true }));
batch.value = "8";
batch.dispatchEvent(new Event("input", { bubbles: true }));
layers.value = "27";
layers.dispatchEvent(new Event("input", { bubbles: true }));
const million = read();
return { trace, million };
})()`);
const artifactEvidence = await evaluate(`(() => {
const root = document.querySelector("[data-dsv2-lab]");
root.querySelector('[data-artifact-tab="evidence"]').click();
const result = {
panel: root.querySelector("[data-artifact-panel]:not([hidden])").dataset.artifactPanel,
layers: root.querySelectorAll(".layer-evidence > span").length,
executed: root.querySelectorAll(".layer-evidence > span.executed").length,
split: root.querySelectorAll(".layer-evidence > span.split").length,
unloaded: root.querySelectorAll(".layer-evidence > span.unloaded").length,
exact: root.querySelector(".repro-gate strong").textContent.trim(),
dependency: root.querySelector(".dependency-split").textContent.replaceAll(/\\s+/g, " ").trim(),
boundary: root.querySelector('[data-artifact-panel="evidence"] .artifact-boundary').textContent.replaceAll(/\\s+/g, " ").trim(),
};
const first = root.querySelector('[data-artifact-tab="route"]');
first.focus();
first.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowRight", bubbles: true }));
result.keyboardSelected = root.querySelector('[data-artifact-tab][aria-selected="true"]').dataset.artifactTab;
result.keyboardVisible = root.querySelector("[data-artifact-panel]:not([hidden])").dataset.artifactPanel;
return result;
})()`);
await evaluate(`(() => { await evaluate(`(() => {
document.querySelector("[data-deepseek-lab]").scrollIntoView({ block: "start", behavior: "instant" }); document.querySelector("[data-dsv2-lab]").scrollIntoView({ block: "start", behavior: "instant" });
window.scrollBy(0, -82); window.scrollBy(0, -82);
})()`); })()`);
await pause(180); await pause(180);
await screenshot("/tmp/llm-atlas-deepseek-lab-desktop.png"); await screenshot("/tmp/llm-atlas-deepseek-artifact-desktop.png");
await navigate("/"); await navigate("/");
const home = await evaluate(`(() => ({ const home = await evaluate(`(() => ({
@@ -233,6 +335,7 @@ await command("Emulation.setDeviceMetricsOverride", {
await navigate("/deepseek/"); await navigate("/deepseek/");
const mobile = await evaluate(`(() => { 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]");
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();
@@ -242,8 +345,10 @@ const mobile = await evaluate(`(() => {
menuOpen: toggle.getAttribute("aria-expanded"), menuOpen: toggle.getAttribute("aria-expanded"),
mobileLinks: document.querySelectorAll("#mobile-nav a").length, mobileLinks: document.querySelectorAll("#mobile-nav a").length,
tabs: root.querySelectorAll("[data-ds-tab]").length, tabs: root.querySelectorAll("[data-ds-tab]").length,
artifactTabs: artifact.querySelectorAll("[data-artifact-tab]").length,
artifactHeatCells: artifact.querySelectorAll("[data-route-heatmap] > 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]")) .filter((node) => !node.closest(".paper-chain, .advantage-table, .precision-table, .mapping-table, [data-deepseek-lab], [data-dsv2-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) => ({
@@ -256,21 +361,23 @@ const mobile = await evaluate(`(() => {
})()`); })()`);
await evaluate(`(() => { await evaluate(`(() => {
document.querySelector("#menu-toggle")?.click(); document.querySelector("#menu-toggle")?.click();
document.querySelector("[data-dsv2-lab]").scrollIntoView({ block: "start", behavior: "instant" });
window.scrollBy(0, -82); window.scrollBy(0, -82);
})()`); })()`);
await pause(180); await pause(180);
await screenshot("/tmp/llm-atlas-deepseek-mobile.png"); await screenshot("/tmp/llm-atlas-deepseek-artifact-mobile.png");
const report = { overview, capacity, cache, codesign, rl, home, papers, mobile, exceptions }; const report = { overview, capacity, cache, codesign, rl, artifactRoute, artifactLoad, artifactCache, artifactEvidence, 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 !== 25 || overview.tocLinks !== 25) failures.push("二十四个编号专题加阅读链的目录结构异常"); if (overview.sections !== 26 || overview.tocLinks !== 26) 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 !== 4 || overview.artifactPanels !== 4 || overview.artifactLayers !== 27) failures.push("真实权重四联实验结构异常");
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 稀疏容量初始账异常");
@@ -287,9 +394,19 @@ if (rl.initial.signal !== "GROUP-RELATIVE SIGNAL" || rl.same.signal !== "ZERO GR
if (!rl.dapo.provenance.includes("2503.14476") || !rl.dapo.algorithm.includes("FOLLOW-UP") || !rl.dr.provenance.includes("2503.20783")) failures.push("DAPO / Dr.GRPO 来源边界异常"); if (!rl.dapo.provenance.includes("2503.14476") || !rl.dapo.algorithm.includes("FOLLOW-UP") || !rl.dr.provenance.includes("2503.20783")) failures.push("DAPO / Dr.GRPO 来源边界异常");
if (!rl.r1.includes("cold start") || !rl.distill.includes("没有重演")) failures.push("R1 / distill 身份切换异常"); if (!rl.r1.includes("cold start") || !rl.distill.includes("没有重演")) failures.push("R1 / distill 身份切换异常");
if (rl.keyboardSelected !== "cache" || rl.keyboardVisible !== "cache") failures.push("实验键盘 tab 导航异常"); if (rl.keyboardSelected !== "cache" || rl.keyboardVisible !== "cache") failures.push("实验键盘 tab 导航异常");
if (artifactRoute.initial.panel !== "route" || artifactRoute.initial.chosen.length !== 6 || artifactRoute.initial.heatCells !== 64 || artifactRoute.initial.selectedCells !== 6) failures.push("真实 top-6 路由结构异常");
if (artifactRoute.initial.routes !== "156" || artifactRoute.initial.used !== "54 / 64" || artifactRoute.initial.weightSum !== "0.4540") failures.push("Layer 1 中文 token 路由初值异常");
if (artifactRoute.switched.chosen.length !== 6 || artifactRoute.switched.heatCells !== 64 || artifactRoute.tokenOptions !== 18 || numeric(artifactRoute.switched.weightSum) >= 1) failures.push("路由层 / prompt / token 切换异常");
if (artifactLoad.layer1.panel !== "load" || artifactLoad.layer1.used !== "63" || artifactLoad.layer1.cv !== "0.925" || artifactLoad.layer1.rows !== 5 || artifactLoad.layer1.jaccards !== 6) failures.push("Layer 1 聚合负载账异常");
if (artifactLoad.layer2.used !== "64" || artifactLoad.layer2.cv !== "0.549" || artifactLoad.layer4.used !== "62" || artifactLoad.layer4.gini !== "0.417") failures.push("跨层负载统计切换异常");
if (artifactCache.trace.panel !== "cache" || artifactCache.trace.latent !== "850.50 KiB" || artifactCache.trace.eager !== "7.38 MiB" || artifactCache.trace.ratio !== "8.89×" || artifactCache.trace.reduction !== "88.75%") failures.push("V2-Lite trace 缓存实现账异常");
if (!artifactCache.million.latent.includes("GiB") || !artifactCache.million.eager.includes("TiB")) failures.push("V2-Lite 百万 Token 缓存外推异常");
if (artifactEvidence.panel !== "evidence" || artifactEvidence.layers !== 27 || artifactEvidence.executed !== 7 || artifactEvidence.split !== 1 || artifactEvidence.unloaded !== 19 || artifactEvidence.exact !== "31 / 31") failures.push("真实工件执行边界或复跑闸门异常");
if (!artifactEvidence.dependency.includes("Transformers 5.5") || !artifactEvidence.dependency.includes("4.41.2") || !artifactEvidence.boundary.includes("完整 27 层生成")) failures.push("依赖版本或未覆盖边界异常");
if (artifactEvidence.keyboardSelected !== "load" || artifactEvidence.keyboardVisible !== "load") 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) failures.push("移动端导航或实验异常"); if (!mobile.menuVisible || mobile.menuOpen !== "true" || mobile.tabs !== 4 || mobile.artifactTabs !== 4 || mobile.artifactHeatCells !== 64) 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(" | ")}`);
File diff suppressed because it is too large Load Diff
+142
View File
@@ -0,0 +1,142 @@
{
"schema_version": 1,
"captured_at": "2026-07-29T05:57:27.848243+00:00",
"first": {
"captured_at": "2026-07-29T05:55:35.599912+00:00",
"sha256": "81ff4ab34d20121fe42219c566dd4780f4c7f74252a31b596f90e5280e1f1aef"
},
"second": {
"captured_at": "2026-07-29T05:56:32.527770+00:00",
"sha256": "b5e2e7567e17765195313473499522a4529b9d37ea96963ba2b9455c3c0b86e6"
},
"timing_compared": false,
"checks": [
{
"name": "provenance",
"exact": true
},
{
"name": "configuration",
"exact": true
},
{
"name": "prompt_tokenization",
"exact": true
},
{
"name": "initial_hidden_hash",
"exact": true
},
{
"name": "final_hidden_hash",
"exact": true
},
{
"name": "layer_0_hidden_hash",
"exact": true
},
{
"name": "layer_0_mla_shapes",
"exact": true
},
{
"name": "layer_1_hidden_hash",
"exact": true
},
{
"name": "layer_1_mla_shapes",
"exact": true
},
{
"name": "layer_1_aggregate_load",
"exact": true
},
{
"name": "layer_1_token_routes",
"exact": true
},
{
"name": "layer_2_hidden_hash",
"exact": true
},
{
"name": "layer_2_mla_shapes",
"exact": true
},
{
"name": "layer_2_aggregate_load",
"exact": true
},
{
"name": "layer_2_token_routes",
"exact": true
},
{
"name": "layer_3_hidden_hash",
"exact": true
},
{
"name": "layer_3_mla_shapes",
"exact": true
},
{
"name": "layer_3_aggregate_load",
"exact": true
},
{
"name": "layer_3_token_routes",
"exact": true
},
{
"name": "layer_4_hidden_hash",
"exact": true
},
{
"name": "layer_4_mla_shapes",
"exact": true
},
{
"name": "layer_4_aggregate_load",
"exact": true
},
{
"name": "layer_4_token_routes",
"exact": true
},
{
"name": "layer_5_hidden_hash",
"exact": true
},
{
"name": "layer_5_mla_shapes",
"exact": true
},
{
"name": "layer_5_aggregate_load",
"exact": true
},
{
"name": "layer_5_token_routes",
"exact": true
},
{
"name": "layer_6_hidden_hash",
"exact": true
},
{
"name": "layer_6_mla_shapes",
"exact": true
},
{
"name": "layer_6_aggregate_load",
"exact": true
},
{
"name": "layer_6_token_routes",
"exact": true
}
],
"exact_checks": 31,
"total_checks": 31,
"all_exact": true
}
File diff suppressed because it is too large Load Diff
+66 -9
View File
@@ -2,6 +2,7 @@
import BaseLayout from "@/layouts/BaseLayout.astro"; import BaseLayout from "@/layouts/BaseLayout.astro";
import DeepSeekLineage from "@/components/DeepSeekLineage.astro"; 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 { deepseekBranches, deepseekLedgers, deepseekPaperChain, deepseekWaves } from "@/data/deepseek"; import { deepseekBranches, deepseekLedgers, deepseekPaperChain, deepseekWaves } from "@/data/deepseek";
const toc = [ const toc = [
@@ -27,21 +28,22 @@ const toc = [
["19", "v4-state", "V4:异构状态与稳定性"], ["19", "v4-state", "V4:异构状态与稳定性"],
["20", "k3", "与 K3 的继承边界"], ["20", "k3", "与 K3 的继承边界"],
["21", "lab", "四联交互实验"], ["21", "lab", "四联交互实验"],
["22", "branches", "别漏掉旁支"], ["22", "artifact", "真实权重执行"],
["23", "audit", "事实、推导与教学模型"], ["23", "branches", "别漏掉旁支"],
["24", "audit", "事实、推导与教学模型"],
["↳", "papers", "六十节点阅读链"], ["↳", "papers", "六十节点阅读链"],
]; ];
--- ---
<BaseLayout <BaseLayout
title="DeepSeek 技术谱系深读:从 Dense、MoE、MLA 到 R1 与 V4" title="DeepSeek 技术谱系与真实权重深读:从 Dense、MoE、MLA 到 R1 与 V4"
description="用二十四张问题账、十次技术转向、四个交互实验和六十个一手节点,完整理解 DeepSeek 的 MoE、MLA、FP8、DualPipe、GRPO、R1、V3.2 与 V4。" description="用二十四张问题账、十次技术转向、八个交互实验、真实 V2-Lite 权重 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 02</span> ALGORITHM × SYSTEM × EVIDENCE</p> <p class="eyebrow"><span>SPOTLIGHT / DEEPSEEK · ROUND 03</span> ALGORITHM × SYSTEM × REAL WEIGHTS</p>
<h1>不要背模型名<br />要看懂每次为什么转向</h1> <h1>不要背模型名<br />要看懂每次为什么转向</h1>
<p class="lead"> <p class="lead">
这不是七篇报告的摘要,而是一套可追问、可计算、可反驳的技术谱系: 这不是七篇报告的摘要,而是一套可追问、可计算、可反驳的技术谱系:
@@ -53,9 +55,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>4 个可操作实验</dd></div> <div><dt>LABS</dt><dd>8 个可操作实验</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>三轮 · 真实权重执行</dd></div>
</dl> </dl>
</div> </div>
</header> </header>
@@ -762,8 +764,25 @@ const toc = [
<DeepSeekLab /> <DeepSeekLab />
</section> </section>
<section class="article-section" id="artifact">
<p class="eyebrow"><span>22</span> OFFICIAL WEIGHTS / EXECUTED</p>
<h2>从“MLA 与 MoE 的概念”再往前一步:让官方 V2-Lite 权重真的跑起来</h2>
<p class="lede">
前面的四联实验负责建立公式与角色合同;下面的四联工件实验固定官方 revision、tokenizer、
模型代码和 checkpoint 第一分片,在 RTX 5090 上连续执行 layer 0–6。它把真实观测、shape 推导、
实现差距和未覆盖范围放在同一张证据图里。
</p>
<div class="artifact-callout">
<article><span>X / FORWARD</span><b>7 / 27 layers</b><p>1 个 dense 层 + 6 个 MoE 层;layer 7 因跨分片停止。</p></article>
<article><span>X / ROUTES</span><b>3,240</b><p>90 个有效 token × 6 层 × top-6 routed experts。</p></article>
<article><span>X + D / CACHE</span><b>576 ↔ 5,120</b><p>latent 合同与 HF eager 实际展开元素,两张账同时保留。</p></article>
<article><span>X / RERUN</span><b>31 / 31 exact</b><p>hidden hashes、MLA shapes、loads 与全部 token routes。</p></article>
</div>
<DeepSeekArtifactLab />
</section>
<section class="article-section" id="branches"> <section class="article-section" id="branches">
<p class="eyebrow"><span>22</span> THE MAIN LINE IS NOT THE WHOLE TREE</p> <p class="eyebrow"><span>23</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]) => (
@@ -783,7 +802,7 @@ const toc = [
</section> </section>
<section class="article-section" id="audit"> <section class="article-section" id="audit">
<p class="eyebrow"><span>23</span> EVIDENCE AUDIT</p> <p class="eyebrow"><span>24</span> EVIDENCE AUDIT</p>
<h2>同一张页面里有三种知识,它们的语气必须不同</h2> <h2>同一张页面里有三种知识,它们的语气必须不同</h2>
<div class="audit-grid"> <div class="audit-grid">
<article class="reported"> <article class="reported">
@@ -837,6 +856,43 @@ const toc = [
radial-gradient(circle at 65% 38%, rgba(84, 124, 116, 0.13), transparent 24%); radial-gradient(circle at 65% 38%, rgba(84, 124, 116, 0.13), transparent 24%);
} }
.artifact-callout {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
max-width: 980px;
margin: 30px 0;
border-top: 1px solid var(--line);
border-left: 1px solid var(--line);
}
.artifact-callout article {
min-height: 155px;
padding: 20px;
border-right: 1px solid var(--line);
border-bottom: 1px solid var(--line);
background: var(--paper-raised);
}
.artifact-callout span {
display: block;
color: var(--copper);
font: 700 0.58rem/1 var(--mono);
letter-spacing: 0.08em;
}
.artifact-callout b {
display: block;
margin-top: 18px;
font-size: 1.14rem;
}
.artifact-callout p {
margin: 11px 0 0;
color: var(--muted);
font-size: 0.68rem;
line-height: 1.55;
}
.moe-compare, .moe-compare,
.four-layer { .four-layer {
display: grid; display: grid;
@@ -1674,6 +1730,7 @@ const toc = [
.followup-grid, .followup-grid,
.state-machines, .state-machines,
.v4-contract, .v4-contract,
.artifact-callout,
.branch-grid, .branch-grid,
.audit-grid, .audit-grid,
.paper-chain.expanded { .paper-chain.expanded {
+4 -4
View File
@@ -145,17 +145,17 @@ 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 02</span> CAPACITY · STATE · SYSTEM · REASONING</p> <p class="eyebrow"><span>NEW / DEEPSEEK ROUND 03</span> LINEAGE · REAL WEIGHTS · ROUTES · CACHE</p>
<h2>从 Dense 到百万上下文:每次创新都在偿还上一代最贵的一张账</h2> <h2>从 Dense 到百万上下文:每次创新都在偿还上一代最贵的一张账</h2>
<p> <p>
用二十四张问题账和十次技术转向,从 DeepSeek LLM、MoE、V2 的 MLA 权重吸收, 用二十四张问题账和十次技术转向走完 Dense→V4,再固定官方 V2-Lite 权重执行 7/27 层:
走到 V3 的 FP8 / DualPipe / MTP、R1 与 DAPO / Dr.GRPO 反查、V3.2 Agent 环境和 V4 异构长状态。 逐 token 检查 3,240 次专家选择,并把 latent 状态与 HF eager cache 的实现差距摆在同一张账上。
</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>MoE · MLA · V3 协同 · RL 偏差</dd></div> <div><dt>LAB</dt><dd>4 公式实验 · 4 真实工件实验</dd></div>
</dl> </dl>
<span class="release-arrow" aria-hidden="true">进入 DeepSeek 完整技术谱系 →</span> <span class="release-arrow" aria-hidden="true">进入 DeepSeek 完整技术谱系 →</span>
</a> </a>
+5 -5
View File
@@ -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: 83, next: "加入真实专家负载、MLA kernel、RL 训练 traces 与独立复现" }, { label: "DeepSeek 专题", value: 87, next: "真实 latent-cache kernel、更大样本负载、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 训练曲线与安全案例" },
@@ -50,7 +50,7 @@ const workstreams = [
<div><dt>OVERALL</dt><dd>专题平均 {average}%</dd></div> <div><dt>OVERALL</dt><dd>专题平均 {average}%</dd></div>
<div><dt>READABLE</dt><dd>{published} 个首版可读专题</dd></div> <div><dt>READABLE</dt><dd>{published} 个首版可读专题</dd></div>
<div><dt>ACTIVE</dt><dd>{researching} 个研究/写作中</dd></div> <div><dt>ACTIVE</dt><dd>{researching} 个研究/写作中</dd></div>
<div><dt>UPDATED</dt><dd>2026-07-29 12:40 CST</dd></div> <div><dt>UPDATED</dt><dd>2026-07-29 14:15 CST</dd></div>
<div><dt>MODE</dt><dd>持续迭代,不锁死版本</dd></div> <div><dt>MODE</dt><dd>持续迭代,不锁死版本</dd></div>
</dl> </dl>
</div> </div>
@@ -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 三轴图、八联报告实验与四联开放工件实验,以及语言模型前史、Transformer、表示深度、DeepSeek、长上下文、MoE、推理、Agent、多模态、训练系统、推理服务、Scaling、数据工程、数值、Alignment 与评测安全专题。</p></article> <article><span>✓</span><h3>七十五个原创交互视图</h3><p>K3 三轴图、八联报告实验与四联开放工件实验,DeepSeek 四联公式实验与四联真实权重实验,以及语言模型前史、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>二十四张问题账、十次技术转向、60 个一手/官方节点,以及稀疏容量—MLA 缓存—V3 协同—RL 偏差四联实验。</p></article> <article><span>✓</span><h3>DeepSeek 三轮真实权重里程碑</h3><p>在二十四张问题账、十次转向与四联公式实验上,新增 V2-Lite 7/27 层连续 forward、3,240 次真实专家选择、MLA/eager cache 实现账与 31/31 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>真实 expert load / MLA kernel → FP8 / pipeline traces → R1-like RL 小模型复现</p><em>运行证据 + 独立复现</em></div> <div><span>P0</span><strong>DeepSeek 三轮</strong><p>真实 latent-cache kernel / 更大负载样本 → 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>