Fix B7 rank and B6 HKS gates behind existing B1 recovery
This commit is contained in:
1 parent
bccf1fee9f
commit
086c56dc36
27 files changed
+61726
-46
No files matched your search
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"status": "PASS",
|
||||
"guard": {
|
||||
"status": "PASS",
|
||||
"returncode": 0,
|
||||
"stop_reason": null,
|
||||
"cpu_seconds": 0.399899,
|
||||
"wall_seconds": 0.6044012299971655,
|
||||
"peak_tree_rss_bytes": 82452480,
|
||||
"peak_process_count": 1,
|
||||
"monitor_errors": [],
|
||||
"max_poll_gap_seconds": 0.2008529320009984,
|
||||
"reaped_orphan_cpu_seconds": 0.0,
|
||||
"limits": {
|
||||
"cpu_seconds": 40,
|
||||
"wall_seconds": 60,
|
||||
"rss_bytes": 1073741824,
|
||||
"disk_bytes": 104857600
|
||||
},
|
||||
"retry": false,
|
||||
"gpu_visible": false
|
||||
},
|
||||
"all_inclusive_cpu_seconds": 0.404149073,
|
||||
"prior_unguarded_acceptance_included_in_setup_reserve": 60,
|
||||
"code_sha256": {
|
||||
"tools/phase2_b6_gate.py": "218d99b609bc71430f75ee322c4588ccf93b572bda9979f86098d11e785708e5",
|
||||
"tools/phase2_fixed_io.py": "ea17fdfc7508f3f980e3cdf69534b1eb8ceb8a8e469c32451b2d5e16d0ada575",
|
||||
"tools/test_phase2_b6.py": "b13830665fbdc355bbc4a7e607e35a41222e1697b3bfa3845eea49a68289bb9c",
|
||||
"tools/phase2_b6_math.py": "dfaa5fb93c1bb940411571d05641fa2360d595c3bc13e5e22038a7faac635ad3"
|
||||
},
|
||||
"real_dataset_access": false,
|
||||
"new_models_on_real_data": 0
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"pid": 17,
|
||||
"unix": 1794895091.3199267,
|
||||
"guard_pid": 2
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
.......
|
||||
----------------------------------------------------------------------
|
||||
Ran 7 tests in 0.112s
|
||||
|
||||
OK
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"status": "PASS",
|
||||
"returncode": 0,
|
||||
"stop_reason": null,
|
||||
"cpu_seconds": 0.399899,
|
||||
"wall_seconds": 0.6044012299971655,
|
||||
"peak_tree_rss_bytes": 82452480,
|
||||
"peak_process_count": 1,
|
||||
"monitor_errors": [],
|
||||
"max_poll_gap_seconds": 0.2008529320009984,
|
||||
"reaped_orphan_cpu_seconds": 0.0,
|
||||
"limits": {
|
||||
"cpu_seconds": 40,
|
||||
"wall_seconds": 60,
|
||||
"rss_bytes": 1073741824,
|
||||
"disk_bytes": 104857600
|
||||
},
|
||||
"retry": false,
|
||||
"gpu_visible": false
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"command": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/test_phase2_b6.py"
|
||||
],
|
||||
"limits": {
|
||||
"cpu_seconds": 40,
|
||||
"wall_seconds": 60,
|
||||
"rss_bytes": 1073741824,
|
||||
"disk_bytes": 104857600
|
||||
},
|
||||
"unix": 1794895091.3185778
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"status": "PASS",
|
||||
"guard": {
|
||||
"status": "PASS",
|
||||
"returncode": 0,
|
||||
"stop_reason": null,
|
||||
"cpu_seconds": 1.0893709999999999,
|
||||
"wall_seconds": 1.2079462530091405,
|
||||
"peak_tree_rss_bytes": 131436544,
|
||||
"peak_process_count": 1,
|
||||
"monitor_errors": [],
|
||||
"max_poll_gap_seconds": 0.2014876230387017,
|
||||
"reaped_orphan_cpu_seconds": 0.0,
|
||||
"limits": {
|
||||
"cpu_seconds": 40,
|
||||
"wall_seconds": 60,
|
||||
"rss_bytes": 1073741824,
|
||||
"disk_bytes": 104857600
|
||||
},
|
||||
"retry": false,
|
||||
"gpu_visible": false
|
||||
},
|
||||
"all_inclusive_cpu_seconds": 1.0968732740000002,
|
||||
"prior_unguarded_acceptance_included_in_setup_reserve": 60,
|
||||
"code_sha256": {
|
||||
"tools/phase2_b7_gate.py": "3d7c7a8b94b10aefd063e5a41154041ad8abb6d5a4a9b993653e169e6a8d1eb3",
|
||||
"tools/phase2_fixed_io.py": "ea17fdfc7508f3f980e3cdf69534b1eb8ceb8a8e469c32451b2d5e16d0ada575",
|
||||
"tools/test_phase2_b7.py": "6d3af649cfa0b68240788886b56d0e273a1fa13773f0bc92d65909c80457af54"
|
||||
},
|
||||
"real_dataset_access": false,
|
||||
"new_models_on_real_data": 0
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"pid": 4,
|
||||
"unix": 1794895090.1099212,
|
||||
"guard_pid": 2
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
...
|
||||
----------------------------------------------------------------------
|
||||
Ran 3 tests in 0.103s
|
||||
|
||||
OK
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"status": "PASS",
|
||||
"returncode": 0,
|
||||
"stop_reason": null,
|
||||
"cpu_seconds": 1.0893709999999999,
|
||||
"wall_seconds": 1.2079462530091405,
|
||||
"peak_tree_rss_bytes": 131436544,
|
||||
"peak_process_count": 1,
|
||||
"monitor_errors": [],
|
||||
"max_poll_gap_seconds": 0.2014876230387017,
|
||||
"reaped_orphan_cpu_seconds": 0.0,
|
||||
"limits": {
|
||||
"cpu_seconds": 40,
|
||||
"wall_seconds": 60,
|
||||
"rss_bytes": 1073741824,
|
||||
"disk_bytes": 104857600
|
||||
},
|
||||
"retry": false,
|
||||
"gpu_visible": false
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"command": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/test_phase2_b7.py"
|
||||
],
|
||||
"limits": {
|
||||
"cpu_seconds": 40,
|
||||
"wall_seconds": 60,
|
||||
"rss_bytes": 1073741824,
|
||||
"disk_bytes": 104857600
|
||||
},
|
||||
"unix": 1794895090.108627
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"approval": "1794893702.921009",
|
||||
"source_sha256": {
|
||||
"artifacts/phase2-b6-gate-2026-11-17/contract.json": "cb77a580dcf1cbc3dae12de947413e91879fa426935f8df45fee392a8876afe4",
|
||||
"artifacts/phase2-b7-gate-2026-11-17/contract.json": "322f85dcf8ec77c23109dbcab61082060e394c0f60953c8f75965b52505341a2",
|
||||
"tools/phase2_b6_gate.py": "218d99b609bc71430f75ee322c4588ccf93b572bda9979f86098d11e785708e5",
|
||||
"tools/phase2_b6_math.py": "dfaa5fb93c1bb940411571d05641fa2360d595c3bc13e5e22038a7faac635ad3",
|
||||
"tools/phase2_b76_serial.py": "72c826d3ed5eb3ba4fac85b18f05679a17c6f27e3d459391e42725523e3e7af7",
|
||||
"tools/phase2_b7_gate.py": "3d7c7a8b94b10aefd063e5a41154041ad8abb6d5a4a9b993653e169e6a8d1eb3",
|
||||
"tools/phase2_fixed_io.py": "ea17fdfc7508f3f980e3cdf69534b1eb8ceb8a8e469c32451b2d5e16d0ada575",
|
||||
"tools/phase2_h1_worker_v2.py": "1543df85b615bb69b79bacd572074a7c77ae19dab110197601573a7e5805ed20",
|
||||
"tools/phase2_residual_math.py": "ffbd9624dec79bdaabf95244fe87209055908f31a977e73ea4377045d6f8fe62",
|
||||
"tools/r4bc_common.py": "27543fff987975ece767167f9771e6621c825035a053805604e4a696794dfcbd",
|
||||
"tools/r4bc_guard.py": "437a756ddf10b125dce450f463e76e28df52724f8c5766e0a989dfa536805628",
|
||||
"tools/s2_custody_common.py": "588c646101be0d50f505f9a12a1c98361aa3437c8c594eecb7321831f717a741",
|
||||
"tools/s2_custody_statistics.py": "188565801f6901d0192f79aec0889e632501e672a4149d76d1835efbb9b45447",
|
||||
"tools/s2_recovery_monitoring.py": "442c2a9c75e8c00b30a8f2e91cb52d87c466b19a80aea9128b10c021e61b922e",
|
||||
"tools/s2_recovery_supervisor.py": "f563ca3c2665f5baf0c04f296616e4640423a59b815fbb00479af0f29e57a919"
|
||||
},
|
||||
"dependency": "existing B1-v2 COMPLETE and all processes exited",
|
||||
"order": [
|
||||
"B7",
|
||||
"B6"
|
||||
],
|
||||
"unique_waiter": true,
|
||||
"retry": false,
|
||||
"waiter_cpu_seconds_cap": 30,
|
||||
"waiter_wall_seconds_cap": 43200,
|
||||
"waiter_cost_covered_by_B7_setup_reserve_seconds": 60,
|
||||
"new_budget": false
|
||||
}
|
||||
@@ -1,60 +1,175 @@
|
||||
{
|
||||
"unix": 1794891825.520687,
|
||||
"active_h1": {
|
||||
"root": "/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17",
|
||||
"coordinator": 559442,
|
||||
"live_progress": {
|
||||
"unix": 1794891825.4692643,
|
||||
"stage": "fit",
|
||||
"charges": {
|
||||
"geometry": 1755.625577025,
|
||||
"fit": 633.3104629540001,
|
||||
"postfit": 0.0
|
||||
"unix": 1794895197.5829613,
|
||||
"chains": {
|
||||
"phase2-h1-execution": {
|
||||
"started.json": {
|
||||
"pid": 559442,
|
||||
"unix": 1794889650.927194,
|
||||
"contract_sha256": "416183a09272714a179af790e5b7be85e5a92f1395afa6a5b9fe123a184b44b2",
|
||||
"implementation_commit": "ef7fe68833ae22d682b30ad9b902d063fb28d621"
|
||||
},
|
||||
"total_cpu_charge": 2585.7334060330004,
|
||||
"active": [
|
||||
"live-progress.json": {
|
||||
"unix": 1794895196.647243,
|
||||
"stage": "postfit",
|
||||
"charges": {
|
||||
"geometry": 1755.625577025,
|
||||
"fit": 3087.063371555,
|
||||
"postfit": 7435.197533051994
|
||||
},
|
||||
"total_cpu_charge": 13617.338723331994,
|
||||
"active": [
|
||||
{
|
||||
"name": "score-1014",
|
||||
"guard_pid": 571049
|
||||
},
|
||||
{
|
||||
"name": "score-1017",
|
||||
"guard_pid": 571080
|
||||
},
|
||||
{
|
||||
"name": "score-1018",
|
||||
"guard_pid": 571089
|
||||
},
|
||||
{
|
||||
"name": "score-1019",
|
||||
"guard_pid": 571091
|
||||
}
|
||||
],
|
||||
"terminal": 1057,
|
||||
"stop": null
|
||||
},
|
||||
"processes": [
|
||||
{
|
||||
"name": "fit-01",
|
||||
"guard_pid": 562166
|
||||
"pid": 559442,
|
||||
"cmdline": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/phase2_h1_execution.py",
|
||||
"run",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17"
|
||||
],
|
||||
"status": "sleeping"
|
||||
},
|
||||
{
|
||||
"name": "fit-02",
|
||||
"guard_pid": 562167
|
||||
"pid": 571049,
|
||||
"cmdline": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/phase2_h1_execution.py",
|
||||
"guard",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17/tasks/score-1014.json"
|
||||
],
|
||||
"status": "sleeping"
|
||||
},
|
||||
{
|
||||
"name": "fit-04",
|
||||
"guard_pid": 562169
|
||||
"pid": 571051,
|
||||
"cmdline": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/phase2_h1_postfit.py",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17",
|
||||
"part",
|
||||
"v4_random",
|
||||
"00001301_a54ee779467b42ea8709e1ca_step_000"
|
||||
],
|
||||
"status": "running"
|
||||
},
|
||||
{
|
||||
"name": "fit-05",
|
||||
"guard_pid": 562247
|
||||
"pid": 571080,
|
||||
"cmdline": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/phase2_h1_execution.py",
|
||||
"guard",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17/tasks/score-1017.json"
|
||||
],
|
||||
"status": "sleeping"
|
||||
},
|
||||
{
|
||||
"pid": 571084,
|
||||
"cmdline": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/phase2_h1_postfit.py",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17",
|
||||
"part",
|
||||
"v4_random",
|
||||
"00001311_e95b8713cc0b4436909c78e9_step_000"
|
||||
],
|
||||
"status": "running"
|
||||
},
|
||||
{
|
||||
"pid": 571089,
|
||||
"cmdline": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/phase2_h1_execution.py",
|
||||
"guard",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17/tasks/score-1018.json"
|
||||
],
|
||||
"status": "sleeping"
|
||||
},
|
||||
{
|
||||
"pid": 571090,
|
||||
"cmdline": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/phase2_h1_postfit.py",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-execution-2026-11-17",
|
||||
"part",
|
||||
"v4_random",
|
||||
"00001314_a9ed5e56a6a8414f91b39bdb_step_000"
|
||||
],
|
||||
"status": "running"
|
||||
}
|
||||
],
|
||||
"terminal": 4,
|
||||
"stop": null
|
||||
"source_pins_pass": true
|
||||
},
|
||||
"cost": {
|
||||
"pass_gate": true,
|
||||
"spent": 496.365730461,
|
||||
"remaining_projection": 3113.754100448713,
|
||||
"full_fit_projection": 3610.119830909713,
|
||||
"postfit_reserved": 25200.0,
|
||||
"factor": 1.25
|
||||
"phase2-h1-labelled-recovery": {
|
||||
"started.json": {
|
||||
"pid": 567454,
|
||||
"unix": 1794893544.0389862,
|
||||
"engineering_sha256": "f8341cc787e49971efd4bdece46ab4d9964bec790b0f6cf9c5a16a02a4583711"
|
||||
},
|
||||
"live-progress.json": {
|
||||
"stage": "WAIT_ORIGINAL_B1_TERMINAL",
|
||||
"unix": 1794895197.0315216,
|
||||
"waiting_cpu_seconds": 0.125007983
|
||||
},
|
||||
"processes": [
|
||||
{
|
||||
"pid": 567454,
|
||||
"cmdline": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/phase2_h1_recovery.py",
|
||||
"run",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-h1-labelled-recovery-2026-11-17"
|
||||
],
|
||||
"status": "sleeping"
|
||||
}
|
||||
],
|
||||
"source_pins_pass": true
|
||||
},
|
||||
"implementation": "ef7fe68833ae22d682b30ad9b902d063fb28d621",
|
||||
"no_restart": true
|
||||
},
|
||||
"B3_B4": {
|
||||
"status": "DELIVERED",
|
||||
"commit": "a6998f72a92f1044e3b03ea183b3a2df34d18fd2",
|
||||
"slack": "1794891569.348739"
|
||||
},
|
||||
"B5": {
|
||||
"status": "TERMINAL_PARK_COVERAGE_UNKNOWN_DELIVERED",
|
||||
"commit": "6aa7baf6c3ea2835f4853796ff1017772b4aa38d",
|
||||
"slack": "1794891743.824769",
|
||||
"no_restart": true
|
||||
},
|
||||
"H2": "NOT_STARTED",
|
||||
"B11": "PAPER_SPEC_REQUESTED_NOT_RECEIVED_NOT_STARTED"
|
||||
"phase2-b11-labelled-continuation": {
|
||||
"started.json": {
|
||||
"pid": 567472,
|
||||
"unix": 1794893546.9194608,
|
||||
"engineering_sha256": "f29565f9058c04611f4a1059fc16f0375bedfeccdbd267fdced5d04ed0a695ba"
|
||||
},
|
||||
"live-progress.json": {
|
||||
"stage": "WAIT_B1_V2_FROZEN_PREDICTIONS",
|
||||
"unix": 1794895186.2196188,
|
||||
"cumulative_cpu_seconds": 259.934837683
|
||||
},
|
||||
"processes": [
|
||||
{
|
||||
"pid": 567472,
|
||||
"cmdline": [
|
||||
"/home/frank14f/optane/MeltMind/artifacts/gre24-reproduction-2026-11-15/environment/venv/bin/python",
|
||||
"tools/phase2_b11_continuation.py",
|
||||
"run",
|
||||
"/home/frank14f/optane/MeltMind/artifacts/phase2-b11-labelled-continuation-2026-11-17"
|
||||
],
|
||||
"status": "sleeping"
|
||||
}
|
||||
],
|
||||
"source_pins_pass": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,3 +216,8 @@ R4bc真实全拟合终态接续(2026-11-17):1005全部终态,1004PASS+
|
||||
R4bc最终全池完成(2026-11-17):105final全PASS,原job90 HPO失败保留。依Claude1794874951最终顺序,原70新预测加复用100%→Git冻结248542d→原全池score→INTERIM_100 EXACT_MATCH;随后独立35新预测3864数组BITWISE_MATCH。未重评分或改源码。三池五折齐全,所有主/链/相邻域552件204组件,未定义指标/bootstraps0。post1149.437161、总worker98516.406276CPU秒;全部进程终态。完整结果/原始预测与费用交Claude统一阶段收束,O1停止边界独立保留,不新增工艺/拓扑计算或用测试结果换模型。见docs/r4bc-final-results-2026-11-17.md。
|
||||
|
||||
Phase2已批接续实况(2026-11-17):Claude1794887072/1794888554批准B1及B3/B4/B5。B3/B4原终态完整a6998f72已发布/HTTP核对并真@Claude1794891569;B3仅本学习面板精度扰动稳定,B4仅剪固定势单调时钟超A,不构成全部排序/几何路线因果否决。B5原10件终态6aa7baf6:5无候选+5谓词复杂度UNKNOWN,0实件认证,PARK_COVERAGE_UNKNOWN,原133.739423CPU秒/7200;全证据已交Claude1794891743,禁止擅自重试/扩帽。原B1协调559442保持活跃,1167几何PASS、首两fit PASS、成本门PASS后自动四路继续;原20h总帽/源码/冻结屏障不变。见docs/phase2-live-handoff-2026-11-17.md及真实回执。H2未启动;B11只有Claude请求Mold规格,未实现/运行。研究树由Claude统筹,Melt对其B4唯一因果归因提出范围更正,等待回应;没有重复用户go/分享审批或新增自动任务。
|
||||
|
||||
|
||||
## Phase2 B1工程恢复与B7/B6既定门(2026-11-17)
|
||||
|
||||
Claude1794892722已批准B1五个预测的一次标记恢复,0refit;旧20fit/五失败/原评分固定保留,v1主池缺4折不作树门。已有唯一恢复567454与B11接续567472等待真实依赖,不能再次启动。预算仍总72000/postfit25200,B11累计7200。B7/B6按1794892472和1794893702裁量接在B1恢复后串行,每门7200CPU-s;Mold1794893856全文8f94be12完整纳入数学定义与验收。实施合同见docs/phase2-b76-fixed-contracts-2026-11-17.md,10合成实际guard PASS。模型/几何签名先固定再读限定角色标签,不扩成H2或额外模型。当前无科学新门结果,需结果实到后再由Claude整合树与既有目标复核;不另造审批门。
|
||||
@@ -0,0 +1,27 @@
|
||||
# B7/B6 固定实施与串行依赖
|
||||
|
||||
Claude1794892472及1794893702已批准原门;Mold1794893856全文已实际读取,4221字节SHA256 `8f94be1294b9b8a020aabaf2f434658b593a3fc78504815c38751e546015ae16`,保存于references/2026-11-17/phase2-design/mold-b6-spec-8f94be12.md。不重复主审或用户go。本页是实现与执行边界,尚不是科学结果。
|
||||
|
||||
唯一新增串行等待链为`phase2_b76_serial.py`:等既有B1-v2恢复真实COMPLETE且进程退出,B7先执行、全终态退出后B6执行。原B1和B11等待器不变。B1恢复失败则本链停;B7自身资源/科学失败仍保留原终态,B6作为独立门可顺序执行,没有重试。每门各7200 CPU秒、60秒设置预留、单线程CPU24、8GiB RSS、累计5GiB输出、0 GPU、0新解码、0重试。等待器最多12小时/30CPU秒,计入B7设置预留,不增加预算;旧链不重算。实际started/service/audit才证明启动,本文不能代替回执。
|
||||
|
||||
## B7
|
||||
|
||||
根`artifacts/phase2-b7-gate-2026-11-17`。固定grouped fold0,learning100=320件/132组件,validation=111件/35组件;只用原19列,每件按升序raw ID确定性等间隔最多2048点,不用标签选点。目标为件内稠密秩、真并列同秩;一件一个qid。XGBoost2.1.4、rank:pairwise、mean每样本1对、100树、depth8、eta.1、seed0、CPU hist。实际booster配置验收通过,不静默忽略参数。只拟合一个ranker,无额外平方损失控制或时钟校准。
|
||||
|
||||
与原冻结fold0/pool100 A(model SHA5f8914da)在同一validation查询比较。模型先Git冻结,标签无关预测全部生成并冻结清单后才读validation目标;test不读。保留旧查询multiplicity、末点真并列规则和固定5000随机pair tau-b。组件内件均值,再组件等权;2000次组件配对percentile95、seed2026111408。Claude最终OR门:rank−A的tau增益区间下界>0,或A−rank末填距离均值>=.010Rg,即保留单折可行性;否则剪该配方。缺失/未定义门指标PARK。原任意rank数值相对T/t_set的L2仅为未校准描述,不参与门。A全tet与ranker抽样训练支持不同,不能归因成单独loss效应。
|
||||
|
||||
训练/预测/评分CPU上限分别3600/900/900秒,原总7200帽优先。三项合成检查通过:确定性抽点/并列秩,实际pairwise参数与100树,最终OR门及未定义处理。实际守卫worker CPU1.089371秒、峰值进程1、无监控错误。先前短测试和准备开销一起计入60秒设置预留。
|
||||
|
||||
## B6
|
||||
|
||||
根`artifacts/phase2-b6-gate-2026-11-17`。严格沿用B3原50件/50亲缘组件、fold0 learning100面板,不能改成ID重新抽样。体tet P1刚度、集总质量、全边界自然齐次Neumann,FP64与原冻结Rg;保留物理连通分量全部精确零模,与学习划分的亲缘组件分开。
|
||||
|
||||
各物理分量<=256节点用完整eigh;更大分量在精确质量零模正交补上固定shift-invert eigsh求16个正模候选,tol1e-10、maxiter2000、ncv48、seed2026111706,移位为白化刚度对角中位数×1e-6。还原质量正交基,Rayleigh-Ritz计算原算子根;不按绝对阈值删除细颈正根,不切换求解器。取全件首8正根,按相邻相对差<=1e-6补齐边界簇;必须看到下一分簇间隙或完整谱穷尽,否则缺失。少于8的完整谱保留真实维数,不补列。
|
||||
|
||||
全部零模加保留正模,三时刻{.1,1,10}/lambda1逐特征对加权HKS。正模相对残差<=1e-5、质量正交误差<=1e-7、零模误差<=1e-10;正质量、非退化tet、有效Rg均显式检查。近根不平均成同一根;基Q旋转验收同步B→QᵀBQ,精确重根平方和。几何签名不是物理热场。每件110 CPU秒/180墙钟秒,失败保留且不重试;所有50件终态/特征清单Git冻结后才进入学习残差部分。覆盖不足40/50则PARK,不读标签给相关数。
|
||||
|
||||
既有冻结A对同一原19列预测,y=t_star−A;节点权1/(G·P_g·n_p),组件/件等权。通过分块加权TSQR与SVD,双方共同投影掉19列+截距;保存三个有符号Pearson r、秩、奇异值、有效件数和未定义项。残差范数<=1e-10×max(原范数,1)记未定义。覆盖合格时任一|r|>=.10只保留学习侧描述门;全未定义PARK,否则剪此固定签名。没有样本外收益或新模型授权。评分CPU900秒,所有费用服从7200总帽。
|
||||
|
||||
七项合成检查通过:解析单tet刚度/质量及断开全零空间,原节点重排,跨第8根簇/未知边界拒绝,符号/精确重根/近根同步换基,343节点稀疏投影求解,退化/非正质量拒绝,以及加权TSQR部分相关与直接加权最小二乘一致。实际守卫worker CPU.399899秒、峰值进程1、无监控错误。原始日志/回执在各`phase2-b*-acceptance-2026-11-17`目录。
|
||||
|
||||
Git核验全部在协调器进行,单进程科学worker只核原地文件hash;不会把Git子进程放入process_count<=1的守卫。固定后的代码不再改动,失败与预算终态保留。
|
||||
@@ -1,3 +1,17 @@
|
||||
# 最新:B1标记恢复等待链与B7/B6固定实现(2026-11-17 14:00)
|
||||
|
||||
本节覆盖下方历史“B11尚未实施/仅B1活跃”的快照。实际进程审计见artifacts/phase2-current-handoff-2026-11-17.json。
|
||||
|
||||
- 原B1/H1仍为559442/原根/原pins,20fit PASS,但预测00/01/03/04/10受process_count_limit失败。原scoring29137ce1、manifest22fbb43a与所有旧评分保留,标B1-v1不完整(grouped100缺4/5折),不得从fold2作主门。最近1057任务终态、评分仍活动,原总CPU13617.338723/postfit7435.197533;不是全终态。
|
||||
- Claude1794892722批准的一次恢复已发布bccf1fee并于13:32实际启动唯一等待器567454,根artifacts/phase2-h1-labelled-recovery-2026-11-17。WAIT_ORIGINAL_B1_TERMINAL,仅等原完整终态/费用/退出;随后只恢复五预测、0 refit、canonical20新冻结、原公式v2评分。Git移至协调器,原worker主体/评分公式逐字保留。原总72000/postfit25200扣旧账,未新增20h。
|
||||
- 唯一B11接续567472同批实际启动,根artifacts/phase2-b11-labelled-continuation-2026-11-17,WAIT_B1_V2_FROZEN_PREDICTIONS。只A/H1完整50重建/评分、原EIK不动;累计原199.855391+新共享7200。
|
||||
- 原B11已完整交付d1cfbc89:EIK50门PRUNE;A/H1仅10/50门PARK覆盖,原70场/40缺失不改。B3/B4完整交付a6998f72;B5完整6aa7baf6、PARK_COVERAGE_UNKNOWN。不要重跑任何终态。
|
||||
- B7/B6获Claude1794892472/1794893702批准;Mold全文8f94be12已核读纳入。两门独立实现/10合成实际单进程guard PASS;合同B7=322f85dc、B6=cb77a580。详见docs/phase2-b76-fixed-contracts-2026-11-17.md。等待链源码phase2_b76_serial已准备,发布/实际启动回执尚待;真实顺序B1-v2 COMPLETE且退出→B7→B6,每门7200CPU-s、单线程CPU24、无GPU/新解码/重试。不能把合成验收当真实门结果。
|
||||
|
||||
原B1及两个等待器本次来源pins全部PASS,没有重启或修改。H2未启动,新的下载/计时器/额外科学任务均无。
|
||||
|
||||
---
|
||||
|
||||
# Phase2 当前执行交接(2026-11-17)
|
||||
|
||||
本条替代旧aria2接收话题及“B3/B4未交付、B5尚未启动”的快照。v4接收早已完成,不启动任何下载。精确快照见`artifacts/phase2-current-handoff-2026-11-17.json`;每次行动前仍须读原根真实回执,不依据本条重开队列。
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# B6 数学复核 · 断开分量与近重根
|
||||
|
||||
MoldAstra,2026-11-17。核对 MeltAssist 固定稿 66d5801e 及 Claude 原帖 1794893702.921009。结论为沿用已定算子、三时刻和相关性门槛。下文说明其数学对象与验收方法,供 Melt 在原合同内使用。[Claude 裁量](https://arcticnimbus.slack.com/archives/C0C78UFKGRM/p1794893702921009) · [MeltAssist 原稿](https://drive.google.com/file/d/1aS_xWxhK_ZTZZf2H3tqMiAOPV4Fs5xcL/view)
|
||||
|
||||
**算子与零空间。** 在无量纲坐标 ξ=(x−x̄)/Rg 上组装体四面体 P1 刚度 Kᵢⱼ=Σₑ∫ₑ∇Nᵢ·∇Nⱼ dV 与集总质量 Mᵢᵢ=Σₑ∋ᵢ|e|/4,解 KΦ=MΦΛ,ΦᵀMΦ=I。所有物理边界(含浇口)均采用自然齐次 Neumann 条件;对象是几何扩散,没有熔体温度、材料热扩散率或浇口热边界数据。每个原网格连通分量 C 的零模可直接取 1_C/√(Σᵢ∈C Mᵢᵢ)。它们合起来构成完整零空间,在 i∈C 处贡献 1/vol(C)。划分学习/测试的亲缘组件不用于计算零模。可在零空间的 M 正交补求正模,防止细颈的低频正模被绝对阈值误删。白化后求得的欧氏正交向量 q 需要还原 φ=M⁻¹ᐟ²q 才能逐点计算。
|
||||
|
||||
**截断与时间。** λ₁取全件最小正根;按正根从小到大取前八个并补齐跨第八根的簇。落实相对容差 10⁻⁶ 时,建议锁定相邻正根规则 (λⱼ₊₁−λⱼ)/max(λⱼ₊₁,λⱼ)≤10⁻⁶ 即连入同簇。向后多求到首个分簇间隙或已穷尽谱,记录最后保留根、下一根和簇大小。预算内无法确认簇边界则该件记缺失。若少于八个正模,明示可用维数,不能补重复列。每件只取 t=0.1/λ₁、1/λ₁、10/λ₁;报告三列 H(i,t)=Σ保留模 exp(−λₖt) φₖ(i)²。这里 λ₁ 决定的是全件形状相关的无量纲时间尺度。三列是低频截断签名,特别在最短时刻,完整热核的高频贡献可能很大。[Sun、Ovsjanikov、Guibas 的 HKS 原文](https://www.lix.polytechnique.fr/Labo/Ovsjanikov.Maks/papers/hks.pdf)
|
||||
|
||||
**唯一需要校正的表述是近重根的旋转。** 对精确重根,簇的所有权重相等,平方和严格不依赖簇内的正交基。对接近却不同的 λₐ、λᵦ,即使只交换两根基向量而保留旧权重,节点值也可能改变,差值正比于 (e^(−λₐt)−e^(−λᵦt))(φₐ(i)²−φᵦ(i)²)。正常计算直接采用 Claude 的逐特征对公式。若验收刻意令 Φ′=ΦQ,则同步取 B′=Qᵀ(ΦᵀKΦ)Q,比较 diag[Φ′exp(−tB′)Φ′ᵀ] 与原簇贡献;用每个节点行向量做小矩阵二次型即可,无须生成稠密全件矩阵。这是同一个热算子换基。沿用原特征值,不把近根压成一个平均值。
|
||||
|
||||
**可复核记录。** 锁定网格/面板/库版本、FP64、求解器精度、固定初始向量或种子。保存物理分量数、各质量与退化件、实际模数、归一化与求解误差。推荐以每列 ρₖ=‖Kφₖ−λₖMφₖ‖₂/(‖Kφₖ‖₂+|λₖ|‖Mφₖ‖₂) 核正模,以 ‖ΦᵀMΦ−I‖ 检查正交性;零模单查 K1_C。按原稿已有验收核符号翻转、原节点重排回序、精确重根旋转和上述近根换基,保存绝对/相对误差和预冻结的数值容差。网格退化、质量非正、Rg 无效或谱不收敛应分因记录。不同剖分产生的新谱属于另一种稳定性问题。
|
||||
|
||||
**学习侧判读。** 仅用固定 fold0 learning 面板的冻结 A 残差 y=t*−ŷ_A,同时取同一行 19 个输入及截距为 X。节点等权时,组件 g 内件 p 的节点权 w=1/(G·P_g·n_p),故每个亲缘组件总权相同、同组件各件总权相同。用加权 QR/SVD 对 y 与每个 H 列分别投影掉 span(X),在共同有效行上计算残差的加权 Pearson r,记录秩、样本覆盖和三列带符号的 r。常量或投影后近零方差记未定义,不能填零。沿 Claude 门槛,任一 |r|≥0.10 即达到学习侧描述门,仍需原稿的覆盖和预算条件。三列取最大属于预定探索筛选,无法单凭此结果判断样本外收益或立项加特征。执行仍由 Melt 在 B1 恢复后按既定串行安排接续。
|
||||
@@ -0,0 +1,148 @@
|
||||
"""B6 learning-only geometric HKS gate, after B1 recovery and serial B7."""
|
||||
import argparse
|
||||
import fcntl
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import resource
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
from collections import Counter
|
||||
import joblib
|
||||
import numpy as np
|
||||
import scipy
|
||||
from phase2_fixed_io import BASE,freeze,verify
|
||||
from phase2_h1_worker_v2 import checked,sha,save
|
||||
from phase2_b6_math import hks,partial_from_triangular,tsqr_update
|
||||
from r4bc_guard import supervise
|
||||
from s2_recovery_monitoring import disk_usage
|
||||
|
||||
ROOT=BASE/'artifacts/phase2-b6-gate-2026-11-17'
|
||||
def read(p):return json.loads(Path(p).read_text())
|
||||
|
||||
|
||||
def prepare(acceptance):
|
||||
a=read(acceptance)
|
||||
if a['status']!='PASS':raise ValueError('B6 acceptance missing')
|
||||
for p,h in a['code_sha256'].items():checked(BASE/p,h)
|
||||
b3=BASE/'artifacts/phase2-b3-gate-2026-11-17/contract.json';old=read(b3)
|
||||
spec=BASE/'references/2026-11-17/phase2-design/mold-b6-spec-8f94be12.md'
|
||||
checked(spec,'8f94be1294b9b8a020aabaf2f434658b593a3fc78504815c38751e546015ae16')
|
||||
names=['phase2_b6_gate','phase2_b6_math','phase2_fixed_io','phase2_h1_worker_v2','phase2_residual_math','r4bc_guard','s2_recovery_supervisor','s2_recovery_monitoring']
|
||||
ROOT.mkdir(exist_ok=False)
|
||||
save(ROOT/'contract.json',dict(version='B6-volume-Neumann-HKS-v1',approvals=['1794892472.421479','1794893702.921009'],math_review='1794893856.072239',
|
||||
parts=old['parts'],baseline=old['baseline_model'],source_sha256={str(b3):sha(b3),str(spec):sha(spec),str(acceptance):sha(acceptance)},
|
||||
code_sha256={f'tools/{n}.py':sha(BASE/f'tools/{n}.py') for n in names},numpy=np.__version__,scipy=scipy.__version__,
|
||||
operator='volume tet P1 K; lumped mass; all boundaries homogeneous natural Neumann; centered coordinates/Rg; FP64',
|
||||
spectrum='all exact physical-component zero modes; first8 positive + full adjacent relative1e-6 boundary cluster; require next gap or exhaustion',
|
||||
solver='component-wise dense eigh for n<=256; otherwise projected shift-invert eigsh16 positive Ritz pairs, tol1e-10/maxiter2000/ncv48/fixedseed2026111706; no fallback or retry; unconfirmed boundary missing',
|
||||
shift='median whitened stiffness diagonal * 1e-6; invert K+shift*M only on exact zero-mode complement; Rayleigh-Ritz eigenvalues',
|
||||
residual_tolerance=1e-5,orthogonality_tolerance=1e-7,zero_tolerance=1e-10,cluster_tolerance=1e-6,times=[.1,1.,10.],
|
||||
weights='1/(G * parts_in_component * nodes_in_part); full retained tet node rows',
|
||||
partial_correlation='weighted TSQR then SVD projection of y=t_star-A and all3HKS on same original19 columns+intercept; signed Pearson residual r; no refit',
|
||||
null_variance='residual norm<=1e-10*max(original_norm,1) is undefined, never filled zero',
|
||||
gate='coverage>=40/50 and any abs(r)>=.10 => RETAIN_LEARNING_DESCRIPTION; undefined all => PARK; otherwise PRUNE_THIS_FIXED_HKS; no out-of-sample claim',
|
||||
total_cpu_seconds=7200,setup_seconds=60,cpu=24,part_cpu_seconds=110,part_wall_seconds=180,score_cpu_seconds=900,
|
||||
rss_bytes=8*1024**3,disk_bytes=5*1024**3,new_models=0,new_decodes=0,gpu=False,retry=False))
|
||||
|
||||
|
||||
def config(root):
|
||||
c=read(root/'contract.json')
|
||||
for p,h in {**c['code_sha256'],**c['source_sha256']}.items():checked(p,h)
|
||||
if (np.__version__,scipy.__version__)!=(c['numpy'],c['scipy']):raise ValueError('Library drift')
|
||||
if len(c['parts'])!=50 or len({r['component_id'] for r in c['parts']})!=50:raise ValueError('Original B3 panel differs')
|
||||
for r in c['parts']:
|
||||
a=next(a for a in r['assignments'] if a['fold']==0)
|
||||
if a['role']!='learning' or '100' not in a['learning_pools']:raise PermissionError('Not fold0 learning100')
|
||||
return c
|
||||
|
||||
|
||||
def field(root,c,index):
|
||||
row=c['parts'][index];dest=root/'parts'/f'{index:02d}';p=row['preparation'];gp=Path(p['preparation_root'])/'geometry.npz'
|
||||
checked(gp,p['output_sha256']['geometry.npz'])
|
||||
metadata=read(checked(Path(p['preparation_root'])/'result.json',p['result_sha256']))
|
||||
try:
|
||||
with np.load(gp,allow_pickle=False) as z:
|
||||
x=z['points_raw'].copy();tet=z['tetra'].copy();raw=z['raw_node_ids'].copy();mass=z['node_volume_raw'].copy()
|
||||
if x.shape!=(len(raw),3) or np.any(np.diff(raw)<=0) or not np.isfinite(mass).all() or np.any(mass<=0):raise ValueError('GEOMETRY_IDENTITY')
|
||||
center=np.average(x,axis=0,weights=mass);rg=float(metadata['scales']['Rg'])
|
||||
if not np.isfinite(rg) or rg<=0:raise ValueError('INVALID_RG')
|
||||
H,report=hks((x-center)/rg,tet)
|
||||
np.save(dest/'H.npy',H,allow_pickle=False);np.save(dest/'raw_ids.npy',raw,allow_pickle=False)
|
||||
save(dest/'result.json',dict(status='PASS',case=row['case'],component_id=row['component_id'],rg=rg,center=center.tolist(),nodes=len(raw),
|
||||
geometry_sha256=p['output_sha256']['geometry.npz'],H_sha256=sha(dest/'H.npy'),raw_ids_sha256=sha(dest/'raw_ids.npy'),labels_read=False,**report))
|
||||
except BaseException as exc:
|
||||
save(dest/'failure.json',dict(status='MISSING',type=type(exc).__name__,reason=str(exc),traceback=traceback.format_exc(),labels_read=False));raise
|
||||
|
||||
|
||||
def score(root,c):
|
||||
verify(root,'fields');manifest=read(root/'fields-manifest.json');dest=root/'score';R=None;access=[]
|
||||
entries=manifest['entries'];coverage=len(entries)/50
|
||||
if coverage<.8:
|
||||
save(dest/'result.json',dict(status='COMPLETE',decision='PARK_COVERAGE',parts=len(entries),coverage=coverage,signed_r=[None]*3,labels_read=False));return
|
||||
model=joblib.load(checked(c['baseline']['model_path'],c['baseline']['model_sha256']));groups=Counter(c['parts'][e['index']]['component_id'] for e in entries)
|
||||
for e in entries:
|
||||
row=c['parts'][e['index']];folder=root/'parts'/f"{e['index']:02d}";result=read(checked(folder/'result.json',e['result_sha256']));cache=row['v5_cache']
|
||||
H=np.load(checked(folder/'H.npy',result['H_sha256']),mmap_mode='r',allow_pickle=False)
|
||||
raw=np.load(checked(folder/'raw_ids.npy',result['raw_ids_sha256']),allow_pickle=False)
|
||||
original=np.load(checked(Path(cache['output'])/'raw_ids.npy',cache['output_sha256']['raw_ids.npy']),allow_pickle=False)
|
||||
if not np.array_equal(raw,original):raise ValueError('HKS and A node order differ')
|
||||
x=np.load(checked(Path(cache['output'])/'features.npy',cache['output_sha256']['features.npy']),mmap_mode='r',allow_pickle=False)
|
||||
access.append(dict(case=row['case'],role='fold0_learning',target_sha256=cache['output_sha256']['target.npy'],nodes=len(raw)));save(dest/'target-access.json',access)
|
||||
y=np.load(checked(Path(cache['output'])/'target.npy',cache['output_sha256']['target.npy']),mmap_mode='r',allow_pickle=False)
|
||||
if x.shape!=(len(raw),19) or y.shape!=(len(raw),) or H.shape!=(len(raw),3):raise ValueError('HKS residual row mismatch')
|
||||
weight=1/(len(groups)*groups[row['component_id']]*len(raw))
|
||||
for start in range(0,len(raw),32768):
|
||||
stop=min(len(raw),start+32768);xx=np.asarray(x[start:stop],np.float64);pred=np.asarray(model.predict(xx.astype(np.float32)),np.float64)
|
||||
block=np.column_stack([np.ones(stop-start),xx,y[start:stop]-pred,H[start:stop]])*np.sqrt(weight)
|
||||
if not np.isfinite(block).all():raise ValueError('Nonfinite residual input')
|
||||
R=tsqr_update(R,block)
|
||||
save(dest/'progress.json',dict(parts=len(access),nodes=sum(a['nodes'] for a in access)))
|
||||
result=partial_from_triangular(R);valid=[r for r in result['signed_r'] if r is not None]
|
||||
decision='PARK_UNDEFINED' if not valid else 'RETAIN_LEARNING_DESCRIPTION' if any(abs(r)>=.10 for r in valid) else 'PRUNE_THIS_FIXED_HKS'
|
||||
np.save(dest/'weighted-tsqr.npy',R,allow_pickle=False)
|
||||
save(dest/'result.json',dict(status='COMPLETE',decision=decision,parts=len(entries),components=len(groups),coverage=coverage,**result,
|
||||
interpretation='learning fit residual partial correlation; truncated low-frequency geometric heat signature; no out-of-sample or physical thermal claim'))
|
||||
|
||||
|
||||
def run(root):
|
||||
c=config(root);os.sched_setaffinity(0,[c['cpu']]);lock=(root/'run.lock').open('a');fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||
for folder in ['phase2-h1-labelled-recovery-2026-11-17','phase2-b7-gate-2026-11-17']:
|
||||
p=BASE/'artifacts'/folder/'complete.json'
|
||||
if not p.exists() or (folder.startswith('phase2-h1') and read(p)['status']!='COMPLETE'):raise RuntimeError('Serial dependency incomplete')
|
||||
if (root/'started.json').exists():raise FileExistsError('B6 zero retries')
|
||||
start=time.process_time();u0=resource.getrusage(resource.RUSAGE_CHILDREN);charged=0.;records=[];entries=[]
|
||||
def total():
|
||||
u=resource.getrusage(resource.RUSAGE_CHILDREN);return 60+max(charged,u.ru_utime+u.ru_stime-u0.ru_utime-u0.ru_stime)+time.process_time()-start
|
||||
save(root/'started.json',dict(pid=os.getpid(),unix=time.time(),contract_sha256=sha(root/'contract.json')))
|
||||
try:
|
||||
for i,row in enumerate(c['parts']):
|
||||
if total()+c['part_cpu_seconds']+1050>7200:raise RuntimeError('B6 remaining CPU cannot reserve next part and postfit')
|
||||
dest=root/'parts'/f'{i:02d}';dest.mkdir(parents=True,exist_ok=False)
|
||||
remaining=c['disk_bytes']-disk_usage(root)
|
||||
if remaining<=0:raise RuntimeError('B6 disk cap')
|
||||
save(root/'live-progress.json',dict(stage='GEOMETRY_ONLY',index=i,parts=len(records),unix=time.time(),cumulative_cpu_seconds=total()))
|
||||
g=supervise([sys.executable,'tools/phase2_b6_gate.py','field',str(root),str(i)],dest,dict(cpu_seconds=c['part_cpu_seconds'],wall_seconds=c['part_wall_seconds'],rss_bytes=c['rss_bytes'],disk_bytes=remaining))
|
||||
charged+=g['cpu_seconds'];record=dict(index=i,case=row['case'],guard=g);records.append(record)
|
||||
if g['monitor_errors']:raise RuntimeError('B6 monitor failure')
|
||||
if g['status']!='PASS' and not (dest/'failure.json').exists() and not g['stop_reason']:raise RuntimeError('B6 input/configuration failure before field diagnostics')
|
||||
if g['status']=='PASS':entries.append(dict(index=i,case=row['case'],result_sha256=sha(dest/'result.json')))
|
||||
save(root/'phase-ledger.json',dict(records=records,cumulative_cpu_seconds=total()))
|
||||
save(root/'fields-manifest.json',dict(entries=entries,records=records,all50_terminal=True,labels_read=False))
|
||||
freeze(root,'fields',[root/'contract.json',root/'fields-manifest.json',*[BASE/p for p in c['code_sha256']]])
|
||||
dest=root/'score';dest.mkdir(exist_ok=False)
|
||||
g=supervise([sys.executable,'tools/phase2_b6_gate.py','score',str(root)],dest,dict(cpu_seconds=min(900,7200-total()-120),wall_seconds=1200,rss_bytes=c['rss_bytes'],disk_bytes=c['disk_bytes']-disk_usage(root)))
|
||||
charged+=g['cpu_seconds'];records.append(dict(phase='score',guard=g))
|
||||
if g['status']!='PASS' or total()>7200 or disk_usage(root)>c['disk_bytes']:raise RuntimeError('B6 scoring/resource failure')
|
||||
save(root/'complete.json',dict(status='COMPLETE',cumulative_cpu_seconds=total(),records=records,scientific_gate=read(dest/'result.json')['decision'],retry=False))
|
||||
except BaseException as exc:
|
||||
save(root/'complete.json',dict(status='STOPPED',reason=type(exc).__name__+': '+str(exc),cumulative_cpu_seconds=total(),records=records,retry=False));raise
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser();p.add_argument('mode',choices=['prepare','run','field','score']);p.add_argument('path',type=Path);p.add_argument('index',nargs='?',type=int);a=p.parse_args()
|
||||
if a.mode=='prepare':prepare(a.path)
|
||||
elif a.mode=='run':run(a.path)
|
||||
elif a.mode=='field':field(a.path,config(a.path),a.index)
|
||||
else:score(a.path,config(a.path))
|
||||
@@ -0,0 +1,107 @@
|
||||
"""FP64 volume-P1 Neumann truncated HKS and weighted partial correlation."""
|
||||
import numpy as np
|
||||
from scipy import linalg,sparse
|
||||
from scipy.sparse.csgraph import connected_components
|
||||
from scipy.sparse.linalg import LinearOperator,eigsh,splu
|
||||
|
||||
CLUSTER_TOL=1e-6
|
||||
RESIDUAL_TOL=1e-5
|
||||
ORTHOGONAL_TOL=1e-7
|
||||
|
||||
|
||||
def assemble(points,tetra):
|
||||
x=np.asarray(points,dtype=np.float64);t=np.asarray(tetra,dtype=np.int64);n=len(x)
|
||||
if x.ndim!=2 or x.shape[1]!=3 or t.ndim!=2 or t.shape[1]!=4 or not len(t) or not np.isfinite(x).all():raise ValueError('INVALID_MESH')
|
||||
if t.min()<0 or t.max()>=n:raise ValueError('MESH_INDEX')
|
||||
K=sparse.csr_matrix((n,n));mass=np.zeros(n)
|
||||
for start in range(0,len(t),16384):
|
||||
ids=t[start:start+16384];v=x[ids];J=np.transpose(v[:,1:]-v[:,0,None],(0,2,1));det=np.linalg.det(J)
|
||||
if not np.isfinite(det).all() or np.any(det==0):raise ValueError('DEGENERATE_TET')
|
||||
volume=np.abs(det)/6;inv=np.linalg.inv(J);grad=np.concatenate([-inv.sum(axis=1)[:,None,:],inv],axis=1)
|
||||
ke=volume[:,None,None]*np.einsum('eik,ejk->eij',grad,grad)
|
||||
K+=sparse.coo_matrix((ke.ravel(),(np.repeat(ids,4,axis=1).ravel(),np.tile(ids,(1,4)).ravel())),shape=(n,n)).tocsr()
|
||||
np.add.at(mass,ids.ravel(),np.repeat(volume/4,4))
|
||||
if not np.isfinite(mass).all() or np.any(mass<=0):raise ValueError('NONPOSITIVE_MASS')
|
||||
# Topology from original tetra membership, never sparsity cancellation in K.
|
||||
edge=np.concatenate([t[:,[0,1]],t[:,[0,2]],t[:,[0,3]]])
|
||||
adj=sparse.coo_matrix((np.ones(len(edge)),(edge[:,0],edge[:,1])),shape=(n,n)).tocsr()
|
||||
nc,labels=connected_components(adj,directed=False)
|
||||
return K,mass,labels,nc
|
||||
|
||||
|
||||
def truncate(values,exhausted):
|
||||
values=np.asarray(values)
|
||||
if not len(values) or np.any(values<=0) or np.any(np.diff(values)<0):raise ValueError('INVALID_POSITIVE_SPECTRUM')
|
||||
end=min(8,len(values))
|
||||
while end<len(values) and (values[end]-values[end-1])/max(values[end],values[end-1])<=CLUSTER_TOL:end+=1
|
||||
if end==len(values) and not exhausted:raise ValueError('UNCONFIRMED_CLUSTER_BOUNDARY')
|
||||
return end
|
||||
|
||||
|
||||
def component_modes(K,mass):
|
||||
n=len(mass);d=1/np.sqrt(mass);A=sparse.diags(d)@K@sparse.diags(d)
|
||||
z=np.sqrt(mass/mass.sum());available=n-1
|
||||
if available<=0:raise ValueError('NO_POSITIVE_MODES')
|
||||
if n<=256:
|
||||
vals,q=linalg.eigh(A.toarray());zero=int(np.argmax(np.abs(q.T@z)))
|
||||
keep=np.arange(n)!=zero;q=q[:,keep];vals=vals[keep];exhausted=True
|
||||
else:
|
||||
# The inverse acts only in the exact physical zero mode's complement.
|
||||
# No small-positive eigenvalue is removed by an absolute cutoff.
|
||||
shift=float(np.median(A.diagonal()))*1e-6
|
||||
if shift<=0:raise ValueError('INVALID_OPERATOR_SCALE')
|
||||
factor=splu((K+sparse.diags(shift*mass)).tocsc());sqrtm=np.sqrt(mass)
|
||||
def project(v):return v-z*(z@v)
|
||||
def mv(v):return project(sqrtm*factor.solve(sqrtm*project(v)))
|
||||
op=LinearOperator((n,n),matvec=mv,dtype=np.float64)
|
||||
initial=project(np.random.default_rng(2026111706).normal(size=n));initial/=np.linalg.norm(initial)
|
||||
_,q=eigsh(op,k=16,which='LA',v0=initial,tol=1e-10,maxiter=2000,ncv=48)
|
||||
q=q-z[:,None]*(z@q)[None,:]
|
||||
q,_=np.linalg.qr(q,mode='reduced')
|
||||
vals,rotation=linalg.eigh(q.T@(A@q));q=q@rotation;exhausted=False
|
||||
order=np.argsort(vals);vals=vals[order];q=q[:,order];phi=d[:,None]*q
|
||||
kp=K@phi;mp=mass[:,None]*phi;err=np.linalg.norm(kp-mp*vals,axis=0)/(np.linalg.norm(kp,axis=0)+np.abs(vals)*np.linalg.norm(mp,axis=0))
|
||||
orth=float(np.linalg.norm(phi.T@mp-np.eye(len(vals))))
|
||||
zero_error=float(np.linalg.norm(K@np.ones(n))/(np.linalg.norm(K.data)*np.sqrt(n)))
|
||||
if not np.isfinite(vals).all() or np.any(vals<=0) or not np.isfinite(err).all() or np.max(err)>RESIDUAL_TOL or orth>ORTHOGONAL_TOL or zero_error>1e-10:raise ValueError('SPECTRAL_ACCEPTANCE_FAILURE')
|
||||
return vals,phi,dict(exhausted=exhausted,residuals=err.tolist(),orthogonality_error=orth,zero_error=zero_error,positive_modes=len(vals))
|
||||
|
||||
|
||||
def hks(points,tetra):
|
||||
K,mass,labels,nc=assemble(points,tetra);modes=[];diagnostics=[];zero=np.zeros(len(mass));all_complete=True
|
||||
for component in range(nc):
|
||||
ids=np.flatnonzero(labels==component);m=mass[ids];zero[ids]=1/m.sum()
|
||||
values,phi,report=component_modes(K[ids][:,ids],m)
|
||||
diagnostics.append(dict(component=component,nodes=len(ids),mass=float(m.sum()),**report))
|
||||
all_complete=all_complete and report['exhausted']
|
||||
for j,v in enumerate(values):modes.append((float(v),component,j))
|
||||
diagnostics[-1]['_ids']=ids;diagnostics[-1]['_phi']=phi
|
||||
modes.sort();values=np.array([v[0] for v in modes]);end=truncate(values,all_complete)
|
||||
# Each unexhausted component must have a witnessed root beyond the global cut.
|
||||
for g,r in enumerate(diagnostics):
|
||||
if not r['exhausted'] and max(v[0] for v in modes if v[1]==g)<=values[end-1]:raise ValueError('UNCONFIRMED_COMPONENT_SPECTRUM')
|
||||
times=np.array([.1,1.,10.])/values[0];H=np.repeat(zero[:,None],3,axis=1)
|
||||
for value,g,j in modes[:end]:
|
||||
r=diagnostics[g];H[r['_ids']]+=r['_phi'][:,j,None]**2*np.exp(-value*times)[None,:]
|
||||
for r in diagnostics:del r['_ids'],r['_phi']
|
||||
if not np.isfinite(H).all():raise ValueError('NONFINITE_HKS')
|
||||
return H,dict(physical_components=nc,components=diagnostics,positive_modes_retained=end,positive_values=values[:end].tolist(),
|
||||
next_eigenvalue=float(values[end]) if end<len(values) else None,spectrum_exhausted=all_complete,times=times.tolist(),zero_modes=nc,
|
||||
mass_sum=float(mass.sum()),cluster_relative_tolerance=CLUSTER_TOL,normalization='Phi^T M Phi=I; exact physical component zero modes')
|
||||
|
||||
|
||||
def partial_from_triangular(R):
|
||||
# R is the TSQR factor of sqrt(w)*[1,X19,y,H3]. Orthogonal left transforms
|
||||
# preserve all projections and inner products, avoiding a dense full corpus.
|
||||
X=R[:,:20];Z=R[:,20:];u,s,v=linalg.svd(X,full_matrices=False)
|
||||
cutoff=np.finfo(float).eps*max(X.shape)*s[0];rank=int(np.sum(s>cutoff));res=Z-u[:,:rank]@(u[:,:rank].T@Z)
|
||||
norms=np.linalg.norm(res,axis=0);original=np.linalg.norm(Z,axis=0);out=[]
|
||||
for j in range(1,4):
|
||||
if norms[0]<=1e-10*max(original[0],1.) or norms[j]<=1e-10*max(original[j],1.):out.append(None)
|
||||
else:out.append(float(np.clip(res[:,0]@res[:,j]/(norms[0]*norms[j]),-1,1)))
|
||||
return dict(signed_r=out,design_rank=rank,design_singular_values=s.tolist(),residual_norms=norms.tolist(),undefined=[j for j,r in enumerate(out) if r is None])
|
||||
|
||||
|
||||
def tsqr_update(R,block):
|
||||
local=np.linalg.qr(block,mode='r')
|
||||
return local if R is None else np.linalg.qr(np.vstack([R,local]),mode='r')
|
||||
@@ -0,0 +1,52 @@
|
||||
"""One dependency waiter: existing B1-v2 terminal, then B7 then B6 once."""
|
||||
import fcntl
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import psutil
|
||||
from phase2_h1_worker_v2 import save,sha,checked
|
||||
|
||||
BASE=Path('/home/frank14f/optane/MeltMind')
|
||||
ROOT=BASE/'artifacts/phase2-b76-serial-2026-11-17'
|
||||
DEPENDENCY=BASE/'artifacts/phase2-h1-labelled-recovery-2026-11-17'
|
||||
def read(p):return json.loads(Path(p).read_text())
|
||||
|
||||
|
||||
def live(root):
|
||||
return [p.pid for p in psutil.process_iter(['pid','cmdline']) if p.pid!=os.getpid() and str(root) in (p.info['cmdline'] or [])]
|
||||
|
||||
|
||||
def run():
|
||||
c=read(ROOT/'contract.json')
|
||||
for p,h in c['source_sha256'].items():checked(BASE/p,h)
|
||||
os.sched_setaffinity(0,[24]);start=time.process_time()
|
||||
with (ROOT/'run.lock').open('a') as lock:
|
||||
fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||
if (ROOT/'started.json').exists():raise FileExistsError('Unique existing chain; no restart')
|
||||
save(ROOT/'started.json',dict(pid=os.getpid(),unix=time.time(),contract_sha256=sha(ROOT/'contract.json')))
|
||||
results=[]
|
||||
try:
|
||||
wall=time.monotonic()
|
||||
while not (DEPENDENCY/'complete.json').exists() or live(DEPENDENCY):
|
||||
save(ROOT/'live-progress.json',dict(stage='WAIT_EXISTING_B1_V2_TERMINAL_AND_EXIT',unix=time.time(),coordinator_cpu_seconds=time.process_time()-start))
|
||||
if time.monotonic()-wall>43200 or time.process_time()-start>30:raise RuntimeError('Bounded waiter limit')
|
||||
time.sleep(15)
|
||||
if read(DEPENDENCY/'complete.json')['status']!='COMPLETE':raise RuntimeError('B1 recovery stopped; no downstream launch')
|
||||
for name,module in [('phase2-b7-gate-2026-11-17','phase2_b7_gate'),('phase2-b6-gate-2026-11-17','phase2_b6_gate')]:
|
||||
root=BASE/'artifacts'/name
|
||||
for p,h in c['source_sha256'].items():checked(BASE/p,h)
|
||||
if live(root) or (root/'started.json').exists():raise RuntimeError('Dependent gate already attempted; do not duplicate')
|
||||
save(ROOT/'live-progress.json',dict(stage='RUN_'+module,unix=time.time(),coordinator_cpu_seconds=time.process_time()-start))
|
||||
with (ROOT/(module+'.log')).open('x') as log:
|
||||
child=subprocess.run([sys.executable,'tools/'+module+'.py','run',str(root)],stdout=log,stderr=subprocess.STDOUT)
|
||||
if not (root/'complete.json').exists() or live(root):raise RuntimeError('Missing terminal or live children')
|
||||
result=read(root/'complete.json');results.append(dict(gate=name,returncode=child.returncode,complete_sha256=sha(root/'complete.json'),status=result['status']))
|
||||
save(ROOT/'gate-terminals.json',results)
|
||||
save(ROOT/'complete.json',dict(status='BOTH_GATES_TERMINAL',results=results,coordinator_cpu_seconds=time.process_time()-start,retry=False))
|
||||
except BaseException as exc:
|
||||
save(ROOT/'complete.json',dict(status='STOPPED',reason=type(exc).__name__+': '+str(exc),results=results,coordinator_cpu_seconds=time.process_time()-start,retry=False));raise
|
||||
|
||||
if __name__=='__main__':run()
|
||||
@@ -0,0 +1,177 @@
|
||||
"""B7 single-fold validation ranker gate; rank scores are not seconds."""
|
||||
import argparse
|
||||
import fcntl
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import resource
|
||||
import sys
|
||||
import time
|
||||
import joblib
|
||||
import numpy as np
|
||||
import xgboost as xgb
|
||||
from phase2_h1_worker_v2 import sha,checked,save
|
||||
from phase2_fixed_io import freeze,verify,BASE
|
||||
from s2_custody_common import prediction_inputs
|
||||
from s2_custody_statistics import part_metrics
|
||||
from r4bc_common import paired_difference
|
||||
from r4bc_guard import supervise
|
||||
from s2_recovery_monitoring import disk_usage
|
||||
|
||||
ROOT=BASE/'artifacts/phase2-b7-gate-2026-11-17'
|
||||
PARAMS=dict(objective='rank:pairwise',tree_method='hist',device='cpu',n_estimators=100,max_depth=8,learning_rate=.1,random_state=0,n_jobs=1,lambdarank_pair_method='mean',lambdarank_num_pair_per_sample=1)
|
||||
def read(p):return json.loads(Path(p).read_text())
|
||||
|
||||
|
||||
def sample_ids(raw,cap=2048):
|
||||
raw=np.asarray(raw)
|
||||
if not len(raw) or np.any(np.diff(raw)<=0):raise ValueError('Expected sorted unique raw IDs')
|
||||
return np.linspace(0,len(raw)-1,min(cap,len(raw)),dtype=np.int64)
|
||||
|
||||
|
||||
def dense_rank(y):
|
||||
y=np.asarray(y)
|
||||
if y.ndim!=1 or not np.isfinite(y).all():raise ValueError('Invalid pairwise labels')
|
||||
return np.unique(y,return_inverse=True)[1].astype(np.float32)
|
||||
|
||||
|
||||
def gate(tau,last,undefined):
|
||||
if undefined:return 'PARK_UNDEFINED_OR_COVERAGE'
|
||||
return 'RETAIN_SINGLE_FOLD_FEASIBILITY' if (tau['low'] is not None and tau['low']>0) or (last['value'] is not None and last['value']>=.010) else 'PRUNE_THIS_FIXED_RANKER_RECIPE'
|
||||
|
||||
|
||||
def check_ranker(model):
|
||||
cfg=json.loads(model.get_booster().save_config());obj=cfg['learner']['objective']
|
||||
if obj['name']!='rank:pairwise':raise ValueError('Unexpected ranking objective')
|
||||
params=obj['lambdarank_param']
|
||||
if params['lambdarank_pair_method']!='mean' or int(params['lambdarank_num_pair_per_sample'])!=1:raise ValueError('Unsupported pair method/number; no silent fallback')
|
||||
return cfg
|
||||
|
||||
|
||||
def prepare(acceptance):
|
||||
tests=read(acceptance)
|
||||
if tests['status']!='PASS':raise ValueError('B7 acceptance missing')
|
||||
for p,h in tests['code_sha256'].items():checked(BASE/p,h)
|
||||
p=BASE/'artifacts/r4bc-execution-2026-11-16/contract.json';old=read(p);rows={}
|
||||
for role in ['learning','validation']:
|
||||
rows[role]=sorted([r for r in old['parts'] if any(a['fold']==0 and a['role']==role and (role!='learning' or '100' in a['learning_pools']) for a in r['assignments'])],key=lambda r:r['case'])
|
||||
if set(r['component_id'] for r in rows['learning']) & set(r['component_id'] for r in rows['validation']):raise ValueError('Role component leakage')
|
||||
b3=BASE/'artifacts/phase2-b3-gate-2026-11-17/contract.json';baseline=read(b3)['baseline_model']
|
||||
names=['phase2_b7_gate','phase2_fixed_io','phase2_h1_worker_v2','phase2_residual_math','s2_custody_common','s2_custody_statistics','r4bc_common','r4bc_guard','s2_recovery_supervisor','s2_recovery_monitoring']
|
||||
ROOT.mkdir(exist_ok=False)
|
||||
save(ROOT/'contract.json',dict(version='B7-one-fold-validation-v1',approval='1794892472.421479',proposal_sha256='66d5801e49470eb9465301b1b855ad8dcddfb5bbbca71c26b90ed7f2fb26f7fb',
|
||||
rows=rows,baseline=baseline,parameters=PARAMS,source_sha256={str(p):sha(p),str(b3):sha(b3),str(acceptance):sha(acceptance)},
|
||||
code_sha256={f'tools/{n}.py':sha(BASE/f'tools/{n}.py') for n in names},cpu=24,total_cpu_seconds=7200,setup_seconds=60,rss_bytes=8*1024**3,disk_bytes=5*1024**3,
|
||||
phase_limits=dict(train=3600,predict=900,score=900),sample_policy='<=2048 uniformly spaced ascending original IDs per part, endpoint inclusive; no labels used for selection',
|
||||
qid_policy='one learning part per qid, ascending part order; dense within-part target ranks, exact ties retained',
|
||||
score_role='fold0 validation only; no test label access',gate='tau-b candidate-minus-A paired-component95CI lower>0 OR A-minus-candidate mean last-distance>=.010Rg; otherwise prune; incomplete/undefined park',
|
||||
rank_scale='raw arbitrary rank score compared with T/t_set only as uncalibrated diagnostic L2, never seconds or a gate',new_models=1,extra_control_models=0,new_decodes=0,gpu=False,retry=False))
|
||||
|
||||
|
||||
def config(root):
|
||||
c=read(root/'contract.json')
|
||||
if xgb.__version__!='2.1.4':raise ValueError('Pinned XGBoost version differs')
|
||||
for p,h in {**c['code_sha256'],**c['source_sha256']}.items():checked(p,h)
|
||||
for role,rows in c['rows'].items():
|
||||
for r in rows:
|
||||
a=next(x for x in r['assignments'] if x['fold']==0)
|
||||
if a['role']!=role or (role=='learning' and '100' not in a['learning_pools']):raise PermissionError('B7 role mismatch')
|
||||
return c
|
||||
|
||||
|
||||
def array(row,name):
|
||||
d=row['v5_cache'];return np.load(checked(Path(d['output'])/(name+'.npy'),d['output_sha256'][name+'.npy']),allow_pickle=False)
|
||||
|
||||
|
||||
def train(root,c):
|
||||
dest=root/'phases/train';xs=[];ys=[];qids=[];records=[];start=time.process_time()
|
||||
for qid,row in enumerate(c['rows']['learning']):
|
||||
raw=array(row,'raw_ids');ix=sample_ids(raw);x=array(row,'features');y=array(row,'target')
|
||||
if x.shape!=(len(raw),19) or y.shape!=raw.shape:raise ValueError('B7 full cache identity mismatch')
|
||||
xs.append(np.asarray(x[ix],np.float32));ys.append(dense_rank(y[ix]));qids.append(np.full(len(ix),qid,np.int64))
|
||||
records.append(dict(case=row['case'],component_id=row['component_id'],qid=qid,raw_ids=list(map(int,raw[ix])),target_sha256=row['v5_cache']['output_sha256']['target.npy'],role='learning'))
|
||||
save(dest/'training-access.json',records)
|
||||
x=np.concatenate(xs);y=np.concatenate(ys);qid=np.concatenate(qids)
|
||||
model=xgb.XGBRanker(**c['parameters']);model.fit(x,y,qid=qid,verbose=False);cfg=check_ranker(model)
|
||||
model.save_model(dest/'model.ubj');save(dest/'xgboost-config.json',cfg)
|
||||
save(dest/'result.json',dict(status='FIT_COMPLETE',checkpoint_sha256=sha(dest/'model.ubj'),rows=len(y),parts=len(records),cpu_seconds=time.process_time()-start,validation_labels_read=False))
|
||||
|
||||
|
||||
def predict(root,c):
|
||||
verify(root,'model');dest=root/'phases/predict';model=xgb.XGBRanker();model.load_model(root/'phases/train/model.ubj');baseline=joblib.load(checked(c['baseline']['model_path'],c['baseline']['model_sha256']));entries=[]
|
||||
for row in c['rows']['validation']:
|
||||
q=prediction_inputs(row);raw=array(row,'raw_ids');ix=np.searchsorted(raw,q['raw_ids'])
|
||||
if np.any(ix>=len(raw)) or not np.array_equal(raw[ix],q['raw_ids']):raise ValueError('Validation query IDs differ')
|
||||
x=np.asarray(array(row,'features')[ix],np.float32);rank=np.asarray(model.predict(x),np.float64);a=np.asarray(baseline.predict(x),np.float64)
|
||||
if not np.isfinite(rank).all() or not np.isfinite(a).all():raise ValueError('Nonfinite validation prediction')
|
||||
p=dest/(row['case']+'.npz');np.savez_compressed(p,rank=rank,A=a,raw_ids=q['raw_ids'],counts=q['counts'],near_wall=q['near_wall'],coordinates_over_Rg=q['coordinates_over_Rg'])
|
||||
entries.append(dict(case=row['case'],path=str(p),sha256=sha(p),component_id=row['component_id']))
|
||||
save(dest/'progress.json',dict(parts=len(entries),validation_labels_read=False))
|
||||
save(dest/'manifest.json',dict(entries=entries,validation_labels_read=False))
|
||||
|
||||
|
||||
def score(root,c):
|
||||
verify(root,'predictions');dest=root/'phases/score';entries=read(root/'phases/predict/manifest.json')['entries'];by={r['case']:r for r in c['rows']['validation']};rows=[];undefined=[]
|
||||
if {e['case'] for e in entries}!=set(by):raise ValueError('Incomplete validation roster')
|
||||
for e in entries:
|
||||
row=by[e['case']]
|
||||
save(dest/'next-target-access.json',dict(case=row['case'],role='fold0_validation',target_sha256=row['v5_cache']['output_sha256']['target.npy']))
|
||||
y=array(row,'target');raw=array(row,'raw_ids')
|
||||
with np.load(checked(e['path'],e['sha256']),allow_pickle=False) as z:
|
||||
ix=np.searchsorted(raw,z['raw_ids'])
|
||||
if not np.array_equal(raw[ix],z['raw_ids']):raise ValueError('Scoring query identity changed')
|
||||
result=dict(case=e['case'],component_id=row['component_id'])
|
||||
for arm in ['rank','A']:
|
||||
metrics=part_metrics(z[arm],y[ix],z['counts'],z['near_wall'],z['raw_ids'],z['coordinates_over_Rg'],int(e['case'].split('_')[0]));result[arm]=metrics
|
||||
for name in ['last_location','kendall_tau_b']:
|
||||
if metrics[name]['value'] is None:undefined.append(dict(case=e['case'],arm=arm,metric=name,reason=metrics[name]['reason']))
|
||||
rows.append(result)
|
||||
groups={}
|
||||
for r in rows:groups.setdefault(r['component_id'],[]).append(r)
|
||||
metrics={}
|
||||
for name in ['last_location','kendall_tau_b','relative_l2']:
|
||||
values={a:{} for a in ['rank','A']}
|
||||
for g,parts in groups.items():
|
||||
for a in values:
|
||||
v=[r[a][name]['value'] for r in parts]
|
||||
if all(x is not None for x in v):values[a][g]=float(np.mean(v))
|
||||
metrics[name]=dict(means={a:float(np.mean(list(v.values()))) if v else None for a,v in values.items()},components={a:len(v) for a,v in values.items()},
|
||||
rank_minus_A=paired_difference(values['rank'],values['A']),A_minus_rank=paired_difference(values['A'],values['rank']))
|
||||
tau=metrics['kendall_tau_b']['rank_minus_A'];last=metrics['last_location']['A_minus_rank']
|
||||
decision=gate(tau,last,undefined)
|
||||
save(dest/'target-access.json',[dict(case=r['case'],role='fold0_validation',target_sha256=r['v5_cache']['output_sha256']['target.npy']) for r in c['rows']['validation']])
|
||||
save(dest/'result.json',dict(status='COMPLETE',decision=decision,parts=len(rows),components=len(groups),metrics=metrics,undefined=undefined,rows=rows,
|
||||
interpretation='validation-only one-fold feasibility; capped ranker vs full-tet A does not isolate loss; rank raw score has no physical-time calibration'))
|
||||
|
||||
|
||||
def run(root):
|
||||
c=config(root);os.sched_setaffinity(0,[24]);start=time.process_time();u0=resource.getrusage(resource.RUSAGE_CHILDREN);charged=0.;records=[]
|
||||
lock=(root/'run.lock').open('a');fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||
dependency=BASE/'artifacts/phase2-h1-labelled-recovery-2026-11-17/complete.json'
|
||||
if not dependency.exists() or read(dependency)['status']!='COMPLETE':raise RuntimeError('B1 recovery must complete before B7')
|
||||
if (root/'started.json').exists():raise FileExistsError('B7 no retry')
|
||||
save(root/'started.json',dict(pid=os.getpid(),unix=time.time(),contract_sha256=sha(root/'contract.json')))
|
||||
def total():
|
||||
u=resource.getrusage(resource.RUSAGE_CHILDREN);return 60+max(charged,u.ru_utime+u.ru_stime-u0.ru_utime-u0.ru_stime)+time.process_time()-start
|
||||
try:
|
||||
for mode in ['train','predict','score']:
|
||||
if mode=='predict':freeze(root,'model',[root/'contract.json',root/'phases/train/model.ubj',root/'phases/train/result.json',*[BASE/p for p in c['code_sha256']]])
|
||||
if mode=='score':freeze(root,'predictions',[root/'contract.json',root/'phases/predict/manifest.json',*[BASE/p for p in c['code_sha256']]])
|
||||
dest=root/'phases'/mode;dest.mkdir(parents=True,exist_ok=False);cap=min(c['phase_limits'][mode],7200-total()-120)
|
||||
disk_remaining=c['disk_bytes']-disk_usage(root)
|
||||
if disk_remaining<=0:raise RuntimeError('B7 cumulative disk cap')
|
||||
if cap<=0:raise RuntimeError('B7 cumulative CPU cap')
|
||||
save(root/'live-progress.json',dict(stage=mode,unix=time.time(),cumulative_cpu_seconds=total()))
|
||||
g=supervise([sys.executable,'tools/phase2_b7_gate.py',mode,str(root)],dest,dict(cpu_seconds=cap,wall_seconds=c['phase_limits'][mode],rss_bytes=c['rss_bytes'],disk_bytes=disk_remaining))
|
||||
charged+=g['cpu_seconds'];records.append(dict(phase=mode,guard=g));save(root/'phase-ledger.json',dict(records=records,cumulative_cpu_seconds=total()))
|
||||
if g['status']!='PASS' or total()>7200 or disk_usage(root)>c['disk_bytes']:raise RuntimeError('B7 phase/resource stop')
|
||||
save(root/'complete.json',dict(status='COMPLETE',cumulative_cpu_seconds=total(),records=records,scientific_gate=read(root/'phases/score/result.json')['decision'],retry=False))
|
||||
except BaseException as exc:
|
||||
save(root/'complete.json',dict(status='STOPPED',reason=type(exc).__name__+': '+str(exc),cumulative_cpu_seconds=total(),records=records,retry=False));raise
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser();p.add_argument('mode',choices=['prepare','run','train','predict','score']);p.add_argument('path',type=Path);a=p.parse_args()
|
||||
if a.mode=='prepare':prepare(a.path)
|
||||
elif a.mode=='run':run(a.path)
|
||||
else:dict(train=train,predict=predict,score=score)[a.mode](a.path,config(a.path))
|
||||
@@ -0,0 +1,34 @@
|
||||
"""Single-writer Git barriers; worker verification never spawns a process."""
|
||||
import fcntl
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
from phase2_h1_worker_v2 import sha,checked,save
|
||||
BASE=Path('/home/frank14f/optane/MeltMind')
|
||||
WRITER=Path('/tmp/meltmind-git-review-20261114-v1-29ebglg8')
|
||||
|
||||
|
||||
def freeze(root,name,files):
|
||||
with Path('/tmp/meltmind-single-writer.lock').open('a') as lock:
|
||||
fcntl.flock(lock,fcntl.LOCK_EX)
|
||||
def git(*args):return subprocess.check_output(['git','-C',str(WRITER),*args],text=True).strip()
|
||||
if git('branch','--show-current')!='codex/s2-execution-diff-20261114' or git('status','--porcelain'):raise RuntimeError('Single writer not clean')
|
||||
hashes={}
|
||||
for path in files:
|
||||
path=Path(path);rel=str(path.resolve().relative_to(BASE));dest=WRITER/rel;dest.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(path,dest);hashes[rel]=sha(path)
|
||||
subprocess.run(['git','-C',str(WRITER),'add','--',*hashes],check=True)
|
||||
if git('diff','--cached','--name-only'):subprocess.run(['git','-C',str(WRITER),'commit','-m','Phase2 '+root.name+' '+name+' immutable barrier'],check=True)
|
||||
commit=git('rev-parse','HEAD')
|
||||
for rel,h in hashes.items():
|
||||
if hashlib.sha256(subprocess.check_output(['git','-C',str(WRITER),'show',commit+':'+rel])).hexdigest()!=h:raise ValueError('Git byte mismatch')
|
||||
save(root/(name+'-git-freeze.json'),dict(commit=commit,sha256=hashes,remote_published=False))
|
||||
save(root/(name+'-authorization.json'),dict(proof_sha256=sha(root/(name+'-git-freeze.json')),contract_sha256=sha(root/'contract.json')))
|
||||
|
||||
|
||||
def verify(root,name):
|
||||
auth=json.loads((root/(name+'-authorization.json')).read_text());checked(root/'contract.json',auth['contract_sha256'])
|
||||
p=checked(root/(name+'-git-freeze.json'),auth['proof_sha256']);proof=json.loads(p.read_text())
|
||||
for rel,h in proof['sha256'].items():checked(BASE/rel,h)
|
||||
return proof
|
||||
@@ -0,0 +1,64 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
from scipy.linalg import expm
|
||||
from phase2_b6_math import assemble,hks,truncate,tsqr_update,partial_from_triangular
|
||||
|
||||
TET=np.array([[0.,0,0],[1,0,0],[0,1,0],[0,0,1]])
|
||||
|
||||
class Acceptance(unittest.TestCase):
|
||||
def test_exact_stiffness_mass_disconnected(self):
|
||||
K,m,_,nc=assemble(TET,[[0,1,2,3]])
|
||||
expected=np.array([[3,-1,-1,-1],[-1,1,0,0],[-1,0,1,0],[-1,0,0,1]])/6
|
||||
np.testing.assert_allclose(K.toarray(),expected,atol=1e-15);np.testing.assert_allclose(m,np.full(4,1/24))
|
||||
x=np.vstack([TET,TET+[3,0,0],TET+[6,0,0]])
|
||||
H,r=hks(x,np.arange(12).reshape(3,4))
|
||||
self.assertEqual(r['zero_modes'],3);self.assertEqual(r['positive_modes_retained'],9)
|
||||
self.assertEqual(r['next_eigenvalue'],None)
|
||||
np.testing.assert_allclose(H[:4],H[4:8],rtol=1e-12)
|
||||
np.testing.assert_allclose(H[:4],H[8:],rtol=1e-12)
|
||||
self.assertTrue(np.all(H>=6))
|
||||
def test_node_permutation(self):
|
||||
original,_=hks(TET,[[0,1,2,3]])
|
||||
p=np.array([2,0,3,1]);inverse=np.argsort(p)
|
||||
reordered,_=hks(TET[p],inverse[np.array([[0,1,2,3]])])
|
||||
np.testing.assert_allclose(reordered[inverse],original,rtol=1e-11,atol=1e-12)
|
||||
def test_cluster_boundary(self):
|
||||
vals=np.array([1,2,3,4,5,6,7,8,8+1e-7,9])
|
||||
self.assertEqual(truncate(vals,False),9)
|
||||
with self.assertRaises(ValueError):truncate(vals[:9],False)
|
||||
self.assertEqual(truncate([1,2,3],True),3)
|
||||
def test_exact_and_near_rotations(self):
|
||||
rng=np.random.default_rng(6);phi=rng.normal(size=(9,2));Q=np.linalg.qr(rng.normal(size=(2,2)))[0]
|
||||
direct=lambda P,B:np.einsum('ij,jk,ik->i',P,expm(-.7*B),P)
|
||||
for vals in [[2,2],[2,2.000001]]:
|
||||
B=np.diag(vals);a=direct(phi,B);b=direct(phi@Q,Q.T@B@Q)
|
||||
np.testing.assert_allclose(a,b,rtol=1e-13,atol=1e-13)
|
||||
np.testing.assert_allclose(a,direct(phi*np.array([-1,1]),B),rtol=1e-13)
|
||||
self.assertGreater(np.max(np.abs(direct(phi@Q,B)-direct(phi,B))),1e-9)
|
||||
def test_sparse_projected_solver(self):
|
||||
n=7;x=np.array([(i,j,k) for i in range(n) for j in range(n) for k in range(n)],float)
|
||||
ix=lambda i,j,k:(i*n+j)*n+k
|
||||
tet=[]
|
||||
for i in range(n-1):
|
||||
for j in range(n-1):
|
||||
for k in range(n-1):
|
||||
corners=[ix(i,j,k),ix(i+1,j,k),ix(i+1,j+1,k),ix(i,j+1,k),ix(i,j,k+1),ix(i+1,j,k+1),ix(i+1,j+1,k+1),ix(i,j+1,k+1)]
|
||||
tet.extend([[corners[a] for a in t] for t in [(0,1,2,6),(0,2,3,6),(0,3,7,6),(0,7,4,6),(0,4,5,6),(0,5,1,6)]])
|
||||
H,r=hks(x,np.array(tet));self.assertEqual(H.shape,(343,3));self.assertFalse(r['spectrum_exhausted'])
|
||||
self.assertGreater(r['next_eigenvalue'],r['positive_values'][-1])
|
||||
def test_degenerate_and_mass_failure(self):
|
||||
with self.assertRaises(ValueError):assemble(TET,[[0,1,2,2]])
|
||||
with self.assertRaises(ValueError):assemble(np.vstack([TET,[8,9,10]]),[[0,1,2,3]])
|
||||
def test_weighted_partial_qr(self):
|
||||
rng=np.random.default_rng(7);x=rng.normal(size=(200,19));z=rng.normal(size=200)
|
||||
y=3*x[:,0]+z;H=np.column_stack([2*x[:,1]+z,np.ones(200),rng.normal(size=200)])
|
||||
w=np.r_[np.full(50,.5/50),np.full(150,.5/150)]
|
||||
block=np.column_stack([np.ones(200),x,y,H])*np.sqrt(w[:,None]);R=None
|
||||
for chunk in np.array_split(block,7):R=tsqr_update(R,chunk)
|
||||
actual=partial_from_triangular(R)
|
||||
self.assertAlmostEqual(actual['signed_r'][0],1.,places=12);self.assertIsNone(actual['signed_r'][1])
|
||||
residual=block[:,20:]-block[:,:20]@np.linalg.lstsq(block[:,:20],block[:,20:],rcond=None)[0]
|
||||
expected=np.dot(residual[:,0],residual[:,3])/np.linalg.norm(residual[:,0])/np.linalg.norm(residual[:,3])
|
||||
self.assertAlmostEqual(actual['signed_r'][2],expected,places=12)
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
@@ -0,0 +1,28 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import xgboost as xgb
|
||||
from phase2_b7_gate import sample_ids,dense_rank,check_ranker,PARAMS,gate
|
||||
|
||||
class Acceptance(unittest.TestCase):
|
||||
def test_sampling_and_ties(self):
|
||||
raw=np.arange(10000)*3
|
||||
ids=sample_ids(raw)
|
||||
self.assertEqual(len(ids),2048);self.assertEqual(ids[0],0);self.assertEqual(ids[-1],9999)
|
||||
self.assertTrue(np.all(np.diff(ids)>0))
|
||||
np.testing.assert_array_equal(dense_rank([4,2,4,1]),[2,1,2,0])
|
||||
with self.assertRaises(ValueError):sample_ids([2,1])
|
||||
with self.assertRaises(ValueError):dense_rank([1,np.nan])
|
||||
def test_actual_pairwise_support(self):
|
||||
x=np.arange(60,dtype=np.float32).reshape(20,3)
|
||||
y=np.tile(np.arange(10),2);qid=np.repeat([0,1],10)
|
||||
m=xgb.XGBRanker(**PARAMS);m.fit(x,y,qid=qid,verbose=False)
|
||||
check_ranker(m)
|
||||
self.assertEqual(m.get_booster().num_boosted_rounds(),100)
|
||||
self.assertTrue(np.isfinite(m.predict(x)).all())
|
||||
def test_final_or_gate(self):
|
||||
self.assertEqual(gate({'low':0},{'value':.009},[]),'PRUNE_THIS_FIXED_RANKER_RECIPE')
|
||||
self.assertEqual(gate({'low':-.1},{'value':.010},[]),'RETAIN_SINGLE_FOLD_FEASIBILITY')
|
||||
self.assertEqual(gate({'low':.001},{'value':-.1},[]),'RETAIN_SINGLE_FOLD_FEASIBILITY')
|
||||
self.assertEqual(gate({'low':.001},{'value':.1},['constant']),'PARK_UNDEFINED_OR_COVERAGE')
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
Reference in new issue
Block a user