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
+124 -7
View File
@@ -73,6 +73,9 @@ const overview = await evaluate(`(() => ({
paperLinks: document.querySelectorAll("[data-deepseek-paper-chain] a").length,
labTabs: document.querySelectorAll("[data-ds-tab]").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,
followups: document.querySelectorAll(".lineage-row.followup").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(`(() => {
document.querySelector("[data-deepseek-lab]").scrollIntoView({ block: "start", behavior: "instant" });
document.querySelector("[data-dsv2-lab]").scrollIntoView({ block: "start", behavior: "instant" });
window.scrollBy(0, -82);
})()`);
await pause(180);
await screenshot("/tmp/llm-atlas-deepseek-lab-desktop.png");
await screenshot("/tmp/llm-atlas-deepseek-artifact-desktop.png");
await navigate("/");
const home = await evaluate(`(() => ({
@@ -233,6 +335,7 @@ await command("Emulation.setDeviceMetricsOverride", {
await navigate("/deepseek/");
const mobile = await evaluate(`(() => {
const root = document.querySelector("[data-deepseek-lab]");
const artifact = document.querySelector("[data-dsv2-lab]");
root.scrollIntoView({ block: "start", behavior: "instant" });
const toggle = document.querySelector("#menu-toggle");
toggle?.click();
@@ -242,8 +345,10 @@ const mobile = await evaluate(`(() => {
menuOpen: toggle.getAttribute("aria-expanded"),
mobileLinks: document.querySelectorAll("#mobile-nav a").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 *")]
.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)
.slice(0, 12)
.map((node) => ({
@@ -256,21 +361,23 @@ const mobile = await evaluate(`(() => {
})()`);
await evaluate(`(() => {
document.querySelector("#menu-toggle")?.click();
document.querySelector("[data-dsv2-lab]").scrollIntoView({ block: "start", behavior: "instant" });
window.scrollBy(0, -82);
})()`);
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));
const numeric = (text) => Number.parseFloat(text.replaceAll(",", ""));
const failures = [];
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.paperLinks !== 60 || overview.branches !== 5 || overview.followups !== 1) 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.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 稀疏容量初始账异常");
@@ -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.r1.includes("cold start") || !rl.distill.includes("没有重演")) failures.push("R1 / distill 身份切换异常");
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 (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 (exceptions.length) failures.push(`浏览器异常:${exceptions.join(" | ")}`);