Add measured collective profile gate for Qwen235

This commit is contained in:
2026-07-19 16:45:35 +08:00
parent f4a75aa8e4
commit 506e63a633
13 changed files with 1002 additions and 45 deletions

View File

@@ -0,0 +1,64 @@
# 实验 EXP-SIMFID-Q235-CC-TP8真实 TP4/TP8 collective profile 消融
> **状态:** review 通过,执行中
>
> 本 card 是 SHA、command、config、log 等 provenance 的唯一归宿;本轮只重跑 simulator不重跑已经冻结的 48 个真机 trial。
## Claim 与决策
- **Parent claim** Qwen235 Fixed-PD 的 30%+ TPOT/E2E selection regret是否主要由 TP8 collective profile 缺失及 TP4 profile 与真实 serving backend 不匹配造成。
- **目的:** 支持或反驳 mechanism hypothesis不是用同一 workload 的 E2E calibration 修正 simulator。
- **Competing hypotheses**
- H1collective profile coverage/backend mismatch 是排序反转的必要主因。换成与真机 serving 一致的 TP4/TP8 实测 profile 后Frontier 的 Fixed-PD TPOT winner 从 TP8 翻到 TP4mean/p90 TPOT 与 E2E selection regret 降到 10% 以内。
- H2collective mismatch 只解释部分误差。换 profile 后 TP8 仍是 Frontier winnerFixed-PD TPOT/E2E regret 仍超过 10%;下一主因应定位 decode batch/state-conditioned MoE composition。
- **事前预测:** 当前 Frontier 在 Fixed-PD 上预测 TP4/TP8 mean TPOT 为 87.77/61.59 msTP8 有 26.19 ms 优势;真实 TP4/TP8 为 21.04/27.99 ms。若新的 TP4/TP8 collective profile 使这个 26.19 ms 的 simulator margin 反转,则支持 H1若不能则支持 H2。
- **判定规则:** 只以 frozen simulator rerun 的 winner 与真实 frozen surface 计算 selection regret。绝对 latency ratio 作为 secondary metric不用它替代 selection verdict。
## Setup
- **自变量:**
- A0当前 `measured-allreduce.csv`TP4 是 Qwen30 hidden=2048 的旧实测,且 profiler 只检查 FlashInfer 可用、没有证明每个 payload 的实际 dispatchTP8 无行并静默 analytical fallback。
- A1Qwen235 serving-matched piecewise collective profileTP4/TP8 都在 dash0 H20、vLLM 0.20.0 commit `88d34c640...` 上实测。Frozen server logs 证明真机同时使用 `disable_custom_all_reduce=true` 与 FlashInfer-TRTLLM `allreduce_rms` fusionprofile 对 fusion-eligible payload 测同一 FlashInfer communicator对阈值外 payload 测真实 PyNCCL/symmetric fallback。
- **控制变量:** Frontier commit、Qwen235 operator profiles、runtime contract、四类 frozen traces、候选配置、MNS/MBT、prefix policy、real results 与分析脚本全部不变。
- **System context** Qwen3-235B-A22B-FP8vLLM 0.20.0+cu129dash0 8×H20`{TP4/EP1, TP8/EP8} × MNS{64,128}`MBT=8192Frontier piecewise graph path。
- **Workload 或 trace** 重跑四类 simulator surfaceFixed-PD 4096→256 @ 0.2 req/s/GPU、Fixed-PO 4096→1、Trace-PD、Trace-PO每 cell 沿用原 129-request trace。Fixed-PD 是 primary另外三类检查 profile 替换是否引入新的 selection regression。
- **Profile protocol** payload 覆盖所有 Qwen235 decode graph buckets1--256含真实 capture sizes、fusion 阈值两侧 `{63,64,65}` / `{255,256,257}`,以及 512--8192 prefill sizes每个 TP 与 payload 先 warmup再保留 3×20 个 per-rank CUDA-event samples。raw JSON 记录实际 backend dispatch、fusion byte limit、world size、dtype、payload bytes、GPU/runtime/commit 与 source hashes。TP4/TP8 使用相同 payload grid不把 microbenchmark 直接当作 E2E 结论。
- **Profile contract** H20/SM90 上 vLLM 0.20 的 fusion limit 是 TP4 2 MiB、TP8 0.5 MiB即 Q235 BF16 hidden=4096 时分别为 256/64 tokens。simulator runner 启动前解析 CSV要求所选 configs 的每个 `TP>1` 都有有限、正值的 measured rows缺覆盖立即失败。结果 manifest 写入 CSV SHA-256、TP coverage、row counts 与 piecewise backend 集合。决策实验禁止 analytical fallback。
- **Baselines** A0 current Frontier、A1 measured-profile Frontier、frozen real hardware surface。
- **Metrics** profile latency median/p90 与跨 rank spreadsimulated mean/p90 TTFT/TPOT/E2Ewinner、selection regret、tau-b可定义时每个 TP 的 measured-profile hit/fallback counters。
## 预期产物与 review
- **预期数据:** TP4/TP8 raw collective JSONmaterialized Frontier CSV + manifest四类 A1 simulator surfaceA0/A1/real comparison JSON/Markdownprofile cost ledger。
- **Figure prototype** `../../runs/frontier-fidelity-envelope-v1/qwen235-collective-ablation-mock.png`;左图固定真实与 A0 TPOT并为 A1 留待测 series右图明确“winner flip→0% regret / unchanged→33% regret”的判定。它回答 profile 修复是否足以改变配置选择。
- **人工 review** 通过2026-07-19用户明确要求“推进实验”
- **Review 意见:** 保留 frozen real surface只补真实 TP4/TP8 profile 后重跑 simulator每个 simulator 实验必须使用真实 profile缺失 coverage 或运行时 analytical fallback 立即失败。
## Benchmark design auditexperiment-design-review
| Crime | Verdict | Severity | Evidence | Fix / gate |
|---|---|---|---|---|
| 用 microbenchmark 代替 E2E | PASS | — | collective profile 只作为自变量;结论来自完整 simulator surface 对 frozen real surface 的 selection regret | 保留 A0/A1/real 三方结果 |
| calibration set 等于 evaluation set | PASS | — | A1 只测 collective operator不使用 real E2E latency 拟合参数 | 禁止 E2E scale/calibration |
| selective benchmarking | PASS | — | primary Fixed-PD 外,同时重跑另外三类 workload | 报告所有 16 个 simulator cells |
| 缺失平台/版本 | PASS | — | raw/manifest 绑定 H20、vLLM commit、model、backend 与 hashes | 任一 provenance 缺失则 profile 不可采纳 |
| 缺失方差 | NEEDS EVIDENCE | Major | 尚未执行 profile repeats | raw artifact 必须保留 per-rank repeated samples并报告 spread |
| profile 覆盖静默降级 | FAILA0 | Blocking | TP8 无 measured rowsFrontier 使用 analytical fallback | A1 runner fail-fastfallback count 必须为 0 |
| backend/fusion 阈值未对齐 | FAILA0 | Blocking | 真机日志启用 FlashInfer `allreduce_rms`vLLM 源码规定 H20 TP4/TP8 fusion limit 为 2/0.5 MiB旧 CSV 未记录这条 piecewise contract | A1 在阈值两侧实测并记录每行 dispatch |
**总体建议:** 已批准执行coverage gate、backend match 与 provenance gate 任一不通过则 Block。
## 复现信息
- **Code** AITuner branch `feature/sim`;本 card 创建时 HEAD `f4a75aa8e400ead4eb6d305178192e85940c6de6`,后续运行 commit 待填。vLLM source commit `88d34c6409e9fb3c7b8ca0c04756f061d2099eb1`
- **Environment** dash0 8×H20`/tmp/wjh/venvs/vllm-0.20.0-cu129-profiler-v1`model `/home/admin/cpfs/wjh/models/Qwen/Qwen3-235B-A22B-FP8`
- **产物路径:** 待 review 后冻结;不得覆盖旧 campaign `/home/admin/cpfs/wjh/aituner/qwen235-v020-fourcase-20260719-r1`
- **已知 deviation** `--disable-custom-all-reduce` 只关闭 vLLM custom AR不关闭编译器的 FlashInfer `allreduce_rms` fusion。真机 TP4/TP8 日志都显示自动选择 `trtllm` workspace旧 TP4 profiler 没有记录/执行真实 fusion-limit piecewise dispatch。A1 因此必须同时重测 TP4 与 TP8不能只追加 TP8 行。
## 结果
- **观察事实:** 待运行。
- **异常:** 待运行。
- **含义:** 待运行。
- **Claim update** unchanged
- **下一步:** 依次完成 collective profiling、profile materialization、CPU simulator rerun 与 analysis。

