feat+eval: M1 工程制度迁移 + round-8 缺口全闭合(P0 全绿收口 / P1-1 诚实负结果) - #1
Open
AricRedemption wants to merge 9 commits into
Open
AricRedemption wants to merge 9 commits into
AricRedemption wants to merge 9 commits into
Conversation
- observability.py (ported from M1 mt_lnn/observability.py): JsonlMetricWriter, run_metadata() provenance block, rollout_mse_stderr() per-trajectory SE - all 10 benchmarks: results JSON now carries meta (git_sha/device/ts/torch/ benchmark) and rollout_mse_stderr next to every trajectory-aggregated mean - audit_results.py: schema auditor, --check exits 1 on missing meta block - tests/test_observability.py: 10 tests (caught a real _json_default bug)
…rnance ported from M1) - PRINCIPLES.md: 7 principles (P1..P7) with status + evidence chain, ranked experiment queue E1-E5, 6 institution rules — extracted from PRD rounds 1-7 and the architecture ADR table; includes the round-9 "plateau overturned by semigroup training" case as the ledger's living example - DELIVERABLE_TYPES.md: pre-commit checklist (feature/perf/eval/infra/docs), eval type requires meta provenance block + stderr + audit --check - README: Engineering conventions section
- meta.device 现在记录 benchmark 实际运行的设备(args.device 覆盖检测值), 而非宿主机检测到的加速器——集成测试抓出的语义问题,P5 审计规则依赖此字段 - tests/test_audit_results.py: 审计器 9 个单测(numeric_leaves/audit_one/collect_files) - tests/test_benchmark_integration.py: time_eval 缩参端到端 + 产物过审计(integration 标记) - pyproject: pytest markers(slow/integration)+ --strict-markers(借鉴 M1 pytest.ini) - .github/PULL_REQUEST_TEMPLATE.md: 按类型自检清单 + 诚实边界栏(改写自 M1 五类模板) - PRINCIPLES.md: 修正 N-body 证据的两波数字归属(14.62/14.87 第一波,15.41±1.08 第三波) - 测试 63/63 通过(43 基线 + 10 observability + 9 audit + 1 integration)
逐目标判定:P0-1 超额(61-81% vs ≥30%)、P0-4 超额(63 测试全绿 vs ≥33)、 P0-2 部分(2D 已落地,可变节点数未确认)、P0-3 证据缺口(漂移对比产物 未见,P0 全绿唯一挡路项)、P1-1 接近(样本效率验收口径未闭合)、 P1-2/P1-3 未开始。Round-8 建议四条。ref: LEDGER H1
LTC AAAI 2021 / CfC NMI 2022 / FNO ICLR 2021 / Poseidon NeurIPS 2024 / Aurora Nature 2025 / GenCast Nature 逐条验证 venue 与内容要点。 建议:FNO 引用补 arXiv:2010.08895,其余补全卷期链接。 ref: LEDGER H5
round-8 gap AwareLiquid#1 闭合:m1_semigroup 配方(61-90% 优势)此前从未测过漂移。 新增 benchmarks/energy_drift_eval.py:3 模型 × {orbit, spring} × 3 seeds, 与 v0.1 同口径真能量诊断(复用 physics_rollout_eval/m1_semigroup_eval 的 生成器与训练循环,非重实现),逐步漂移曲线落 JSONL。 - orbit(PRD §6 gate):liquid 1.75±0.51 ≤ 6.2 记录基线,≤ 3.33 同环境 重测锚点,rollout MSE 3.7× 优 → P0 四目标全绿 - 基线复现核查:physics_rollout_orbit.json 重跑 HNN 5.55 / MLP 63.5, 与记录 6.2/37.8 同量级 - spring(不 gate,诚实记录):liquid final 漂移 0.205 > static 0.081, 为真-ω 诊断把 ω 辨识误差计入漂移的有界振荡(drift_max 0.245 反优); P1 台账收作边界注记 - 两次独立全量运行逐 seed 完全一致(CPU 确定性);audit 12/12 通过; 测试 64/64(新增 energy_drift_eval 集成 smoke) - P1 证据链更新(状态维持 SUPPORTED,证据加强)
- HamiltonianHead / FiLMHamiltonianHead / NBodyHamiltonianHead 的 energy() 在 (k+1,B,...) rollout 张量 + (B,d) context 下形状报错——train.py 的 drift-penalty 路径(默认关)正是这种调用,P0-2 验收测试首次触达即暴露。 统一按 OperatorHamiltonianHead 既有契约修复:展平 lead 维、context 按 lead-major 平铺(repeat)对齐 - tests/test_p02_acceptance.py:trained@N → 零样本@m 显式钉死可变节点数 (1D 16→32/13、2D 8x8→12x16 非方形、N-body 4→6 体;判定 = 训练后严格 优于未训练 + 自身 H 漂移有界)+ dim=1/2 与 v0.1 兼容性(精确时间可逆、 随机头有界漂移、v0.1 rollout 约定)——round-8 缺口 #3 关闭 - docs/test-traceability.md:v0.1 @a838d6c 的 13 个测试逐一映射,全部同名 存活且通过(逐名点跑 13/13)+ 三个测试文件头注释——round-8 缺口 #4 关闭 - 测试 68/68 通过
round-8 缺口 #2 闭合:新增 benchmarks/sample_efficiency_eval.py——同一模型、
同一优化预算,唯一变量是训练循环(prefix 固定窗口 vs semigroup all2all),
n_train ∈ {32,64,128,256,512} 嵌套 × 3 seeds × 128 条固定 eval 集。
- 同等预算 @512:all2all 1.04 vs prefix 2.77(深 2.7x);seed 0 @512
1.418 vs 2.857 与第五波记录逐位一致(可复现性)
- prefix 在 n≈128 饱和(~2.5);all2all@128 即 1.78 优于其全阶梯最佳
- P1-1「≤1/5」按字面不予认证:plateau 简并(可达水平上两循环都需 128)
+ 深水平 prefix 不可达(下界 4x,上界无界);verdict 输出多层诚实分析
- P2 台账:证据加强 + 样本效率形式边界注记(状态维持 SUPPORTED)
- 两次独立全量运行曲线逐值一致;audit 13/13;测试 69/69
- 集成 smoke 测试覆盖新 benchmark 的 schema + verdict 字段
代码验收发现的 3 个 P2/P3 问题 + 2 个 nit:
- sample_efficiency_eval: all2all 从未触线时 pinned_line_raw_ratio 序列化为
Infinity(非严格 JSON)→ 改为 null;顺带修正该分支误导性的 "1.0x" 下界
打印(n/a 措辞);修复过程中曾把 else 分支的 p11_pass=False 误改为
pinned_certifiable=False 导致 UnboundLocalError,已恢复并实测
{degenerate, NOT CERTIFIABLE} 两条路径 + 严格 JSON 三项全过
- 两个新 benchmark 的 --device 从宣告 "cpu | cuda" 收窄为 choices=["cpu"]
(cuda 管线从未接通:anchor 训练吃 CPU 张量;与本 PR "本地 CPU benchmark"
定位一致,P5 同 device 协议)
- energy_drift_eval: 删除死变量 mlp
- 集成测试更新:pinned_line_raw_ratio 允许 null;PRD §18 舍入 0.3→0.35 对齐
产物 std
- 全部改动不触及已提交产物的任何数值(全量路径 verdict 输出逐字不变);
测试 69/69、audit 13/13 复验通过
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
M1 工程制度迁移 + round-8 缺口全闭合
类型(必选其一,自检清单见
docs/DELIVERABLE_TYPES.md): eval + feature + fix + docs(按 commit 分类型)原则状态:P1 维持 SUPPORTED(证据加强:第八波 P0-3 收口);P2 维持 SUPPORTED(证据加强 + 边界注记:第九波样本效率口径细化)。
变更摘要
本 PR 在原「工程制度迁移」(observability 溯源 schema、PRINCIPLES 原则台账、DELIVERABLE_TYPES 自检清单、audit 单测、benchmark 集成测试、PR 模板)基础上,完成 round-8 gap review 全部缺口的闭合:
benchmarks/energy_drift_eval.py——新 context(半群配方)100 步能量漂移 vs v0.1 基线 6.2 的直接对比。orbit 1.75 ± 0.51 ≤ 记录基线(3.5× 余量),≤ 同环境重测锚点 3.33,rollout MSE 同步优 3.7×;v0.1 锚点复现核查 5.55 / 63.5 vs 记录 6.2 / 37.8。P0 四目标全绿。两次独立全量运行逐 seed 一致(CPU 确定性)。tests/test_p02_acceptance.py——trained@N → 零样本@m:1D 场 16→32/13、2D 场 8×8→12×16(非方形,钉死 H/W 独立)、N-body 4→6 体 + dim=1/2 与 v0.1 兼容(精确时间可逆、随机头有界漂移)。测试触达并修复一个真 bug:HamiltonianHead/FiLMHamiltonianHead/NBodyHamiltonianHead的energy()在 lead 维 + context 下形状不广播(train.py的 drift-penalty 默认路径从未暴露过它)。docs/test-traceability.md——v0.1 @a838d6c 的 13 个测试逐一映射,全部同名存活且通过(逐名点跑 13/13)+ 三个测试文件头注释。benchmarks/sample_efficiency_eval.py——同一模型同一预算,唯一变量是训练循环(prefix vs all2all),5 档样本 × 3 seeds。prefix 在 n≈128 饱和(~2.5);all2all@128 即 1.78 优于其全阶梯最佳,@512 达 1.04(同等预算深 2.7×,seed 0 与第五波记录逐位一致)。「≤1/5」字面口径不予认证(plateau 简并 + 深水平 prefix 不可达),verdict 输出多层诚实分析。docs/literature-verification.md,夜间批次)。自检清单
pytest tests/ -q全绿(69/69:4 个 P0-2 验收测试 + 3 个 benchmark 集成 smoke + 既有 62)meta溯源块,python benchmarks/audit_results.py --check退出码 0(13/13)docs/PRD.md(§17 第八波、§18 第九波)/docs/PRINCIPLES.md(P1、P2)已更新;原则状态变化写入 commit message诚实边界(eval / feature 必填)
benchmarks/*out*/)按仓库约定 gitignore;PRD 表为对外记录,本地 JSON 由脚本一键复现(确定性已三次验证)