72
.research/ongoing.md Normal file
View File

@@ -0,0 +1,72 @@
# AITuner 研究当前状态
> 2026-07-17写给未参与项目的读者可直接作为 presentation 讲稿。历史过程与复现信息见 `../runs/*/` 各 experiment card、`../docs/` 各 campaign 文档。
>
> **2026-07-19 update** Qwen235 四类 workload matrix 已完成Fixed-PD 出现 33.0--37.2% TPOT 与 30.7--34.6% E2E selection regret。当前发现 Q235 simulator 输入的 collective CSV 缺 TP8并且旧 TP4 profile 未绑定真实 `allreduce_rms` fusion-limit dispatch。active ablation 见 [`experiments/qwen235-tp8-collective-profile-ablation-20260719.md`](experiments/qwen235-tp8-collective-profile-ablation-20260719.md)。
## 一眼看懂
- **Topic / problem** LLM serving 的自动、低成本配置调优AITuner。当前主线问题用 simulator 给部署配置(并行度、批量上限等)排序,什么时候可信?需要补多少真机证据?算上这些成本还划算吗?
- **Central claim** simulator 要能帮助配置调优,必须先满足 scheduler transition 的 liveness/coverage再满足「配置相关残差小于真机 decision margin」前者决定 capacity 是否有定义,后者决定排序是否正确。(ID: C0)
- **当前结论:** 早先 35 个 trace stall 不是 Frontier scheduler liveness failureadapter 为不满 16-token 的 prefix block 错误生成了 cache identityFrontier 又没有 fail-fast。修正为完整 block、使用真实 graph buckets/KV blocks 和 `piecewise`/`KERNEL_ONLY` profile 后Qwen30 Trace-PD 的全部 12 个 cell 完成 129/129 requestFrontier 对 TTFT/TPOT/E2E 的 6 个 argmin 均与三次 fresh-server 真机一致;但绝对 latency 仍高估 4--511×。这只证明一个 MoE Trace-PD surface 的 selection fidelity不能外推到 prefill-only、fixed workload 或 235B。
- **最大 uncertainty / risk** 这个正确选择是否依赖 Trace-PD 的 queue/margin 偶然性Fixed-PD、Trace-P、Fixed-P 与大型 FP8 MoE 是否仍保留正确 config ranking。Q235 还缺少同栈 profile/runtime contract不能复用旧 vLLM 0.10.2 数据。
- **下一项 critical action** 完成 Qwen30 其余三项 fixed/trace × PD/P surface。Fixed case 已先启动无请求 vLLM runtime-state preflightTrace-P 的 graph-aligned Frontier 12-cell CPU surface 正在运行。Q235 先做 vLLM 0.20 TP4/TP8 compatibility gate随后才允许新 profile。
- **停止条件:** T1 出 verdict 且成本账本建立后pass 且摊销论证成立 → 转向「sim 剪枝 + 真机终选」的 hybrid 机制设计fail → 转入失败机制归因;两条路都无 insight 增量 → 收敛写作。
## 核心概念
- **Frontier** 本项目使用的 simulator属 Vidur 系(直接使用 vidur backend加自研 FP8/MoE/EP/decode-profile 兼容补丁。
- **Regret** 按 simulator 排序选配置,相对真机最优配置的性能损失百分比(以每 GPU capacity 计。primary metric排序选对则 regret=0。
- **τ-bKendall tau-b** simulator 排序与真机排序的秩相关1 = 完全一致1 = 完全反序0 = 无关tie-aware。
- **Decision margin** 真机上头部配置之间的性能差距,即 simulator 误差的容忍带。
- **Action-differential residual** simulator 误差中随配置action不同而不同的部分。Why needed所有配置统一偏移不影响排序只有差异化残差才可能穿过 margin 改变选择——这解释了「绝对误差 33%」与「排序全对」为何可以同时成立。
- **Capacity bracket** 真机 anchor 为候选配置的 capacity 划出的上下界「bracket 不反转」指未测的负载点不可能推翻 top 选择。
- **Decision-valid coverage** simulator 能从初始状态推进到所有请求完成,并为 config×workload cell 产生合法 SLO metric 的比例。若 reachable nonterminal state 没有 enabled transition/future eventcapacity 与 rank 都没有定义,不能把该 cell 当作 infeasible。
- **Workload realism 阶梯:** prefill-only无 decode→ fixed-shape mixed固定输入输出长度的混合负载→ trace-faithful mixed生产 trace 忠实回放。fidelity 结论不能向更高一级外推。
## Claim 层级
- **Central claim** 见「一眼看懂」。(ID: C0)
- **Subclaim** zero-shot 排序失败是真实现象。(ID: C1supported)
- 30B 纯 profile 驱动的 regret 为 25.63%(τ-b=0另一 throughput-proxy 评测口径下为 30.46%。Boundary均发生在 capacity-point + SLO-gated selection——恰是 Vidur 论文自己声明预测误差会爆炸、评测刻意回避的 regime见 claim map
- **Subclaim** 少量结构化的真机证据可以恢复低 regret 排序。(ID: C2)
- **Hypothesisdecision-bearing** trace-faithful 回放下,同栈 profile + 真机 KV capacity + 兼容补丁、且不做逐案例端到端校准的 Frontier能满足 gateregret ≤5% ∧ τ-b ≥0.8 ∧ bracket 不反转。(ID: H1weakened)
- **Supporting** 235B prefill-only regret=0235B fixed-shape mixed 的 top set 全中30B 加 per-TP 校准后 regret 0.76%(但这是外部端到端 scale 给出的上界,不是原生 profile 保真度)。
- **Counterevidence** 修正 prefix trace contract 后的 TP2/MNS16 `none`-graph run 完成但 p50 TPOT 约 96 ms真机为约 14 ms然而该比较尚未对齐 real vLLM 的 `FULL_AND_PIECEWISE` graph path。
- **下一项 discriminative experiment** 补齐 `KERNEL_ONLY` graph family并以 `piecewise` 重跑相同 trace若 full surface 仍错graph omission 不再是可用解释。
- **Hypothesis机制active** 误差机制是 action-conditioned residual——执行状态的转移并行拓扑、kernel family、graph mode、batch 组成)使按算子 profile 的组合预测跨配置不可复合;残差大于 margin 时排序失败。(ID: H2supported)
- **Supporting** 三个 TP 档的端到端校准系数为 0.72/0.47/0.35残差确实随配置剧烈变化235B 的批量上限交互预测错误但被 2× margin 容忍30B prefill-only 在低负载近似对齐、饱和后按 TP 反向放大,最终 τ-b=1。
- **下一步:** 按 collective 通信 → batch 组成 → 调度器逐步轨迹的单变量顺序定位组合性失效点(对应 experiment card 中 A1/A2/A3 消融阶梯)。
- **Subclaim** 成本论证只有在摊销前提下成立。(ID: C3)
- **Hypothesisactive** 每个 model×硬件×runtime 的一次性对齐成本,摊销到大配置面、频繁重调(引擎版本 churn 的频率证据见 claim map或禁止在线实验的场景后低于重复真机调优。(ID: H3untested——分母已实测分子未入账)
- **下一步:** 建 cost ledger见「下一步」
## 当前 critical experiment
- **Question** 生产 trace 忠实回放prefix 打开、原始到达时间与会话结构best-effort Frontier 能否满足 low-regret gate
- **为什么现在做:** 这是 H1 的判决实验;所有已完成的机制分解都在人工 workload 上,不能替代这个 verdict。
- **当前状态:** Trace-PD 的 graph-aligned surface 已通过 selection gate但绝对 latency 不通过 calibration。现在以不共享结果的 Fixed-PD、Trace-P、Fixed-P surface 检验它的泛化边界。
- **Result → decision** 若其它 surface 排序失败,保留 Trace-PD success 为条件化 envelope并按 fixed/trace/prefill/decode 的差异定位 state composition若都通过才扩大到 Q235 或寻找 simulator 已解决范围之外的新问题。
- **Experiment card** [`../runs/frontier-fidelity-envelope-v1/experiment-card.md`](../runs/frontier-fidelity-envelope-v1/experiment-card.md)
## Key evidence最多 3 条)
- **E1否证「prefill-only 是充分 easy condition」支持 H2** 30B BF16、去掉 decode/prefix/混合 batch 后,真机最优是 TP48 vs 7 req/s/GPUsimulator 却把 TP4 排最差6 vs 8top set 无交集regret 12.5%,τ-b=1。产物`../runs/frontier-phase-factorial-v0/results/final/`dash012.07 H20-GPUh
- **E2margin 可掩盖残差,支持 C0/H2** 235B FP8 的 prefill-only 与 fixed-shape mixed 都选对 top set但 simulator 漏掉并发上限max-num-seqs×批 token 上限max-num-batched-tokens的交互棋盘格并把 10/34 个真机 anchor 误判为不可行;真机头部 margin 有 2×残差被容忍。产物`../runs/frontier-multicase-sufficiency-v0/best_effort/fixed_cohort_evidence/``../runs/frontier-multicase-sufficiency-v1/results/t0-final/`
- **E3selection 与 calibration 分开):** 用完整 block projection、`piecewise` 和 graph-compatible KERNEL_ONLY profile 后Qwen30 Trace-PD 的 12/12 sim cells 完成6 个 mean/p90 latency objective 的 argmin 都与真机一致;但 sim/real latency ratio 仍为 4--511×。产物[`../runs/frontier-fidelity-envelope-v1/graph-piecewise-experiment-card.md`](../runs/frontier-fidelity-envelope-v1/graph-piecewise-experiment-card.md)。
## 下一步(最多 3 项)
- [ ] **完成 Qwen30 remaining matrixdirect progress** Fixed-PD、Trace-P、Fixed-P 分别冻结 Frontier/真机 12-cell surfaceP-only 的 TPOT 一律为 N/A。
- [ ] **Q235 portability gate** 先验证 vLLM0.20 TP4/TP8 FP8 runtime 和 deadc4a profile provenance再决定是否允许其 Fixed-P sweep。
- [ ] **建 cost ledger** parent H3完成标准 = 每 case 一行profiling GPU-h、补丁工时、校准探测、sim CPU-h与已实测的真机调优成本同表随每个 case 更新。
## Blocker 或 anomaly
- **下一启动已准备:** dash0 8×H20 当前空闲graph-compatible attention/linear/MoE/router kernel-only profile 会先在一 GPU smoke成功后以 3 张 GPU 并行完成 attention shards。完整 replay 仍为 CPU-only。
- **Anomaly保留** 235B pilot 中 simulator 把 10/34 个 anchor 误判为不可行——false-infeasible 是 H1 的主要威胁模式T1 分析时须单独报告。
- **勘误(已固定):** 统一平台为 dash0-only早期 dash1 出处是文档错误fixed-shape pilot 的主 SLOTPOT 40ms无判别力150ms 是事后明示的敏感性分析,不得写成盲选的 primary。
## Related work
- Claim map[`../docs/simulator-claim-map-20260716.md`](../docs/simulator-claim-map-20260716.md)。核心缺口capacity-point + SLO-gated selection 的 regret 无人用真机 ground-truth 面验证过alignment 成本无人与真机调优成本放进同一张表比较。