BBoran commited on
Commit
f1fc3a0
·
verified ·
1 Parent(s): 7c01154

Publish current portable PACTBench release

Browse files

Mirror the reviewed PACTBench release: current documentation, code, published checkpoints, row-level artifacts, and registry. Validated with 47 unit tests and the 7,382-check artifact gate.

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +8 -0
  2. CONTRIBUTING.md +50 -0
  3. README.md +83 -134
  4. ckpt/hk/{l1_main_train30k_e10.pt → l1_main_train30k_e10_provenance_v2.pt} +2 -2
  5. ckpt/hk/l1_main_train30k_e10_provenance_v2.pt.sha256.json +7 -0
  6. ckpt/{isaac/l1_DEPRECATED_broken_default_norm_e10.pt → hk/l1_matched_foundation10k_seed0_e10.pt} +2 -2
  7. ckpt/hk/l1_matched_foundation10k_seed0_e10.pt.sha256.json +7 -0
  8. ckpt/isaac/{l1_main_fixed_e10.pt → l1_full_gradientfix_seed0_e10.pt} +2 -2
  9. ckpt/isaac/{l1_variant_norm_e10.pt → l1_full_gradientfix_validation_selected_seed0_e10.pt} +2 -2
  10. ckpt/isaac/l1_full_gradientfix_validation_selected_seed0_e10.pt.sha256.json +7 -0
  11. ckpt/isaac/l1_main_distance_scale_v2_e10.pt +3 -0
  12. ckpt/isaac/l1_main_distance_scale_v2_e10.pt.sha256.json +7 -0
  13. ckpt/{vrising/l1_main_resnet18_e10.pt → isaac/l1_matched_foundation9484_validation_selected_seed0_e10.pt} +1 -1
  14. ckpt/isaac/weight_sweep/l1_distance_w16_validation_seed0.pt +3 -0
  15. ckpt/isaac/weight_sweep/l1_distance_w2_validation_seed0.pt +3 -0
  16. ckpt/isaac/weight_sweep/l1_distance_w4_validation_seed0.pt +3 -0
  17. ckpt/isaac/weight_sweep/l1_distance_w8_validation_seed0.pt +3 -0
  18. ckpt/vrising/l1_dinov2_small_end_to_end_matched20.pt +3 -0
  19. ckpt/vrising/l1_dinov2_small_geom_stage1_e10.pt +3 -0
  20. ckpt/vrising/l1_main_resnet18_e10_provenance_v2.pt +3 -0
  21. ckpt/vrising/l1_main_resnet18_e10_provenance_v2.pt.sha256.json +7 -0
  22. docs/AUDIT_20260714.md +0 -72
  23. docs/BACKFILL_TODO.md +0 -134
  24. docs/CHECK_RECORD.md +0 -48
  25. docs/DATA.md +83 -0
  26. docs/EXPERIMENTS.md +170 -0
  27. docs/EXPERIMENT_CHECKLIST.md +0 -125
  28. docs/L2_EVAL_PLAN.md +0 -103
  29. docs/MAINTAINERS.md +88 -0
  30. docs/MIGRATION.md +0 -69
  31. docs/OLD_experiments_README.md +0 -149
  32. docs/README.md +0 -75
  33. docs/REPRODUCE.md +123 -68
  34. docs/VERIFICATION.md +0 -90
  35. docs/exp.md +0 -367
  36. docs/hk_experiment_checklist.md +0 -105
  37. docs/hk_experiment_plan.md +0 -238
  38. docs/legacy/OLD_l1_README.md +0 -79
  39. docs/legacy/OLD_l1_registry.json +0 -71
  40. docs/legacy/OLD_l2_README.md +0 -197
  41. docs/legacy/OLD_l2_registry.json +0 -80
  42. env.sh +2 -3
  43. evaluation/ablations/pact_eval_v1_20260709/vrising_experiment_status.md +0 -25
  44. games/hk/README.md +46 -88
  45. games/hk/config.json +5 -6
  46. games/hk/data/README.md +0 -14
  47. games/hk/l1/README.md +0 -8
  48. games/hk/l1/run_matched_foundation10k.sh +5 -0
  49. games/hk/l1/run_train30k_pipeline.sh +3 -3
  50. games/hk/l2/README.md +0 -50
.gitattributes CHANGED
@@ -37,3 +37,11 @@ results/hk/beliefs_l1_main_official_test.jsonl filter=lfs diff=lfs merge=lfs -te
37
  results/vrising/beliefs_l1_main_official_test.jsonl filter=lfs diff=lfs merge=lfs -text
38
  results/hk/beliefs_l1_main_official_test_v2.jsonl filter=lfs diff=lfs merge=lfs -text
39
  组会6_三游戏汇总.pptx filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
37
  results/vrising/beliefs_l1_main_official_test.jsonl filter=lfs diff=lfs merge=lfs -text
38
  results/hk/beliefs_l1_main_official_test_v2.jsonl filter=lfs diff=lfs merge=lfs -text
39
  组会6_三游戏汇总.pptx filter=lfs diff=lfs merge=lfs -text
40
+ pact/__pycache__/train_rgb_situation_net.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
41
+ pact/__pycache__/validate_pactbench.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
42
+ results/hk/beliefs_l1_main_official_test_compact_side_v1.jsonl filter=lfs diff=lfs merge=lfs -text
43
+ results/hk/beliefs_l1_main_train.jsonl filter=lfs diff=lfs merge=lfs -text
44
+ results/hk/eval_runs/L1-IMG-ABLATION/beliefs_rgb_shuffled_within_boss.jsonl filter=lfs diff=lfs merge=lfs -text
45
+ results/hk/experiments/beliefs_l1_matched_foundation10k_seed0_official_test10.jsonl filter=lfs diff=lfs merge=lfs -text
46
+ results/isaac/beliefs_l1_main_train.jsonl filter=lfs diff=lfs merge=lfs -text
47
+ results/vrising/eval_runs/L1-IMG-ABLATION/beliefs_rgb_shuffled_within_boss.jsonl filter=lfs diff=lfs merge=lfs -text
CONTRIBUTING.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to PACTBench
2
+
3
+ ## Development setup
4
+
5
+ ```bash
6
+ python3 -m venv .venv
7
+ source .venv/bin/activate
8
+ python3 -m pip install -r requirements.txt
9
+ ```
10
+
11
+ Before submitting a change, run:
12
+
13
+ ```bash
14
+ PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests -v
15
+ python3 pact/validate_pactbench.py --require_v5
16
+ ```
17
+
18
+ Shell entry points must also pass `bash -n`.
19
+
20
+ ## Code and experiment changes
21
+
22
+ - Put shared Python implementation in `pact/`.
23
+ - Keep per-game files in `games/<game>/` as thin wrappers and configuration.
24
+ - Do not hand-edit published aggregate values in `registry/registry.json`.
25
+ - A result is publishable only when its code, configuration, ordered rows,
26
+ metrics, model identity, and source identities are available to the gate.
27
+ - Keep unreviewed runs outside the published registry and README results. Follow
28
+ the review-isolation procedure in `docs/MAINTAINERS.md`.
29
+
30
+ ## Repository hygiene
31
+
32
+ Do not commit:
33
+
34
+ - API keys, access tokens, private endpoints, or credential files;
35
+ - machine-specific absolute paths in code or documentation;
36
+ - raw caches that can be rebuilt from documented inputs;
37
+ - internal reviews, meeting notes, temporary reports, or backup copies;
38
+ - new headline numbers that have not passed maintainer review.
39
+
40
+ Use environment variables for model paths, service URLs, and credentials.
41
+ Keep one canonical implementation for every runnable tool; avoid copied scripts
42
+ that can silently diverge.
43
+
44
+ ## Documentation
45
+
46
+ Update the narrowest relevant document. Dataset facts belong in `docs/DATA.md`,
47
+ experiment definitions and results in `docs/EXPERIMENTS.md`, commands in
48
+ `docs/REPRODUCE.md`, and game-specific entry points in the corresponding game
49
+ README. Historical reasoning and future experiment wish lists do not belong in
50
+ the release documentation.
README.md CHANGED
@@ -1,161 +1,110 @@
1
- # PACTBench — 三游戏分层实验目录
2
 
3
- 这是 PACT 实验的**唯一工作目录**。数据怎么造的、做了哪些实验、每个实验对应哪个 ckpt 和哪段代码,
4
- 全在这里,且**每条路径都被 `registry/build_registry.py` 逐条核验存在于磁盘**。新实验直接在这里做,不要另起炉灶。
5
 
6
- 三个游戏(V Rising / Hollow Knight / Isaac)**共用同一套流程、同一套 `obs` schema、同一套核心实验块**。
7
- 每个游戏的完整说明在各自的 README:
 
8
 
9
- | 游戏 | boss | 官方测试行数 | 说明 |
10
- |---|---:|---:|---|
11
- | [V Rising](games/vrising/README.md) | 3 | 8,075 | 主战场,消融最全(另有 3 项独有实验,见下)|
12
- | [Hollow Knight](games/hk/README.md) | 3 | 8,360 | 核心块齐 + 历史帧消融(独有)|
13
- | [Isaac](games/isaac/README.md) | 8 | 1,784 | 核心块齐,几何最难(像素量纲,见坑 ①)|
14
 
15
- ## 完整实验清单(权威来源)
16
 
17
- **`python3 registry/status.py` 是实验清单的唯一权威**——逐块显示三个游戏各自做没做、以及哪些是某游戏独有。
18
- 下面是当前快照(2026-07-14),迁移后请以 `status.py` 实时输出为准:
 
19
 
20
- | 实验块 | 目的 | V Rising | HK | Isaac |
21
- |---|---|:-:|:-:|:-:|
22
- | 数据审计与切分 | fight 级切分、零帧泄漏 | ✅ | ✅ | ✅ |
23
- | L1 主对比(视觉基线)| 优于冻结 DINOv2/VideoMAE probe | ✅ | ✅ | ✅ |
24
- | L1 预测可信度(无图先验)| 几何靠看图,非背训练分布 | ✅ | ✅ | ✅ |
25
- | L1 官方评测(主表)| L1 几何精度 / belief 接口可信 | ✅ | ✅ | ✅ |
26
- | L1 筛选字段(belief probe)| 紧凑 belief 够用、tracker 状态是关键 | ✅ | ✅ | ✅ |
27
- | L1 消融 img | 同"无图先验"配套的字段级分解 | ✅ | ✅ | ✅ |
28
- | L2 机制语义(compact+full)| L2 读机制推理而非背名字 | ✅ | ✅ | ✅ |
29
- | L2 图像模态消融 | 加当前帧不改变决策 | ✅ | ✅ | ✅ |
30
- | **L2 理由-决策对应(核心)** | 理由是否支持自己的决策(确定性审计+3负对照) | ✅ | ✅ | ✅ |
31
- | **L1 历史帧消融** | 几何主要由当前帧承载 | — | ✅(独有)| — |
32
- | **L2 模型消融(换 LLM)** | 可控性不随 LLM 变大而变好 | ✅(独有)| — | — |
33
- | **L1 延迟基准(batch=8)** | L1 快到能进闭环 | ✅(独有)| — | — |
34
- | CLIP 理由余弦诊断 | 负结果,已弃用(仅 V Rising 试过)| ✅(负)| — | — |
35
- | L2 决策质量(LLM judge)| 决策"好不好"(非"是否被语义控制")| ⏸ | ⏸ | ⏸ |
36
 
37
- 三游戏的**核心 8 块完全对齐**;独有项(历史帧 / 模型消融 / 延迟 / CLIP)与暂缓项(LLM judge,口径未定)如上标注,不隐藏缺口。
 
 
 
 
38
 
39
- ---
 
40
 
41
- ## 目录结构
42
 
43
- ```
44
- pactbench/
45
- ├── env.sh # source 它:设 BENCH + gemma endpoint
46
- ├── games/{vrising,hk,isaac}/
47
- │ ├── README.md # 该游戏:数据构造 / 实验 / ckpt / 代码 / 数字
48
- │ ├── config.json # 游戏配置(切分策略、L1 输入、L2 协议)
49
- │ ├── ontology.json # 动作/技能 ontology(从 render_view prompt 推出来的)
50
- │ ├── skill_library.json # 技能库:机制描述 + 冷却 + 时长(L2 的输入)
51
- │ ├── manifest.json # fight 级切分 manifest
52
- │ └── {data,l1,l2}/*.sh # ★ 跑实验的入口(薄壳)
53
- ├── pipelines/ # 正典 shell:薄壳最终调用的东西
54
- │ ├── l1/{train,eval,baselines}/
55
- │ └── l2/{run_semantic_views_*.sh, run_image_modality_ablation.sh, llm_judge/}
56
- ├── pact/ # 共享 python ���现(三个游戏同一份代码)
57
- │ └── deprecated/ # 废弃脚本,附说明,不要引用
58
- ├── ckpt/{vrising,hk,isaac}/ # ★ 训好的 ckpt(真文件)
59
- ├── results/{vrising,hk,isaac}/ # ★ 所有实验产物:metrics / beliefs / eval_runs / ablations
60
- ├── registry/ # registry.json(机器可读索引)+ build_registry.py + status.py
61
- ├── schemas/ # 跨游戏 schema(belief schema、director profiles)
62
- ├── data -> ../data # 软链:原始+processed 数据(105G,不占本目录)
63
- └── out -> ../out # 软链:RGB cache(60G,可分钟级重建)
64
- ```
65
 
66
- **为什么 data/ out/ 是软链**:它们是 165G 的大文件,且 `out/` 里全是可重建的 RGB cache。
67
- 真正的资产(代码、ckpt、指标、beliefs)都是本目录里的真文件,加起来不到 400 MB。
 
 
 
68
 
69
- ## 现在是什么状态
70
-
71
- ```bash
72
- python3 registry/status.py # 逐项状态表(哪个游戏的哪个实验块做完了)
73
- python3 registry/build_registry.py # 重新核验并生成 registry.json(改了实验就跑一次)
74
- ```
75
 
76
- `registry/build_registry.py` 会**核验每条路径真的存在、每个数字真的从它声称的 metrics 文件里读出来**;
77
- 查无此文件就报错退出。所以这个索引不可能和实际跑过的东西脱节。
 
 
 
78
 
79
- ## 怎么跑
80
 
81
  ```bash
82
- source env.sh # 工作目录 = BENCH 根
83
-
84
- # 数据(三个游戏同构)
85
- bash games/{game}/data/audit_dataset.sh # 审计 + 切分核验
86
- python3 games/{game}/data/build_metadata.py # ontology + 技能库(vrising 除外,见其 README)
87
- bash games/{game}/data/build_manifest.sh # fight 级切分 manifest
88
-
89
- # L1
90
- CUDA_VISIBLE_DEVICES=<gpu> bash games/{game}/l1/train_l1.sh
91
- bash games/{game}/l1/eval_official_from_ckpt.sh # 从 ckpt 评测(不训练,可共享 GPU)
92
-
93
- # L2(先起 gemma server)
94
- /dev_vepfs/junhaochen/envs/gemma4-venv/bin/python pact/gemma_server.py &
95
- bash games/{game}/l2/run_semantic_views.sh
96
  ```
97
 
98
- RGB cache **必须并行建**:`python3 pact/build_rgb_frame_cache.py --workers 32`。
99
- 串行建一个 8,360 样本的 cache 要约 2.5 小时,并行 138 秒(结果逐字节一致,已验证)。
100
 
101
- ---
102
-
103
- ## 数据是怎么构造的(三游戏共用)
104
-
105
- ```
106
- data/{game}/processed/{Boss}/
107
- dataset_manifest.json
108
- policy_view_fight{N}.jsonl ← 决策行:action + obs(dp / da / rel_angle / time_since / boss_hp_frac …)
109
- render_view_fight{N}.jsonl ← 渲染 prompt(技能机制描述的来源)
110
- video_fight{N}.mp4 ← 对应视频
111
  ```
112
 
113
- **切分是 fight 级的**:每个 boss fight 排序,最后 N 场作 test、前 M 场作 val、其余作 train。
114
- 切分单位是整场对局,所以训练/测试之间不存在同一场内的帧泄漏(三个游戏都逐行核验过,零越界样本)。
 
115
 
116
- **技能机制描述不是人手编的**:来自 `render_view` 里的 prompt 短语("boss_1 performs …");
117
- 冷却/时长统计直接来自 `policy_view` 的日志行。`build_game_metadata.py` 里只有 `MECHANICS` 表是每游戏特有的。
118
 
119
- ## L2 统一协议
 
 
 
 
 
 
 
 
 
120
 
121
- **compact 视图 + gemma-4-E2B-it + 温度 0 + 200 个分层状态 + 匿名技能 ID**,三种 prompt:完整 / 抹除描述 / 交换描述。
122
- 匿名技能 ID 是关键——它让模型没法靠技能名字猜,只能读机制描述做推理。
123
- 每个 L2 run 目录里都有三件套:`metrics.json` / `rows.jsonl` / `run_config.json`(溯源)。
124
 
125
- ---
126
-
127
- ## 两个必须知道的坑
128
-
129
- **① 距离量纲每个游戏不一样。** `obs.dp` 在 V Rising / HK 是引擎单位(0–15),在 Isaac 是**像素**(24–484,中位数 147)。
130
- 训练脚本原先把归一化常数写死为 30、预测 clamp `1.5 × 30 = 45` —— **任何 dp > 45 的游戏,预测都会被静默压平在 45**
131
- (Isaac 实测预测中位数 45.0,真值 146.5)。现已提为 CLI 参数,默认值不变(V Rising / HK 零影响):
132
-
133
- ```bash
134
- --distance_norm 1000.0 --distance_clamp 1.5 # Isaac 必须这样
 
 
135
  ```
136
 
137
- **接入第四个游戏时,先看它的 `obs.dp` 分布再定 `distance_norm`。**
138
-
139
- **② L2 的分层采样曾经是坏的(v1)。** `choose_rows` 原先只按 `(boss, dp_bin)` 分桶,而行是按 fight 排序的,
140
- 于是 200 个状态**全部塌缩到每个 boss 的第一场**,数字被高估。现已改为按 `(boss, fight, dp_bin)` 分层,
141
- `sample_set_id` = **`L2-SAMPLE-200-v2`**。**只引用 v2 的结果。**
142
-
143
- ## 已知缺口
144
-
145
- - **HK 的 `player_angle_bin` 分类头 acc = 0.0000**(连续角度 3.65° 正常)。是这个 bin 头本身坏了,**未修**。
146
- 不影响 L2(compact 视图不含该字段)。同一个头在 V Rising 是 0.72、Isaac 是 0.79。
147
- - **V Rising 的 RGB cache 已被磁盘写满时清除**。ckpt / beliefs / metrics 都在,**L2 仍可复现**;
148
- 重跑 L1 评测需先从 `data/processed`(38G,完好)重建 cache。
149
- - **L2 决策质量的评价口径未定**(LLM judge 在另一台机器上跑),三个游戏都是 `暂缓`。
150
-
151
- ## 不在这个目录里的东西
152
-
153
- V Rising 的 **L3/L4 闭环与世界模型**(GameMasterDiT 渲染、skill recognizer、closed-loop rollout)
154
- 留在旧的 `../` 目录,7-02 后没再动过。它是另一条线,本目录只管三游戏的 L1(理解)与 L2(决策)。
155
- 迁移细节与旧路径映射见 [docs/MIGRATION.md](docs/MIGRATION.md)。
156
-
157
- ## 检查记录(转交必读)
158
-
159
- 本仓库经过多轮独立复算与对抗式排查:**检查了什么、排除了哪些错误、还剩哪些必须诚实披露的口径**,
160
- 全部写在 [docs/CHECK_RECORD.md](docs/CHECK_RECORD.md)(技术细节见 [docs/AUDIT_20260714.md](docs/AUDIT_20260714.md))。
161
- 接手前请先读它——尤其是**基线口径**("专训小网 vs 冻结基础特征",非"架构 vs DINOv2")与各实验的残留边界。
 
1
+ # PACTBench
2
 
3
+ PACTBench evaluates a layered boss-control system across **V Rising**,
4
+ **Hollow Knight**, and **The Binding of Isaac**:
5
 
6
+ - **L1** converts causal RGB history into a compact, decision-facing belief.
7
+ - **L2** selects among anonymous skill options from the belief and the visible
8
+ skill-mechanics descriptions.
9
 
10
+ This directory is the release unit for code, checkpoints, published metrics,
11
+ and reproducibility metadata. Machine-readable publication state lives in
12
+ [`registry/registry.json`](registry/registry.json); prose never overrides the
13
+ registry or the referenced metric files.
 
14
 
15
+ ## Current release
16
 
17
+ The published snapshot uses fight-disjoint splits, the compact belief
18
+ interface, balanced-v3 L2 sampling, HP-free-v6 prompts, anonymous option IDs,
19
+ Gemma-4-E2B-it at temperature zero, and deterministic sample seed 0.
20
 
21
+ ### L1 official evaluation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ | Game | Test rows | Distance MAE | Angle MAE | Distance-bin accuracy | Angle-bin accuracy |
24
+ |---|---:|---:|---:|---:|---:|
25
+ | V Rising | 8,075 | 0.2620 | 11.7599° | 0.8320 | 0.7201 |
26
+ | Hollow Knight | 8,360 | 0.4680 | 3.6527° | 0.7261 | 0.9646 |
27
+ | Isaac | 1,784 | 9.0263 px | 29.6388° | 0.9036 | 0.8352 |
28
 
29
+ Isaac distance is measured in pixels and is not directly comparable to the
30
+ engine-unit distance used by the other two games.
31
 
32
+ ### L2 natural-ready semantic intervention
33
 
34
+ | Game | Valid paired states | Mean menu size | Menu-aware chance | Description-follow |
35
+ |---|---:|---:|---:|---:|
36
+ | V Rising | 200 | 4.875 | 21.93% | 67.0% |
37
+ | Hollow Knight | 200 | 5.370 | 18.78% | 79.5% |
38
+ | Isaac | 122 | 2.238 | 46.04% | 83.6% |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
+ The 200 source states are fixed before L2 outputs are read. Isaac has 122
41
+ valid semantic-swap pairs because the predefined intervention requires at
42
+ least two tracker-ready options; singleton menus are excluded before outcome
43
+ aggregation. The fixed two-choice controls are reported separately in
44
+ [`docs/EXPERIMENTS.md`](docs/EXPERIMENTS.md).
45
 
46
+ The L1 visual comparison is a comparison of complete training schemes:
47
+ PACT-L1 is task-trained end to end, whereas DINOv2-S and VideoMAE-B are frozen
48
+ pretrained backbones with trained probes. It is not an isolated backbone claim.
 
 
 
49
 
50
+ V Rising also includes a separate accepted L1 comparison experiment that trains
51
+ DINOv2-S end to end on the same ordered 18,068/8,075 rows and the matched PACT
52
+ two-stage recipe. In this configuration it remains less accurate and 48.79%
53
+ slower at batch 1 than PACT-L1; the evidence and claim scope are recorded in
54
+ [`docs/EXPERIMENTS.md`](docs/EXPERIMENTS.md#v-rising-end-to-end-dinov2-s-l1-comparison-experiment).
55
 
56
+ ## Quick start
57
 
58
  ```bash
59
+ cd pactbench
60
+ python3 -m venv .venv
61
+ source .venv/bin/activate
62
+ python3 -m pip install -r requirements.txt
63
+
64
+ python3 registry/status.py
65
+ PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests -v
66
+ python3 pact/validate_pactbench.py --require_v5
 
 
 
 
 
 
67
  ```
68
 
69
+ The full artifact gate should end with:
 
70
 
71
+ ```text
72
+ PACTBench gate: PASS (7382 checks)
 
 
 
 
 
 
 
 
73
  ```
74
 
75
+ Large raw data and RGB caches are exposed through `data -> ../data` and
76
+ `out -> ../out`. See the reproducibility guide before rebuilding or moving
77
+ them.
78
 
79
+ ## Documentation
 
80
 
81
+ | Document | Purpose |
82
+ |---|---|
83
+ | [`docs/DATA.md`](docs/DATA.md) | Data source, layout, schema, split, and audit rules |
84
+ | [`docs/EXPERIMENTS.md`](docs/EXPERIMENTS.md) | Exact protocols, published results, and claim scope |
85
+ | [`docs/REPRODUCE.md`](docs/REPRODUCE.md) | Environment, commands, expected artifacts, and release gate |
86
+ | [`docs/MAINTAINERS.md`](docs/MAINTAINERS.md) | Handoff, review isolation, registry update, and release procedure |
87
+ | [`games/vrising/README.md`](games/vrising/README.md) | V Rising entry points and artifacts |
88
+ | [`games/hk/README.md`](games/hk/README.md) | Hollow Knight entry points and artifacts |
89
+ | [`games/isaac/README.md`](games/isaac/README.md) | Isaac entry points and artifacts |
90
+ | [`pipelines/l2/llm_judge/README.md`](pipelines/l2/llm_judge/README.md) | External decision-quality judge protocol |
91
 
92
+ ## Repository layout
 
 
93
 
94
+ ```text
95
+ pactbench/
96
+ ├── games/{vrising,hk,isaac}/ # per-game configuration and thin entry points
97
+ ├── pipelines/ # shared shell pipelines
98
+ ├── pact/ # shared Python implementation
99
+ ├── ckpt/ # published L1 checkpoints
100
+ ├── results/ # published row-level and aggregate artifacts
101
+ ├── registry/ # machine-readable publication snapshot
102
+ ├── schemas/ # cross-game schemas
103
+ ├── tests/ # regression and provenance tests
104
+ ├── data -> ../data # large source/processed data
105
+ └── out -> ../out # rebuildable caches
106
  ```
107
 
108
+ The decision-quality LLM judge is intentionally run on a separate machine.
109
+ Its absence from the local deterministic gate does not change the publication
110
+ status of the local L1 and L2 intervention artifacts.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ckpt/hk/{l1_main_train30k_e10.pt → l1_main_train30k_e10_provenance_v2.pt} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7d3bb58d56c4a9f6cd9d46b3c02dfcd70b36cd55d93be499ec468910f3c21d99
3
- size 52294395
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94f794ec6f9a59b43ae95c848498eda38bb609f999a867214425d74bbb604019
3
+ size 52290187
ckpt/hk/l1_main_train30k_e10_provenance_v2.pt.sha256.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "identity": {
3
+ "size": 52290187,
4
+ "mtime_ns": 1784222948115395649
5
+ },
6
+ "sha256": "94f794ec6f9a59b43ae95c848498eda38bb609f999a867214425d74bbb604019"
7
+ }
ckpt/{isaac/l1_DEPRECATED_broken_default_norm_e10.pt → hk/l1_matched_foundation10k_seed0_e10.pt} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2b67e739ce66e4d989a4b41fd51ab984526cacf5fccb1572a47efd87f3b37b5a
3
- size 52292027
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9175df322abc57d765546858d008893d7dbb92fd47a181e41e410e9946575a86
3
+ size 52285499
ckpt/hk/l1_matched_foundation10k_seed0_e10.pt.sha256.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "identity": {
3
+ "size": 52285499,
4
+ "mtime_ns": 1784352040876326577
5
+ },
6
+ "sha256": "9175df322abc57d765546858d008893d7dbb92fd47a181e41e410e9946575a86"
7
+ }
ckpt/isaac/{l1_main_fixed_e10.pt → l1_full_gradientfix_seed0_e10.pt} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:775a53dd91d5c73a659956e5988a9588f29b882cc74d1d903e531bf37db9f5e0
3
- size 52284307
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b09473f7b4a2d846fa03a352a9b17f2d5c43a872369dbb9f2db808c5148be4b
3
+ size 52283195
ckpt/isaac/{l1_variant_norm_e10.pt → l1_full_gradientfix_validation_selected_seed0_e10.pt} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5a62e6aa5cda1e68dbb2923e1c5569fe7cff433ee213d418dc22780aab419dcb
3
- size 52284043
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd25533342963395bd8a251cc84a4a6ca2ae7e26201d2cab307c7f53ed4797de
3
+ size 52283259
ckpt/isaac/l1_full_gradientfix_validation_selected_seed0_e10.pt.sha256.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "identity": {
3
+ "size": 52283259,
4
+ "mtime_ns": 1784358217777012145
5
+ },
6
+ "sha256": "fd25533342963395bd8a251cc84a4a6ca2ae7e26201d2cab307c7f53ed4797de"
7
+ }
ckpt/isaac/l1_main_distance_scale_v2_e10.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3318896744914b5b5dbc91063ccfc61412d6eb7e6b322e4092b1c757f1473b1d
3
+ size 52283067
ckpt/isaac/l1_main_distance_scale_v2_e10.pt.sha256.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "identity": {
3
+ "size": 52283067,
4
+ "mtime_ns": 1784233413358911636
5
+ },
6
+ "sha256": "3318896744914b5b5dbc91063ccfc61412d6eb7e6b322e4092b1c757f1473b1d"
7
+ }
ckpt/{vrising/l1_main_resnet18_e10.pt → isaac/l1_matched_foundation9484_validation_selected_seed0_e10.pt} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ccd32dd52d7bbfaaa858ebc4de5a869468310210bed920f7b4ce8ef5945066f6
3
  size 52283323
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df7530cf7d80df87fca873fedd7ce6dd38a9a4e27e5bf6a37d21e87f300ab368
3
  size 52283323
ckpt/isaac/weight_sweep/l1_distance_w16_validation_seed0.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80a343234e8e1e7d4417c8907e915af65d1dd8d3d526dedf31f32507aea66b75
3
+ size 52283323
ckpt/isaac/weight_sweep/l1_distance_w2_validation_seed0.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:403c0bd5f7110425e2748b52dbc2edf2c5b4384c5aa905fc92cf7c101a5d1cdb
3
+ size 52283323
ckpt/isaac/weight_sweep/l1_distance_w4_validation_seed0.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7235293af5c5693c4b6690d39fbe81920ff69720e6e4482ff1dfbd63cc157325
3
+ size 52283323
ckpt/isaac/weight_sweep/l1_distance_w8_validation_seed0.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0e2dc0376c01c382da0ed280bf10ba198b5dbaba86a9cb1329ed9d56d589934
3
+ size 52283323
ckpt/vrising/l1_dinov2_small_end_to_end_matched20.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5fc5c18c585fdb19da1c3c680754616d1ef782d293434e9e61e2358d6b2f71cb
3
+ size 93876943
ckpt/vrising/l1_dinov2_small_geom_stage1_e10.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac2cb75bcb735e0cfb788789876bb0794506ad02de3286184c550bc9705d24a6
3
+ size 93875663
ckpt/vrising/l1_main_resnet18_e10_provenance_v2.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:904f0106e258391084573ccd8f6c8c607d4353607697e07ec2826f82bd579d00
3
+ size 52279115
ckpt/vrising/l1_main_resnet18_e10_provenance_v2.pt.sha256.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "identity": {
3
+ "size": 52279115,
4
+ "mtime_ns": 1784222849344310076
5
+ },
6
+ "sha256": "904f0106e258391084573ccd8f6c8c607d4353607697e07ec2826f82bd579d00"
7
+ }
docs/AUDIT_20260714.md DELETED
@@ -1,72 +0,0 @@
1
- # 全面审计报告(2026-07-14)
2
-
3
- 背景:L2 输入污染、基线单 boss 训练、manifest 被覆盖等连环问题暴露后,对**全部实验**按错误模式做结构化排查。
4
- 方法:按 7 类错误模式逐类扫描,每项给出证据;修复分「已修」「重跑中」「收口待办」。
5
-
6
- ## 一、实锤问题(全部已定位根因)
7
-
8
- | # | 问题 | 根因 | 状态 |
9
- |---|---|---|---|
10
- | P1 | HK/Isaac L2 输入 prev/hp 96-98% 错、大量跨boss | write_beliefs 无差别覆盖:未训练头(不在 loss_fields)输出顶掉 tracker 真值;一个键两种语义 | ✅已修(命名空间隔离+field_source)+v2过五闸门100%+**L2矩阵重跑中(v3)** |
11
- | P2 | 基线(DINOv2/VideoMAE)训练只见 1 个 boss | train_rows[:10000] 全局掐头+行按boss排序;HK=100%FalseKnight,Isaac=100%Dingle;评测集 75-81% 是未见boss → 对比不公平,PACT优势被夸大 | ✅已修(balanced_limit,与PACT同款)+**4任务公平重跑中** |
12
- | P3 | HK 官方 test10 manifest 被覆盖成 test3 | build_manifest.sh 写死 --test_count 3;**我 07-13 验证重跑时覆盖**(mtime 13:44);波及HK基线评测(2242)与HK probe | ✅manifest已恢复test10并逐项核对;shell默认改10 |
13
- | P4 | threshold KeyError 被兜底补丁盖掉 | 那个 KeyError 正是 P2「训练集缺boss」的直接症状,当时只修症状未追根因 | ⚠流程教训,已入闸门纪律 |
14
- | P5 | HK angle_bin 头 acc=0(训过但坏) | **根因今日锁定**:train 30k 里 center 类只有 1 个样本(HK横版几何few center)+逆频类权重→头塌缩恒预测center,eval 无center→0 | 已文档化;修复可选(重分桶/去权重),角度证据用连续头(3.65°) |
15
- | P6 | 我的核查器误报 V Rising 污染 | 检查器拿匿名ID对原始名 | ✅已纠;检查器负对照纪律建立 |
16
- | P7 | 历史:L2采样v1塌缩/量纲30/坏ckpt默认等 | 见 VERIFICATION.md | ✅早已修复 |
17
-
18
- ## 二、排查后确认干净(逐项验证,非推断)
19
-
20
- - **原始belief真值**:cache 全量 HK 8360+Isaac 1784,prev/hp 100% 真值、跨boss 0
21
- - **几何血缘**:distance_bin 三游戏均 value 派生(训练过的回归)→ L1 几何表合法;PPT p4 未报未训练头
22
- - **PACT-30k 均衡**:HK 14k/10k/11.6k 三boss、Isaac 八boss全有(cache builder 用 balanced_limit)
23
- - **skill_library 覆盖风险解除**:再生成逐字节一致(确定性函数);rationale 词法旁证 desc-follow≈100%
24
- - **V Rising L2 全线干净**:prev 200/200(经去匿名化核查);hp=high 为文档声明的已知局限
25
- - **污染v1 beliefs 消费者清查**:除已知 L2(重跑中)外无隐藏消费者;probe/无图/延迟/几何表不受污染
26
- - **截断扫描**:其余 [:limit] 均未激活(canonical 未用 limit)或本就是 fight 切分语义;probe eval limit 已卫生修复为 balanced
27
- - **cooldown 语义**:全默认行仅 0.4%/4.5%(开局行),非污染
28
- - **考卷盘点**:官方口径 8360/1784/8075;legacy test3=2242 仅用于 HK 历史帧消融(两臂同口径,内部一致)与 HK probe(将对齐重跑)
29
-
30
- ## 三、新增的结构性防线
31
-
32
- 1. **validate_beliefs.py 五闸门接入 L2 shell**:不过闸门拒跑(exit 3);负对照(污染文件必须FAIL)+正对照(VRising必须PASS)双向验证过
33
- 2. **一键一语义**:预测进 head_predictions 命名空间,field_source 记血缘,未训练头出口被结构性封死
34
- 3. **balanced_limit 统一**:基线与 PACT 同采样函数
35
- 4. **run_config 记录 skill_library/beliefs 的 sha256**(不再只存路径)
36
- 5. **入口幂等**:build_manifest 默认与正典一致;train shell 默认 BELIEF_OUT 指 v2
37
-
38
- ## 四、进行中/收口待办
39
-
40
- - L2 矩阵 v3:HK compact 200/200✓ full 169/200;Isaac compact 200/200✓ full 187/200;之后 img×2@60
41
- - 公平基线:4 任务抽特征中(processed 6041/10000 processed 4264/10000 processed 4001/9484 processed 3025/9484 )
42
- - 跑完后:HK probe 在 test10 重跑 → 理由对应重算 → 两组 A/B 对照表(污染vs干净、不公平vs公平) → registry(v1标CONTAMINATED,v3/公平版转正) → PPT p16/17/20/22/23/28/29/30 更新+勘误 → README×3
43
- - 未定项:LLM judge 口径(暂缓,非缺陷)
44
-
45
- ## 五、二轮排查新增(用户要求"检查所有实验步骤"时发现)
46
-
47
- | # | 问题 | 状态 |
48
- |---|---|---|
49
- | P8 | **单技能菜单上干预无定义**:正确 prev 被连招规则排出菜单后,Isaac 出现 47/200 单菜单;恒等 swap_mapping 使 follow 与 name-bias 同时恒真(v2 也有 9 行,被污染掩盖) | ✅ 已修:menu≥2 统一口径(evaluate_sample+summarize+by_boss 三层+rationale+img汇总),v2/v3 重算,自洽校验(follow≤change)全过 |
50
- | P9 | **by_boss 子聚合漏过滤**(主指标修了,分boss路径漏了→Monstro follow 96.7%>change 30% 自相矛盾) | ✅ 已修并复验 8 boss 全自洽 |
51
- | P10 | **V Rising 图像模态消融用的是 SAMPLE-v1 采样**(违反"只引用 v2";p10 数字来自塌缩采样) | 🔄 按 HK/Isaac 同款协议(v2采样@60配对)重跑中;完成后更新 p10 与 registry |
52
- | P11 | VR img shell 的 RUN_TAG 未定义(set -u 拦停,我早前补丁只加引用未加定义) | ✅ 已修 |
53
-
54
- **二轮补��验证(干净):** v2/v3 同一批 200 状态(A/B 有效);isaac img 子集(两视图)0 单菜单;p16/p20/p17/p21/p22/p23/p26/p28/p29/p30 全部更新为 v3/公平数字并渲染自查。
55
-
56
- ## 六、三轮排查(用户"再检查别留问题"+ skill library 单/多boss 追问时发现)
57
-
58
- 对抗式独立复算(4 路:L2语义/L1基线/理由+图像/PPT对账)。L2语义 6 正典运行全部指标从原始行 100% 精确复现;L1 基线 balanced_limit 全 boss 覆盖已复算确认(HK 3334/3333/3333;Isaac 7×1250+Gemini734,全 8 boss);train/test fight 三游戏零交集;PACT 主结果 eval n 与基线 n_eval 逐一吻合。新发现并修复:
59
-
60
- | # | 问题 | 影响 | 状态 |
61
- |---|---|---|---|
62
- | P12 | **理由实验入口 shell 仍指向 samplev2(污染)语义 rows**,输出也写 samplev2 目录 | registry/PPT 的 v3 理由数字是对的(产物 source_rows 指向 v3),但按文档入口复现会从污染输入重算 | ✅ 已修:shell 指向 v3 rows + v3 输出 tag;重跑到临时路径与正典逐位一致(HK recon 85.0/Isaac 58.2) |
63
- | P13 | **语义/图像入口 shell 默认 RUN_TAG=samplev2**(HK/Isaac 四个 shell) | 读的是干净 beliefs+强制闸门,故默认跑出的数据是干净的,但会写进 samplev2 目录→覆盖 A/B 污染存档且不重现 registry 的 v3 | ✅ 已改默认 samplev3(VR 保持 samplev2=正典) |
64
- | P14 | **图像 summarizer 的 within_modality 漏 menu≥2 过滤**(cross_modality 有,within 没有) | Isaac text_only follow 被 47 个单菜单行灌水到 0.835,实为 0.784 | ✅ 已修 summarizer 并重算 6 个 summary |
65
- | P15 | **图像消融 200-text vs 60-img 苹果比橘子**:60 img 采样状态更容易(HK 全200文本 follow 76.2% 但这 60 子集高达 93.3%),并排放会误导图像净效应 | 结论方向(图像无增益)不变,但"全线下滑"对 Isaac 不成立 | ✅ summarizer 新增 text_only_shared 公平块;PPT 改用同60口径+配对变化为主指标 |
66
- | P16 | 图像 SUMMARY_DIR 不含 RUN_TAG(shell 写 `_n60_seed0`,registry 指 `_samplev3_n60_seed0`) | 入口不重现 registry 目录 | ✅ 三个 image shell 的 SUMMARY_DIR 补 RUN_TAG,与 registry 对齐 |
67
-
68
- **图像消融诚实口径(重算后):** 同 60 状态 desc_follow — HK 93.3%→86.7%(降)、VR 82.4%→75.9%(降)、Isaac 60.0%→60.3%(持平);配对变化(full 描述加图改了多少决策)HK 3.3% / Isaac 12.1% / VR 10.0% → 有文本时图像基本被忽略,净效应至多中性、偶有噪声。
69
-
70
- **关于 skill library 单/多boss:** L2(gemma)始终用**每 boss 自己的技能表**构 menu(ready_menu 只从 `skill_lib[boss]` 取,无跨 boss)——不存在"单/多 boss library"开关。用户记忆中的单/多 boss 是**旧 GameMaster 像素 policy**(老 pact 目录,single-boss 头 vs joint no-boss 头),属 Decision Head 层,不在 pactbench L2 范畴。
71
-
72
- **未处理(非缺陷,已知):** Isaac 语义 rows 里 47 个单菜单行仍存 resume 前的过期行内 follow/name_bias 字段(聚合层已正确 menu≥2 剔除;分类器拒绝原地改正典 rows,风险仅限"有人绕过闸门裸重聚合",已文档告警)。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/BACKFILL_TODO.md DELETED
@@ -1,134 +0,0 @@
1
- # HK / Isaac 补做清单
2
-
3
- V Rising 做全了 8 个实验块,HK 和 Isaac 各只做了 3 个(数据 / L1 主结果 / L2 机制语义)。
4
- 下面是要补的,**按「性价比」排序**(先做便宜且能立刻出数的)。
5
-
6
- 现状(`python3 registry/status.py`):
7
-
8
- | 实验块 | V Rising | HK | Isaac |
9
- |---|---|---|---|
10
- | 数据审计与切分 | ✅ | ✅ | ✅ |
11
- | L1 官方评测(主结果) | ✅ | ✅ | ✅ |
12
- | L2 机制语义干预 | ✅ | ✅ | ✅ |
13
- | **① L1 消融 img(无图先验)** | ✅ | ❌ | ❌ |
14
- | **② L2 模态消融(图+文 vs 纯文)** | ✅ | ❌ | ❌ |
15
- | **③ L1 筛选字段(belief probe)** | ✅ | ❌ | ❌ |
16
- | **④ L1 主对比(DINOv2 / VideoMAE 基线)** | ✅ | ❌ | ❌ |
17
- | ⑤ L1 消融:历史帧 | ❌ | ✅ | ❌ |
18
- | ⑥ L2 决策质量(LLM judge) | ⏸ | ⏸ | ⏸ |
19
-
20
- ---
21
-
22
- ## ① L1 消融 img(无图先验)— **最便宜,先做这个**
23
-
24
- **要回答的问题**:L1 的几何预测是真的从图像里看出来的,还是靠训练集的全局先验就能猜到?
25
-
26
- - **代码**:`pact/eval_l1_no_image_no_engine_prior.py` → `pact/build_l1_img_ablation_summary.py`
27
- - **通用性**:✅ 纯 post-hoc,只读 `results/{game}/l1_main_official_test.json`,**已在 HK 上试跑通过**
28
- - **成本**:**CPU 秒级**,不需要 GPU、不需要重训
29
- - **要做的**:
30
- 1. 新建 `pipelines/l1/ablations/run_img_ablation_{hk,isaac}.sh`(照 V Rising 的 RUN_COMMANDS 抄)
31
- 2. `--test_set_id` 传对(HK = `TEST-OFFICIAL-8360`,Isaac = `TEST-OFFICIAL-1784`)
32
- 3. ⚠️ 脚本里 `train_set_id` 目前硬编码成 V Rising 的 `TRAIN-COVERED-18068`,要提成参数
33
- - **产出**:`results/{game}/eval_runs/*_L1-IMG-ABLATION_*/metrics.json`
34
- - **工作量**:**< 1 小时**
35
-
36
- ## ② L2 模态消融(文本 vs 文本+图像)— 便宜,且 gemma server 已在线
37
-
38
- **要回答的问题**:给 L2 额外看一眼当前 RGB 帧,决策会更好吗?(V Rising 的结论是这层已经不缺视觉信息)
39
-
40
- - **代码**:`pact/eval_l2_skill_description_intervention.py --input_modality text_image` + `pact/summarize_l2_image_modality_ablation.py`
41
- - **通用性**:✅ CLI 有 `--data_root` 和 `--input_modality`,**不用改代码**
42
- - **成本**:200 状态 × 3 变体 = 600 次 gemma vision 调用/游戏,**约 1–2 小时/游戏**(有 `--resume`)
43
- - **要做的**:照 `pipelines/l2/run_image_modality_ablation.sh` 复制出 hk / isaac 版,改 4 个路径
44
- (`--beliefs results/{game}/beliefs_l1_main_official_test.jsonl`、`--skill_library games/{game}/skill_library.json`、
45
- `--data_root data/{game}/processed`、text_rows 指向该游戏的 canonical L2 run)
46
- - **工作量**:**半天**(含跑)
47
-
48
- ## ③ L1 筛选字段(belief probe:compact vs overcomplete)— 需要改一处硬编码
49
-
50
- **要回答的问题**:belief schema 里哪些字段真的携带决策信息?紧凑 belief 是否优于过全 belief?
51
- (V Rising 的结论:oracle minimal 0.816 > full overcomplete 0.641)
52
-
53
- - **代码**:`pact/eval_l2_belief_policy.py`
54
- - **通用性**:⚠️ **有阻塞**。它 import `layered_belief.BOSSES`,而那是写死的 V Rising 三个 boss;
55
- `--boss` 的 choices 也绑在上面。需要把 boss 列表改成**从 manifest / ontology 推**(`train_rgb_situation_net.py`
56
- 已经是这么做的,照抄即可)。另外 `--manifest` 默认值也是 V Rising 的。
57
- - **成本**:改完之后训练只是个小 MLP probe(40 epoch,~8k 行),**分钟级**
58
- - **工作量**:**1 天**(主要是改代码 + 核对 feature_group 定义对 HK/Isaac 是否合理)
59
-
60
- ## ④ L1 主对比(DINOv2-S / VideoMAE-B 视觉基线)— 最贵,但代码是通的
61
-
62
- **要回答的问题**:PACT-L1(ResNet18+GRU,5 帧)比冻结的视觉基础模型 probe 强多少?
63
-
64
- - **代码**:`pact/eval_l1_foundation_baselines.py`(抽特征)→ `pact/retrain_l1_foundation_probe_from_cache.py`(训 probe)
65
- - **通用性**:✅ CLI 有 `--manifest / --processed_root / --feature_dir`,且内部走 `collect_decision_samples(manifest, ...)`
66
- —— **manifest 驱动,不依赖写死的 boss 列表**。V Rising 的这条链今天刚重跑验证过 ✓
67
- - **成本**:**最贵的一步是抽特征**(要解码视频 + ViT 前向):
68
- HK ≈ 30k train + 8.4k test,Isaac ≈ 27k train + 1.8k test,**估计各 2–4 小时 GPU**;
69
- 之后 probe 训练 30 epoch 是分钟级。特征 cache 每个约 100–200 MB。
70
- - **要做的**:新建 `pipelines/l1/baselines/run_foundation_baselines_{hk,isaac}.sh`,传对 manifest / processed_root / feature_dir
71
- - **工作量**:**1–2 天**(大头是 GPU 排队)
72
- - ⚠️ **磁盘**:现在 `/dev_vepfs` 只剩 238G(99% 满)。特征 cache 不大,但跑之前先确认还有空间。
73
-
74
- ## ⑤(可选)Isaac 的历史帧消融
75
-
76
- HK 已经做了(结论:几何主要由当前帧承载,去掉历史 MAE 只退化 6%)。Isaac 的几何最难(角度 MAE 37.6°),
77
- 补一个能验证「这个��论是否跨游戏成立」。
78
-
79
- - **代码**:现成的 —— `bash games/isaac/l1/train_l1.sh` 传 `history_offsets=0`
80
- - **成本**:一次 L1 重训(GPU,约 1–2 小时)
81
- - **工作量**:**半天**(纯排队)
82
-
83
- ## ⑥ L2 决策质量(LLM judge)— 三个游戏都卡在同一处
84
-
85
- 不是 HK/Isaac 特有的缺口:**评价口径本身没定**,judge 在另一台机器上。
86
- `pipelines/l2/llm_judge/` 的脚本还引用 `out/layered/` 下的 legacy 中间产物。
87
- 建议**先把口径定下来再动手**,否则三个游戏都得返工。
88
-
89
- ---
90
-
91
- ## 建议的顺序
92
-
93
- 1. **①(< 1 小时)** → 立刻让 HK/Isaac 的 L1 多一个证据块
94
- 2. **②(半天)** → gemma server 现在就在线,趁热跑
95
- 3. **⑤(半天,纯排队)** → 顺手补 Isaac 的历史帧
96
- 4. **③(1 天)** → 要改 `layered_belief` 的 boss 硬编码,是这批里唯一的真代码活
97
- 5. **④(1–2 天)** → GPU 大头,最后做
98
- 6. **⑥** → 等口径
99
-
100
- ## 顺带该修的
101
-
102
- - **HK 的 `player_angle_bin` 分类头 acc = 0.0000**(连续角度 3.65° 正常)。要在论文里报 HK 的 L1 表,
103
- 这个头得修或明确说明。见 `games/hk/README.md`。
104
- - **V Rising 的 RGB cache 没了** → L1 评测跑不了。要重跑 V Rising 的 L1(或做 ①④ 的 V Rising 对照)
105
- 得先 `python3 pact/build_rgb_frame_cache.py --workers 32` 重建(~30G)。
106
-
107
- ---
108
-
109
- ## ⏸ 暂停快照(2026-07-13)
110
-
111
- **HK / Isaac 的 L2 `full` 视图跑到一半被暂停**(compact 视图三个游戏都已完成)。
112
-
113
- | | compact | full |
114
- |---|---|---|
115
- | V Rising | ✅ 85.7% | ✅ 77.4% |
116
- | HK | ✅ 89.8% | ⏸ **88/200 状态** |
117
- | Isaac | ✅ 73.0% | ⏸ **27/200 状态** |
118
-
119
- **恢复**(`rows.jsonl` 逐条 append,`--resume` 会跳过已完成的状态,不会重跑):
120
-
121
- ```bash
122
- source env.sh
123
- # 需要 gemma server 在线(127.0.0.1:8018)
124
- bash games/hk/l2/run_semantic_views.sh # compact 秒过(resume) → 接着跑 full
125
- bash games/isaac/l2/run_semantic_views.sh
126
- ```
127
-
128
- **关于速度(别再往并发上使劲了)**:瓶颈是 `pact/gemma_server.py` 用 batch=1 的 HF `generate`,
129
- 一次只处理一条。实测 1 并发和 12 并发吞吐一样(~0.2 req/s),GPU 利用率只有 26%、功耗 79W/400W —— 卡在空转。
130
- - 已做的缓解:客户端 `--workers`(默认 6)、`GEMMA_TIMEOUT=600` + `GEMMA_RETRIES=4`(并发排队会偶发超时,
131
- 以前一次超时就整个 run 崩掉)。
132
- - 真要提速:**多起几个 server 实例把 GPU 填满**(显存充裕,80G 只用了 12G),客户端 base_url 轮询;
133
- 或者在 server 端做 micro-batching(收益最大,但要改 server)。
134
- - 单 server 实测 ~0.24 req/s,双 server ~0.47 req/s,剩余 285 个状态 ≈ 30 分钟。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/CHECK_RECORD.md DELETED
@@ -1,48 +0,0 @@
1
- # PACTBench 检查记录(转交包)
2
-
3
- > 面向 coauthor:**检查了什么、排除了哪些错误、还剩哪些口径**。
4
- > 权威数字见 `registry/registry.json`(`python3 registry/build_registry.py` 自校验);技术细节见 [`AUDIT_20260714.md`](AUDIT_20260714.md);复现见 [`REPRODUCE.md`](REPRODUCE.md);闸门见 [`VERIFICATION.md`](VERIFICATION.md)。最后更新 2026-07-15。
5
-
6
- ## 检查方法
7
- 独立复算(从原始行重算、不信落盘 metrics,差 >0.5pt 即报)+ 对抗视角(主动找泄漏/未训练头/不公平基线/平凡解/口径不一致)+ 负对照纪律(判定器先在净/污两侧验证)+ 入口自洽(文档化 shell 默认能重现正典产物)。
8
-
9
- ## 已排除的错误(均已修复并复验)
10
- | 错误 | 表现 | 修复 |
11
- |---|---|---|
12
- | 未训练头污染 belief | `write_beliefs` 无差别覆盖,tracker 真值被随机头覆盖(HK/Isaac prev/hp 96%+ 错、跨 boss) | 命名空间隔离 + `field_source` 血缘 + 白名单;beliefs 过五闸门 100% |
13
- | 基线单 boss 训练 | `train_rows[:10000]` 掐 boss 排序行 → 只训一个 boss | 改 `balanced_limit` 全 boss 覆盖;旧版存档不引用 |
14
- | 考卷口径错位 | HK manifest 被覆盖成 test3(8360→2242) | 恢复 test10、改 shell 默认;train/test fight 零交集 |
15
- | 单菜单干预无定义 | Isaac 47/200 单菜单 → swap 恒等、follow/name-bias 恒真 | 五层统一 menu≥2;follow≤change 全 boss 复验 |
16
- | 入口 shell 指向污染 rows | rationale/semantic/image 默认仍指 samplev2 | 改指 v3、默认 samplev3;重跑与正典逐位一致 |
17
- | 图像 summarizer 漏 menu≥2 | Isaac text_only follow 灌水 0.835(实 0.784) | within_modality 补 menu≥2;重算 6 summary |
18
- | 图像消融苹果比橘子 | 200-text vs 60-img(60 子集更易) | 加 `text_only_shared` 公平块 + 配对变化为主指标 |
19
- | 判定器无对照 | 匿名 ID 被误判"跨 boss" | 判定器先净/污两侧验证;VR de-anon 后 200/200 正确 |
20
- | 量纲静默截断 | Isaac dp 像素被 clamp 在 45 | CLI `--distance_norm 1000`;主结果 MAE 10.06 证实正确 |
21
- | DukeOfFlies 解释错 | 匿名跑却称"名字泄漏" | 改为"机制近义/退回槽位先验 + 测量歧义" |
22
-
23
- ## 逐实验核查(全部复算通过)
24
- | 实验 | V Rising | HK | Isaac |
25
- |---|:--:|:--:|:--:|
26
- | 数据切分(fight 级、零交集) | ✅ | ✅ | ✅ |
27
- | L1 主结果 | ✅ | ✅¹ | ✅ |
28
- | L1 vs DINOv2/VideoMAE 基线 | ✅ | ✅ | ✅ |
29
- | L1 有图 vs 无图先验 | ✅ | — | — |
30
- | L1 历史帧消融 | — | ✅ | — |
31
- | L1 belief 字段 probe | ✅ | ✅ | ✅ |
32
- | L2 语义干预 | ✅ | ✅ | ✅ |
33
- | L2 图像模态消融 | ✅ | ✅ | ✅ |
34
- | L2 模型消融(换 LLM) | ✅ | — | — |
35
- | L2 理由-决策对应(核心) | ✅ | ✅ | ✅ |
36
- | L1 延迟基准 / CLIP 诊断 | ✅ | — | — |
37
-
38
- ¹ HK L1:连续角度 MAE 3.65° 正常,分桶头 `angle_bin` 因 1 个 center 样本塌缩为 0(死头,L2 compact 不使用,已标注)。
39
-
40
- 基线口径:命题限定为「任务专训的小网 > 冻结的通用视觉特征(作为 belief 抽取器)」,数据/历史/考卷已对齐(balanced 全 boss、同历史、同考卷)。
41
-
42
- ## 残留口径(非错误,诚实披露)
43
- - Isaac 的 L2 语义/理由**天生信号弱**(菜单小 K̄=2.83、随机基线高),主证据用 HK/VR。
44
- - 基线训练量 10k vs PACT 30k,饱和曲线待做。
45
- - L2 决策质量 LLM judge 暂缓(口径未定)。
46
-
47
- ## 结构性防线
48
- 五闸门接入 L2 shell(不过 exit 3 拒跑,含负对照)· run_config 记 sha256 血缘 · `balanced_limit` 全项目统一 · 入口默认对齐正典采样版 · registry 自校验。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/DATA.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Data
2
+
3
+ PACTBench expects the three game subsets distributed under the dataset
4
+ identifier `teawhite/vrising`. Check the dataset card and its current terms
5
+ before redistributing any raw game footage; this repository documents the
6
+ layout used by the experiments but does not itself grant rights to third-party
7
+ game content.
8
+
9
+ ## Processed layout
10
+
11
+ ```text
12
+ data/processed/<Boss>/ # V Rising
13
+ data/hk/processed/<Boss>/ # Hollow Knight
14
+ data/isaac/processed/<Boss>/ # Isaac
15
+
16
+ <Boss>/
17
+ ├── video_fight<N>.mp4
18
+ ├── policy_view_fight<N>.jsonl
19
+ ├── render_view_fight<N>.jsonl
20
+ └── dataset_manifest.json
21
+ ```
22
+
23
+ Each `policy_view` row is a boss decision with an action and observation. Each
24
+ `render_view` row supplies the aligned rendered prompt. Video, policy, and
25
+ render files are audited together by boss and fight.
26
+
27
+ ## Fight-disjoint splits
28
+
29
+ | Game | Bosses | Train fights | Validation fights | Test fights | Official test rows |
30
+ |---|---:|---:|---:|---:|---:|
31
+ | V Rising | 3 | 54 | 9 | 9 | 8,075 |
32
+ | Hollow Knight | 3 | 484 | 9 | 30 | 8,360 |
33
+ | Isaac | 8 | 4,858 | 24 | 80 | 1,784 |
34
+
35
+ Splits operate on complete fights. No fight appears in more than one split.
36
+ V Rising uses the last three fights per boss for test and the preceding three
37
+ for validation. Hollow Knight and Isaac use the last ten fights per boss for
38
+ test and the preceding three for validation.
39
+
40
+ V Rising has two manifests:
41
+
42
+ - `games/vrising/manifest.json` records the fight-level dataset split.
43
+ - `games/vrising/manifest_latent_covered.json` is the canonical L1 training
44
+ manifest and retains only fights with the required visual coverage.
45
+
46
+ ## Observation fields and units
47
+
48
+ Common policy observations include distance, angle, relative geometry,
49
+ previous-action timing, fight time, and boss/player state. The exact schema is
50
+ checked by the dataset audit and the belief validators.
51
+
52
+ - V Rising and Hollow Knight distance use engine units.
53
+ - Isaac `obs.dp` uses pixels (observed range 24--484; median about 147 px).
54
+ - Isaac L1 therefore fixes `distance_norm=1000` and `distance_clamp=1.5`.
55
+
56
+ ## Build and audit
57
+
58
+ Run from the `pactbench` root:
59
+
60
+ ```bash
61
+ bash games/vrising/data/audit_dataset.sh
62
+ bash games/vrising/data/build_manifest.sh
63
+
64
+ bash games/hk/data/audit_dataset.sh
65
+ python3 games/hk/data/build_metadata.py
66
+ bash games/hk/data/build_manifest.sh
67
+
68
+ bash games/isaac/data/audit_dataset.sh
69
+ python3 games/isaac/data/build_metadata.py
70
+ bash games/isaac/data/build_manifest.sh
71
+ ```
72
+
73
+ The audit outputs are:
74
+
75
+ ```text
76
+ results/vrising/dataset_audit.json
77
+ results/hk/dataset_audit.json
78
+ results/isaac/dataset_audit.json
79
+ ```
80
+
81
+ HK and Isaac metadata are derived from the processed policy/render rows.
82
+ V Rising uses the checked-in canonical `ontology.json` and
83
+ `skill_library.json`.
docs/EXPERIMENTS.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Experiments and Published Results
2
+
3
+ This document describes the results published by
4
+ `registry/registry.json`. Aggregate numbers are recomputed from the referenced
5
+ artifacts by the full release gate.
6
+
7
+ ## Common protocol
8
+
9
+ - Splits are fight-disjoint.
10
+ - L1 consumes five causal RGB frames at offsets `[-8,-4,-2,-1,0]`.
11
+ - L2 uses the compact belief interface and anonymous option IDs.
12
+ - The L2 model is Gemma-4-E2B-it revision `70af34e...`, temperature 0.
13
+ - balanced-v3 selects source states across boss, fight, and distance strata
14
+ before any L2 response is read.
15
+ - The prompt conditions are full mechanics, no mechanics, and swapped
16
+ mechanics. The word `full` in a run name refers to the full-description
17
+ prompt, not the deprecated full belief view.
18
+
19
+ ## L1 official evaluation
20
+
21
+ | Game | Test rows | Distance MAE | dp@2 | Angle MAE | angle@20° | Distance-bin acc. | Angle-bin acc. |
22
+ |---|---:|---:|---:|---:|---:|---:|---:|
23
+ | V Rising | 8,075 | 0.2620 | 0.9960 | 11.7599° | 0.8293 | 0.8320 | 0.7201 |
24
+ | Hollow Knight | 8,360 | 0.4680 | 0.9728 | 3.6527° | 0.9788 | 0.7261 | 0.9646 |
25
+ | Isaac | 1,784 | 9.0263 px | 0.1519 | 29.6388° | 0.6211 | 0.9036 | 0.8352 |
26
+
27
+ `dp@2` uses native distance units and is therefore not comparable between
28
+ Isaac and the other games.
29
+
30
+ ## L1 matched-data visual comparison
31
+
32
+ | Game | Method | Train rows | Distance MAE | Angle MAE | Distance-bin acc. | Angle-bin acc. |
33
+ |---|---|---:|---:|---:|---:|---:|
34
+ | V Rising | PACT-L1 | 18,068 | **0.2620** | **11.7599°** | **0.8320** | **0.7201** |
35
+ | | frozen DINOv2-S + probe | 18,068 | 0.6900 | 20.1532° | 0.6405 | 0.6041 |
36
+ | | frozen VideoMAE-B + probe | 18,068 | 0.6672 | 17.6564° | 0.6821 | 0.5948 |
37
+ | Hollow Knight | PACT-L1 | 10,000 | **0.5671** | **4.0899°** | **0.6940** | **0.9560** |
38
+ | | frozen DINOv2-S + probe | 10,000 | 0.8641 | 20.0433° | 0.5542 | 0.8276 |
39
+ | | frozen VideoMAE-B + probe | 10,000 | 1.0017 | 27.5987° | 0.4544 | 0.7100 |
40
+ | Isaac | PACT-L1 | 9,484 | **15.0472** | **39.6855°** | **0.8358** | **0.7848** |
41
+ | | frozen DINOv2-S + probe | 9,484 | 35.2852 | 77.7867° | 0.6015 | 0.6048 |
42
+ | | frozen VideoMAE-B + probe | 9,484 | 47.5451 | 84.9615° | 0.4608 | 0.5067 |
43
+
44
+ Every three-way comparison uses the same ordered training rows, official test
45
+ rows, resolution, and five-frame history within a game. PACT-L1 is task-trained
46
+ end to end; the two foundation baselines freeze their pretrained backbone and
47
+ train task probes. These results compare complete training schemes rather than
48
+ isolating backbone architecture.
49
+
50
+ ### V Rising end-to-end DINOv2-S L1 comparison experiment
51
+
52
+ This separate comparison makes the DINOv2-S backbone task-trainable and applies
53
+ the same published V Rising rows, five-frame history, task heads/losses, seed,
54
+ and two-stage 10+10 epoch schedule used by PACT-L1. Both methods are evaluated
55
+ on the same ordered 8,075 official test rows.
56
+
57
+ | Method | Parameters | Distance MAE | Angle MAE | Distance-bin acc. | Angle-bin acc. | A800 batch-1 latency |
58
+ |---|---:|---:|---:|---:|---:|---:|
59
+ | PACT-L1 | 13,040,742 | **0.2620** | **11.7599°** | **0.8320** | **0.7201** | **5.8497 ms** |
60
+ | DINOv2-S end to end | 23,443,622 | 0.8566 | 24.8192° | 0.5771 | 0.5845 | 8.7039 ms |
61
+
62
+ Under this matched recipe, DINOv2-S has 3.2695 times the distance error, 2.1105
63
+ times the angle error, and 48.79% higher model-forward latency. The latency
64
+ protocol uses AMP, 256 pre-decoded histories, 10 warm-up passes, and 20 measured
65
+ repeats; it includes CPU-to-GPU transfer and model-specific preprocessing but
66
+ excludes mp4 decoding. The measured 8.7039 ms is slower than PACT-L1 but does
67
+ not establish failure of a 60 Hz real-time budget on this A800.
68
+
69
+ The result does not mean that a larger pretrained model must be more accurate
70
+ after fine-tuning. In this implementation, the most likely explanation is a
71
+ training-recipe and spatial-interface mismatch:
72
+
73
+ - The PACT learning-rate schedule uses one shared learning rate for the
74
+ pretrained DINO backbone and the newly initialized task heads. The frozen
75
+ DINO probe obtains 0.6900 distance MAE and 20.1532° angle MAE, while the first
76
+ end-to-end stage at learning rate 3e-4 degrades to 0.9128 and 24.7542°; the
77
+ second stage recovers distance only to 0.8566. This is evidence that the
78
+ copied schedule over-updates the current DINO adaptation, although it is not
79
+ a one-factor causal ablation.
80
+ - The adapter retains one global CLS vector per frame and discards DINO patch
81
+ tokens. That removes localized spatial evidence that is useful for distance
82
+ and angle estimation.
83
+ - The native 192x336 frame is stretched to DINO's 224x224 square input, changing
84
+ the geometry seen by the model.
85
+
86
+ Accordingly, this experiment supports the conclusion that the evaluated
87
+ end-to-end DINOv2-S configuration is worse than PACT-L1 under the matched PACT
88
+ recipe. It is not a general upper bound on a DINOv2 system with separately
89
+ validated backbone/head learning rates, patch-token readout, and
90
+ aspect-ratio-preserving preprocessing. The machine-readable record is
91
+ `results/vrising/eval_runs/L1-DINOV2-END-TO-END-MATCHED20/comparison.json`.
92
+
93
+ ## L2 semantic intervention
94
+
95
+ Description-follow records whether the swapped-prompt decision follows the
96
+ mechanics moved to another anonymous option rather than retaining the original
97
+ option identity.
98
+
99
+ ### Natural-ready menus
100
+
101
+ | Game | Valid pairs | Mean K | Chance | No-description change | Swap change | Description-follow |
102
+ |---|---:|---:|---:|---:|---:|---:|
103
+ | V Rising | 200 | 4.875 | 21.93% | 46.0% | 79.5% | **67.0%** |
104
+ | Hollow Knight | 200 | 5.370 | 18.78% | 90.0% | 95.0% | **79.5%** |
105
+ | Isaac | 122 | 2.238 | 46.04% | 56.6% | 85.2% | **83.6%** |
106
+
107
+ The natural-ready menu is a deterministic benchmark tracker rule based on
108
+ logged re-fire lower bounds and previous-action constraints. It is not an
109
+ engine legality oracle. Isaac has fewer skills and smaller natural menus than
110
+ the other games. Its 122 valid pairs are the predefined `menu>=2` subset of the
111
+ 200 source states, not a selection based on model success.
112
+
113
+ ### Fixed two-choice control
114
+
115
+ | Game | Pairs | Chance | No-description change | Swap change | Description-follow |
116
+ |---|---:|---:|---:|---:|---:|
117
+ | Hollow Knight | 200 | 50.0% | 31.5% | 60.5% | 60.5% |
118
+ | Isaac | 200 | 50.0% | 39.0% | 54.0% | 54.0% |
119
+
120
+ The two-choice experiment is a fixed high-chance stress control. Hollow Knight
121
+ is above its 50% reference; Isaac is close to it. The cross-game result is the
122
+ eligible natural-ready intervention, while the two-choice table shows that the
123
+ effect depends on candidate-space construction.
124
+
125
+ ## Image-modality diagnostic
126
+
127
+ Text and text-plus-current-image conditions use the same states, prompt text,
128
+ and inference parameters.
129
+
130
+ | Game | Effective paired states | Text follow | Text + image follow | Original decision changed |
131
+ |---|---:|---:|---:|---:|
132
+ | V Rising | 60 | 60.0% | 65.0% | 21.7% |
133
+ | Hollow Knight | 60 | 78.3% | 80.0% | 3.3% |
134
+ | Isaac | 40 | 90.0% | 70.0% | 5.0% |
135
+
136
+ The observed direction is not uniform across games. This diagnostic measures
137
+ modality sensitivity and does not establish that adding an image always
138
+ improves semantic control.
139
+
140
+ ## Prompt-visible rationale correspondence
141
+
142
+ The deterministic audit checks whether the visible reason and mechanics cards
143
+ support reconstruction of the model's selected option. It does not inspect a
144
+ hidden chain of thought.
145
+
146
+ | Game | Valid pairs | Normal support | No-description support | Shuffled-reason support |
147
+ |---|---:|---:|---:|---:|
148
+ | V Rising | 200 | 93.5% | 3.5% | 3.7% |
149
+ | Hollow Knight | 200 | 94.5% | 0.0% | 2.6% |
150
+ | Isaac | 122 | 74.6% | 31.1% | 48.2% |
151
+
152
+ ## Game-specific completed analyses
153
+
154
+ - V Rising model ablation: description-follow is 67.0% for Gemma-4 E2B,
155
+ 64.5% for Gemma-3n E2B, and 56.0% for Gemma-4 E4B. Model size is not
156
+ monotonic with this metric.
157
+ - V Rising batch-8 latency on pre-decoded histories: PACT-L1 1.1440 ms,
158
+ frozen DINOv2-S + probe 4.3040 ms, and frozen VideoMAE-B + probe
159
+ 20.4469 ms per decision. This benchmark excludes video decoding.
160
+ - Hollow Knight current-frame ablation: on the fixed paired subset, distance
161
+ MAE changes from 0.5160 with five frames to 0.5478 with the current frame
162
+ only.
163
+
164
+ ## Decision-quality judge
165
+
166
+ The semantic intervention measures whether decisions respond to visible skill
167
+ mechanics. Tactical decision quality is a different question and is evaluated
168
+ by the external menu-level judge described in
169
+ `pipelines/l2/llm_judge/README.md`. External judge artifacts are not part of
170
+ the local deterministic registry until explicitly reviewed and synchronized.
docs/EXPERIMENT_CHECKLIST.md DELETED
@@ -1,125 +0,0 @@
1
- # PACT Experiment Checklist
2
-
3
- Last updated: 2026-07-09 08:12:54 UTC
4
-
5
- This checklist tracks the current three-game experiment plan and the concrete
6
- artifacts that should exist before a result is considered complete.
7
-
8
- ## Repository Layout
9
-
10
- | Item | Status | Path |
11
- |---|---|---|
12
- | Public game entry points | Done | `code/{vrising,hk,isaac}` |
13
- | Shared game configs | Done | `configs/games/{vrising,hk,isaac}.json` |
14
- | V Rising run commands | Done | `evaluation/ablations/pact_eval_v1_20260709/RUN_COMMANDS.md` |
15
- | V Rising status report | Done | `evaluation/ablations/pact_eval_v1_20260709/vrising_experiment_status.md` |
16
-
17
- ## V Rising
18
-
19
- Priority: current primary game.
20
-
21
- | Area | Status | Artifacts / Notes |
22
- |---|---|---|
23
- | Dataset audit | Done | `out/eval_runs/vrising_dataset_audit.json` |
24
- | Split manifest | Done | `out/layered/manifest_vrising.json` |
25
- | L1 main comparison | Done | See `evaluation/ablations/pact_eval_v1_20260709/vrising_experiment_status.md` |
26
- | L1 image ablation | Done | `evaluation/ablations/pact_eval_v1_20260709/l1/` |
27
- | L1 latency | Done | `out/situation/l1_visual_latency_benchmark_b8.json` |
28
- | L2 semantic intervention, full belief view | Done | `out/eval_runs/20260709_L2_L2-SEMANTIC-INTERVENTION_gemma-4-E2B-it_full_full-no_desc-swap_seed0/metrics.json` |
29
- | L2 semantic intervention, compact belief view | Done | `out/eval_runs/20260709_L2_L2-SEMANTIC-INTERVENTION_gemma-4-E2B-it_compact_full-no_desc-swap_seed0/metrics.json` |
30
- | L2 decision quality with LLM judge | Deferred | Not planned on this machine for now |
31
-
32
- Current V Rising L2 full-view metrics:
33
-
34
- | Metric | Value |
35
- |---|---:|
36
- | n | 200 |
37
- | no-desc decision change rate | 0.4372 |
38
- | swap-desc decision change rate | 0.8782 |
39
- | swap desc follow rate | 0.7868 |
40
- | swap name bias rate | 0.1218 |
41
-
42
- Current V Rising L2 compact-view metrics:
43
-
44
- | Metric | Value |
45
- |---|---:|
46
- | n | 200 |
47
- | no-desc decision change rate | 0.5435 |
48
- | swap-desc decision change rate | 0.9022 |
49
- | swap desc follow rate | 0.8587 |
50
- | swap name bias rate | 0.0978 |
51
-
52
- V Rising sessions completed at 2026-07-09 05:25:41 UTC. The finalizer rebuilt
53
- the status report and stopped the Gemma service.
54
-
55
- Active download sessions:
56
-
57
- ```bash
58
- tmux ls | rg 'pact_'
59
- tail -f out/eval_runs/20260709_hk_isaac_download.log
60
- ```
61
-
62
- ## Hollow Knight (`hk`)
63
-
64
- Priority: second game after V Rising L2 finishes or while data download is
65
- available.
66
-
67
- | Area | Status | Required Artifacts |
68
- |---|---|---|
69
- | Data download | Done | `data/hk/processed` -> `data/_hf_teawhite_vrising_hk_isaac/HK` |
70
- | Ontology | Done | `out/hk/ontology.json` |
71
- | Skill library | Done | `schemas/hk_skill_library.json` |
72
- | Dataset audit | Done | `out/eval_runs/hk_dataset_audit.json` |
73
- | Split manifest | Done | `out/hk/layered/manifest.json` |
74
- | L1 train/eval | Running: train30k cache + official test, then GPU2 training | `pact_hk_l1_train30k_gpu2`, log `out/hk/logs/20260709_hk_l1_train30k_gpu2.log` |
75
- | L2 semantic intervention | Blocked on L1 output and skill library | `code/hk/l2/run_semantic_views.sh` is a placeholder |
76
-
77
- Data-download owner: main process. The dataset repo is anonymously accessible.
78
- HK has 1,572 files across 3 entities. Dataset audit passed with zero warnings.
79
- The full HK train cache is 144,418 samples and about 130 GiB of raw uint8
80
- tensor data, so the active fast run uses a documented 30,000-sample train cache
81
- with the unchanged official test split. Treat this as `HK-L1 train30k`, not the
82
- final full-data HK result.
83
-
84
- Validation commands once data is available:
85
-
86
- ```bash
87
- bash code/hk/data/audit_dataset.sh
88
- bash code/hk/data/build_manifest.sh
89
- ```
90
-
91
- ## The Binding of Isaac (`isaac`)
92
-
93
- Priority: third game after V Rising L2 finishes or while data download is
94
- available.
95
-
96
- | Area | Status | Required Artifacts |
97
- |---|---|---|
98
- | Data download | Downloading with low-concurrency resume | `data/_hf_teawhite_vrising_hk_isaac/Isaac`, then linked to `data/isaac/processed` |
99
- | Ontology | Missing | `out/isaac/ontology.json` |
100
- | Skill library | Missing | `schemas/isaac_skill_library.json` |
101
- | Dataset audit | Blocked on data | `out/eval_runs/isaac_dataset_audit.json` |
102
- | Split manifest | Blocked on data and ontology | `out/isaac/layered/manifest.json` |
103
- | L1 train/eval | Blocked on processed data | `code/isaac/l1/train_l1.sh` is a placeholder |
104
- | L2 semantic intervention | Blocked on L1 output and skill library | `code/isaac/l2/run_semantic_views.sh` is a placeholder |
105
-
106
- Data-download owner: main process. The dataset repo is anonymously accessible.
107
- Isaac has 14,894 files across 8 entities and an estimated size of 22.73 GB.
108
- The first high-concurrency download hit HF 429 rate limits, so the current
109
- session `pact_hk_isaac_download` resumes Isaac only with `--max-workers 2`.
110
-
111
- Validation commands once data is available:
112
-
113
- ```bash
114
- bash code/isaac/data/audit_dataset.sh
115
- bash code/isaac/data/build_manifest.sh
116
- ```
117
-
118
- ## Current Blockers
119
-
120
- | Blocker | Impact | Owner / Next Action |
121
- |---|---|---|
122
- | `isaac` download is still running | Isaac audit, manifest, L1, and L2 wait for complete local files | Monitor `pact_hk_isaac_download` |
123
- | HK L1 train30k cache/training is running | HK L1 ablations and L2 handoff wait for training outputs | Monitor `pact_hk_l1_train30k_gpu2` |
124
- | `isaac` ontology and skill library are missing | Isaac manifest and L2 cannot run even if processed rows arrive without metadata | Derive or supply metadata after Isaac download |
125
- | Current GPUs are busy | Avoid starting extra heavy L1 jobs during large data download and existing cluster load | Queue heavy jobs after data audit succeeds |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/L2_EVAL_PLAN.md DELETED
@@ -1,103 +0,0 @@
1
- # L2 Evaluation Plan
2
-
3
- ## Claim Map
4
-
5
- | Claim | What It Proves | Main Evidence |
6
- |---|---|---|
7
- | C1: L2 decisions are semantically controlled by skill mechanics. | The model reads skill descriptions instead of choosing from name/order priors. | Anonymous-ID skill-description intervention. |
8
- | C2: L2 rationales support the selected decision. | The emitted reason is aligned with the selected skill and grounded in L1 belief/mechanics. | Rationale reconstruction and contradiction checks. |
9
- | C3: L2 rationales are not detached post-hoc text. | The reason can reconstruct or explain the selected decision under the same mechanics setting. | Rationale reconstruction + swapped-description rationale follow. |
10
-
11
- ## Paper Tables
12
-
13
- ### Table L2-A: Decision Semantic Control
14
-
15
- Status: partially complete. Gemma-4 anonymous-ID result is complete at `n=200`.
16
-
17
- | Row | Setting | Metrics |
18
- |---|---|---|
19
- | Gemma-4-E2B-it | Anonymous IDs, full/no-desc/swapped desc. | No-Desc Flip, Desc-Follow, Name-Bias |
20
- | Gemma-3n-E2B-it | Same setting, rerun `n=200`. | Same metrics |
21
- | Gemma-4 original skill names | Optional appendix/control. Existing `n=30` is pilot only. | Same metrics |
22
-
23
- Use the current Gemma-4 row as the main result:
24
-
25
- | Setting | n | No-Desc Flip | Desc-Follow | Name-Bias |
26
- |---|---:|---:|---:|---:|
27
- | Gemma-4, anonymous IDs | 200 | 54.0 [47.1, 60.8] | 76.0 [69.6, 81.4] | 14.0 [9.9, 19.5] |
28
-
29
- Interpretation: `Desc-Follow` is the primary metric. `Name-Bias` is the control.
30
-
31
- ### Panel L2-B: Rationale-Decision Consistency
32
-
33
- Status: complete for Gemma-4 anonymous-ID `n=200` rows.
34
-
35
- | Row | Setting | Metrics |
36
- |---|---|---|
37
- | Gemma-4-E2B-it | Anonymous IDs, full desc. | R->D Recon., Contradiction |
38
- | Gemma-4-E2B-it | Anonymous IDs, swapped desc. | R->D Recon., Rationale Desc-Follow, Contradiction |
39
- | Gemma-3n-E2B-it | Same as Gemma-4. | Same metrics |
40
-
41
- Definitions:
42
-
43
- - `R->D Recon.`: mask skill IDs in the rationale; an independent evaluator reconstructs the skill from rationale + L1 belief + menu.
44
- - `Rationale Desc-Follow`: under swapped descriptions, the rationale supports the swapped-in mechanics rather than the original skill meaning.
45
- - `Contradiction`: rationale contradicts L1 belief, cooldown, or selected mechanics.
46
-
47
- This table is the formal answer to whether reasoning and decision are aligned.
48
-
49
- ## Ablations
50
-
51
- ### Must-Run Ablations
52
-
53
- 1. **Model ablation: Gemma-4 vs Gemma-3n**
54
- - Same `n=200`, anonymous IDs, temperature 0.
55
- - Metrics: No-Desc Flip, Desc-Follow, Name-Bias, R->D Recon., Reason Ground.
56
- - Purpose: show whether the stronger LLM improves semantic control and rationale alignment.
57
-
58
- 2. **Description ablation: full vs no-desc vs swapped**
59
- - Already done for Gemma-4 decisions.
60
- - Needs rationale-side evaluation.
61
- - Purpose: this is the core reasoning intervention.
62
-
63
- 3. **Name leakage control: original names vs anonymous IDs**
64
- - Original names can be appendix unless rerun at `n=200`.
65
- - Purpose: show results do not come from skill-name priors.
66
-
67
- 4. **L1 belief ablation for rationale grounding**
68
- - Full L1 belief vs no distance vs no cooldown vs no previous skill.
69
- - Metrics: R->D Recon., Reason Ground., Contradiction.
70
- - Purpose: verify rationales use L1 information and fail gracefully when fields are removed.
71
-
72
- ### Nice-to-Have Ablations
73
-
74
- 1. **Temperature robustness**
75
- - `temperature=0` vs `0.3`, 3 seeds if stochastic.
76
- - Use appendix only.
77
-
78
- 2. **Evaluator robustness**
79
- - Rule evaluator vs LLM evaluator for rationale checks.
80
- - Use appendix to defend metric reliability.
81
-
82
- 3. **Per-boss failure analysis**
83
- - StoneBreaker needs qualitative inspection because `Desc-Follow=48.5%` and `Name-Bias=38.2%`.
84
- - Output: 4-6 examples showing ambiguous or overlapping mechanics.
85
-
86
- ## Run Order
87
-
88
- | Priority | Run | Output |
89
- |---|---|---|
90
- | 1 | Implement rationale evaluator on existing Gemma-4 `n=200` rows. | DONE: `out/layered/l2_rationale_consistency_gemma_anon_n200.json` |
91
- | 2 | Run Gemma-3n intervention at `n=200` anonymous IDs. | Table L2-A Gemma-3n row |
92
- | 3 | Run Gemma-3n rationale evaluator. | Table L2-B Gemma-3n rows |
93
- | 4 | Optional: rerun original-name Gemma-4 at `n=200`. | Appendix name-leakage control |
94
- | 5 | StoneBreaker failure analysis. | Appendix qualitative analysis |
95
-
96
- ## Main-Paper Recommendation
97
-
98
- Main paper should contain:
99
-
100
- 1. One formal L2 table with panel (a) semantic-control intervention and panel (b) rationale-decision consistency.
101
- 2. Gemma-3n as a model ablation in the same table after it is rerun.
102
-
103
- CLIP cosine should remain auxiliary/appendix only.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/MAINTAINERS.md ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Maintainer Handoff and Release Procedure
2
+
3
+ ## Sources of truth
4
+
5
+ Use this order when resolving conflicting information:
6
+
7
+ ```text
8
+ published row-level artifacts and metrics
9
+ > registry/registry.json
10
+ > docs/EXPERIMENTS.md
11
+ > root and game READMEs
12
+ ```
13
+
14
+ Documentation does not promote an experiment. Promotion happens only through
15
+ an accepted artifact set and a passing registry build.
16
+
17
+ ## Review isolation
18
+
19
+ Store an unreviewed run under:
20
+
21
+ ```text
22
+ experiments/pending_review/<run_id>/
23
+ ├── PLAN.md
24
+ ├── RUN_CONFIG.json
25
+ ├── metrics.json
26
+ ├── run.log
27
+ └── REVIEW.md
28
+ ```
29
+
30
+ Before `REVIEW.md` records `Decision: ACCEPT`, the run must not:
31
+
32
+ - update `registry/registry.json`;
33
+ - replace a published checkpoint or metric file;
34
+ - change headline tables in release documentation;
35
+ - enter a paper abstract, table, or conclusion;
36
+ - be described as a PACTBench result.
37
+
38
+ An accepted review should identify the exact claim, baseline, data rows,
39
+ checkpoint, seed, metric implementation, latency boundary if applicable, and
40
+ the artifact paths to publish.
41
+
42
+ ## Adding or updating an experiment
43
+
44
+ 1. Fix the question, comparison, sample set, metrics, and acceptance rule before
45
+ reading the new output.
46
+ 2. Use a game wrapper under `games/<game>/` and shared implementation under
47
+ `pact/` or `pipelines/`.
48
+ 3. Write ordered rows, run configuration, model identity, source identities,
49
+ and aggregate metrics.
50
+ 4. Add focused regression tests for new provenance or metric rules.
51
+ 5. Run unit tests and the full artifact gate.
52
+ 6. Review the artifacts and record the decision.
53
+ 7. Update `registry/build_registry.py` if a new published field is required.
54
+ 8. Run `python3 registry/build_registry.py`; never hand-edit the generated
55
+ registry.
56
+ 9. Update only the relevant current documentation.
57
+
58
+ ## Adding a game
59
+
60
+ A game release requires:
61
+
62
+ - `games/<game>/config.json`, `ontology.json`, `skill_library.json`, and a
63
+ fight-level manifest;
64
+ - processed video, policy, render, and dataset-manifest alignment;
65
+ - L1 train/eval wrappers and a published checkpoint with strict provenance;
66
+ - a compact L1 handoff consumed by L2;
67
+ - deterministic L2 source-state selection and row-level outputs;
68
+ - registry entries and full-gate validation;
69
+ - one game README containing only game-specific paths and parameters.
70
+
71
+ ## Release checklist
72
+
73
+ - All current Markdown links and literal commands resolve.
74
+ - Python files parse and shell files pass `bash -n`.
75
+ - Regression tests pass with bytecode generation disabled.
76
+ - `python3 pact/validate_pactbench.py --require_v5` passes.
77
+ - `python3 registry/build_registry.py` succeeds atomically.
78
+ - Published numbers match the rebuilt registry and metric files.
79
+ - No private absolute paths, credentials, internal reviews, backups, or meeting
80
+ materials are included in the release package.
81
+ - Data redistribution terms, repository license, citation metadata, and author
82
+ information have been approved by the maintainers.
83
+
84
+ ## Current external boundary
85
+
86
+ The decision-quality judge runs on a separate machine. Its credentials and
87
+ deployment are not part of the local release gate. Synchronize only reviewed
88
+ judge rows, configuration, and summaries; never copy service credentials.
docs/MIGRATION.md DELETED
@@ -1,69 +0,0 @@
1
- # 迁移记录(2026-07-13)
2
-
3
- 把三游戏 L1/L2 主线从旧 `pact/` 的散装结构(`code/` + `scripts/` + `evaluation/` + `out/` + `schemas/` + `configs/` + `experiments/`)
4
- 收敛成自包含的 `pactbench/`。之后所有实验在 `pactbench/` 里做。
5
-
6
- ## 原则
7
-
8
- - **代码、ckpt、指标是真文件,搬进来**(加起来 < 400 MB)。
9
- - **数据和 RGB cache 是软链**(165 G,且 cache 可分钟级重建),不复制。
10
- - **每个被搬走的旧位置都留了一个软链回指新位置** —— 留在旧 pact 的 65 个 legacy 脚本(渲染 / 闭环 / 画图)
11
- 有 15 个反向 import 了主线模块,靠这些回链继续工作。所以这次迁移**没有破坏任何旧代码**。
12
-
13
- ## 路径映射
14
-
15
- | 旧位置 | 新位置 |
16
- |---|---|
17
- | `scripts/{33 个主线 py}` | `pact/` |
18
- | `src/layered_belief.py` | `pact/layered_belief.py` |
19
- | `scripts/deprecated/` | `pact/deprecated/` |
20
- | `evaluation/ablations/*/scripts/{5 个消融 py}` | `pact/` |
21
- | `code/{game}/{data,l1,l2}/*.sh` | `games/{game}/{data,l1,l2}/*.sh` |
22
- | `evaluation/l1/{train,eval,baselines}/*.sh` | `pipelines/l1/{train,eval,baselines}/` |
23
- | `evaluation/ablations/pact_eval_v1_20260709/l2/*.sh` | `pipelines/l2/` |
24
- | `evaluation/l2/llm_judge_package/` | `pipelines/l2/llm_judge/` |
25
- | `configs/games/{game}.json` | `games/{game}/config.json` |
26
- | `schemas/{,hk_,isaac_}skill_library.json` | `games/{game}/skill_library.json` |
27
- | `out/{game}/ontology.json` | `games/{game}/ontology.json` |
28
- | `out/{game}/layered/manifest.json` | `games/{game}/manifest.json` |
29
- | `out/{game}/situation/*.pt`(ckpt) | `ckpt/{game}/l1_*.pt`(**重命名为可读名字**) |
30
- | `out/{game}/situation/*_official_test.json{,l}` | `results/{game}/l1_*.json`、`beliefs_*.jsonl` |
31
- | `out/{game}/eval_runs/` | `results/{game}/eval_runs/` |
32
- | `out/eval_runs/{game}_dataset_audit.json` | `results/{game}/dataset_audit.json` |
33
- | `evaluation/ablations/{img_input_20260708,pact_eval_v1_20260709}/` | `results/vrising/ablations/` |
34
- | `experiments/{registry.json,build_registry.py,status.py}` | `registry/` |
35
-
36
- ckpt 重命名对照:
37
-
38
- | 旧文件名 | 新文件名 |
39
- |---|---|
40
- | `raw_rgb_resnet18_decision_finetune_from_dp_current0_e10.pt` | `ckpt/vrising/l1_main_resnet18_e10.pt` |
41
- | `raw_rgb_resnet18_decision_train30k_from_dp_current0_e10.pt`(hk) | `ckpt/hk/l1_main_train30k_e10.pt` |
42
- | `hk_l1_curframeonly_e10.pt` | `ckpt/hk/l1_ablation_curframeonly_e10.pt` |
43
- | `isaac_l1_fixed_e10.pt` | `ckpt/isaac/l1_main_fixed_e10.pt` |
44
- | `isaac_l1_norm_e10.pt` | `ckpt/isaac/l1_variant_norm_e10.pt` |
45
- | `raw_rgb_resnet18_decision_train30k_from_dp_current0_e10.pt`(isaac) | `ckpt/isaac/l1_DEPRECATED_broken_default_norm_e10.pt` |
46
-
47
- ## 没搬的
48
-
49
- - **V Rising 的 L3/L4 闭环与世界模型**:`../src/{closed_loop,closed_loop_ar,skill_recognizer,teacher,decision_head,render*}.py`、
50
- `../scripts/render_*.py`、`../out/closed_loop_*`。这批代码有十几处硬编码绝对路径(依赖 BoranTencent、DAR 的 Wan 权重),
51
- 7-02 后没再动过,属于另一条线。
52
- - **画图 / 论文 / PPT**:`../figures_*`、`../paper/`、`../standardslide/`、`../scripts/build_l1_*_assets.py` 等。
53
- - **data/ 与 RGB cache**:原地,通过 `pactbench/{data,out}` 软链访问。
54
-
55
- ## 校验
56
-
57
- 迁移后已验证:
58
-
59
- 1. `python3 registry/build_registry.py` —— **逐条核验新布局下每个路径真的存在**,通过 ✅
60
- 2. `python3 registry/status.py` —— 状态表正常输出
61
- 3. 三个游戏的 `games/{game}/data/audit_dataset.sh` **真跑通**,产物落在 `results/{game}/dataset_audit.json` ✅
62
- 4. 旧路径(如 `../out/hk/eval_runs/`、`../scripts/train_rgb_situation_net.py`)经回链仍可读 ✅
63
-
64
- ## 遗留
65
-
66
- - `pipelines/l2/{run_official_rationale_eval.sh, llm_judge/*.sh}` 和
67
- `pipelines/l1/baselines/retrain_foundation_probes_from_cache.sh` 仍引用 `out/layered/…` 下的
68
- legacy V Rising 中间产物(predictions / latent-covered manifest)。经 `out` 软链可用,但没有归位到 `results/`。
69
- 这几个脚本都属于「L2 决策质量评价(暂缓)」和 latent 时代的旧线,等真要用时再收拾。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/OLD_experiments_README.md DELETED
@@ -1,149 +0,0 @@
1
- # PACT 实验目录(三个游戏)
2
-
3
- 这是实验的**唯一权威索引**:数据怎么造的 → 做了哪些实验 → 对应哪个 ckpt → 对应哪段代码。
4
- 之后的新实验直接在这里登记,不要另起炉灶。
5
-
6
- - **`registry.json`** — 机器可读的全量索引。每个实验绑定它的数据、代码、ckpt、指标。
7
- - **`build_registry.py`** — 生成上面那个文件。**每条路径都会核验是否真的存在于磁盘,每个数字都从它声称的 metrics 文件里重新读出来**。查无此文件就报错退出,索引因此不可能和实际跑过的东西脱节。
8
-
9
- 改了实验后重新生成:
10
-
11
- ```bash
12
- python3 experiments/build_registry.py
13
- ```
14
-
15
- ---
16
-
17
- ## 1. 数据是怎么构造的
18
-
19
- 三个游戏共用同一套流程与同一套 `obs` schema(`dp` / `da` / `rel_angle` / `time_since` / `boss_hp_frac` / …)。
20
-
21
- ```
22
- data/{game}/processed/{Boss}/
23
- dataset_manifest.json
24
- policy_view_fight{N}.jsonl ← 决策行:action + obs
25
- render_view_fight{N}.jsonl ← 渲染 prompt(技能机制描述的来源)
26
- video_fight{N}.mp4 ← 对应视频
27
- ```
28
-
29
- | 步骤 | 代码 | 产物 |
30
- |---|---|---|
31
- | 1. 数据审计 | `code/{game}/data/audit_dataset.sh` | `results/vrising/eval_runs/{game}_dataset_audit.json` |
32
- | 2. ontology + 技能库 | `code/{game}/data/build_metadata.py` | `out/{game}/ontology.json`、`schemas/{game}_skill_library.json` |
33
- | 3. fight 级切分 manifest | `code/{game}/data/build_manifest.sh` | `out/{game}/layered/manifest.json` |
34
- | 4. RGB cache | `pact/build_rgb_frame_cache.py --workers 32` | `out/{game}/situation/raw_rgb_*.pt` |
35
-
36
- **切分规则**:fight 级。每个 boss 按 fight 排序,**最后 10 场作 test、前 3 场作 val、其余作 train**。
37
- 切分单位是整场对局,所以训练/测试之间不存在同一场内的帧泄漏(每个游戏都已逐行核验,零越界样本)。
38
-
39
- **技能机制描述的来源**:`render_view` 里的 prompt 短语("boss_1 performs …"),
40
- 而不是人手编的。冷却/时长统计直接来自 `policy_view` 的日志行。
41
- `build_metadata.py` 里只有 `MECHANICS` 表是每游戏特有的,其余推导逻辑共享于
42
- `pact/build_game_metadata.py`。
43
-
44
- **RGB cache 必须并行建**:`--workers 32`。串行版建一个 8,360 样本的 cache 要约 2.5 小时,
45
- 并行版 138 秒(结果逐字节一致,已验证)。默认 `--workers 1` 保留原行为。
46
-
47
- ### 三个游戏的切分规模
48
-
49
- | 游戏 | boss 数 | 总 fight | train / val / test | 官方测试行数 |
50
- |---|---|---|---|---|
51
- | V Rising | 3 | — | 18,068 训练行 | 8,075 |
52
- | Hollow Knight | 3 | 523 | 484 / 9 / 30 | 8,360 |
53
- | Isaac | 8 | 4,962 | 4,858 / 24 / 80 | 1,784 |
54
-
55
- ---
56
-
57
- ## 2. 做了哪些实验
58
-
59
- `canonical: true` 的是**当前对外引用的那一版**。其余是消融或已废弃的历史版本,登记但不引用。
60
-
61
- ### L1(局势理解)
62
-
63
- | 实验 id | 游戏 | ckpt | 说明 |
64
- |---|---|---|---|
65
- | `vrising-L1-main` ★ | V Rising | `ckpt/vrising/l1_main_resnet18_e10.pt` | 主结果 |
66
- | `hk-L1-main` ★ | HK | `ckpt/hk/l1_main_train30k_e10.pt` | 主结果,5 帧输入 |
67
- | `hk-L1-ablation-single-frame` | HK | `ckpt/hk/l1_ablation_curframeonly_e10.pt` | 消融:只输入当前帧 |
68
- | `isaac-L1-main` ★ | Isaac | `ckpt/isaac/l1_main_fixed_e10.pt` | 主结果,**修复量纲 bug 后** |
69
- | `isaac-L1-broken-default-norm` | Isaac | `out/isaac/situation/raw_rgb_resnet18_decision_train30k_from_dp_current0_e10.pt` | **已废弃**,保留作 bug 证据 |
70
-
71
- ### L2(技能机制语义干预)
72
-
73
- 统一协议:**compact 视图 + gemma-4-E2B-it + 温度 0 + 200 个分层状态 + 匿名技能 ID**,
74
- 三种 prompt:完整 / 抹除描述 / 交换描述。
75
-
76
- | 实验 id | 游戏 | 产物目录 |
77
- |---|---|---|
78
- | `vrising-L2-compact` ★ | V Rising | `results/vrising/eval_runs/…_compact_samplev2_…/` |
79
- | `vrising-L2-full` | V Rising | `results/vrising/eval_runs/…_full_samplev2_…/`(消融对照) |
80
- | `hk-L2-compact` ★ | HK | `results/hk/eval_runs/…_compact_test10_samplev2_…/` |
81
- | `isaac-L2-compact` ★ | Isaac | `results/isaac/eval_runs/…_compact_samplev2_…/` |
82
-
83
- 每个 L2 run 目录含三件套:`metrics.json` / `rows.jsonl` / `run_config.json`(溯源)。
84
-
85
- ---
86
-
87
- ## 3. 代码在哪
88
-
89
- 结构是**薄壳 → 正典 → 实现**三层,三个游戏完全同构:
90
-
91
- ```
92
- code/{game}/{data,l1,l2}/*.sh ← 150–190 字节薄壳,只做 cd ROOT + 调用正典
93
-
94
- pipelines/l1/train/*.sh ← L1 正典
95
- pipelines/l2/*.sh ← L2 正典
96
-
97
- pact/ ← 共享实现
98
- ```
99
-
100
- | 用途 | 入口(跑这个) |
101
- |---|---|
102
- | L1 训练 | `CUDA_VISIBLE_DEVICES=<gpu> bash code/{game}/l1/train_l1.sh` |
103
- | L1 从 ckpt 评测 | `bash code/{game}/l1/eval_official_from_ckpt.sh` |
104
- | L2 语义干预 | `bash code/{game}/l2/run_semantic_views.sh` |
105
-
106
- L2 需要先起 gemma server(`gemma4-venv` 环境,默认 `http://127.0.0.1:8018/v1`)。
107
-
108
- **核心实现**:
109
- - `pact/train_rgb_situation_net.py` — L1 训练/评测
110
- - `pact/build_rgb_frame_cache.py` — RGB cache(`--workers` 并行)
111
- - `pact/build_game_metadata.py` — 共享的 ontology/技能库推导
112
- - `pact/eval_l2_skill_description_intervention.py` — L2 语义干预
113
- - `pact/write_l2_run_config.py` — L2 溯源记录
114
-
115
- 已废弃的脚本在 `pact/deprecated/`,附说明。
116
-
117
- ---
118
-
119
- ## 4. 两个必须知道的坑
120
-
121
- **① 距离量纲是每游戏不同的。**
122
- `obs.dp` 在 V Rising / HK 是引擎单位(0–15),在 Isaac 是**像素**(24–484,中位数 147)。
123
- 训练脚本原先把归一化常数写死为 30、并把预测 clamp 在 `1.5 × 30 = 45`——
124
- **任何 dp > 45 的游戏,预测都会被静默压平在 45**(Isaac 实测预测中位数 45.0,真值 146.5)。
125
-
126
- 现已提为 CLI 参数,默认值不变(V Rising / HK 零影响):
127
-
128
- ```bash
129
- --distance_norm 1000.0 --distance_clamp 1.5 # Isaac 必须这样
130
- ```
131
-
132
- **接入第四个游戏时,先看它的 `obs.dp` 分布再定 `distance_norm`。**
133
-
134
- **② L2 的分层采样曾经是坏的(v1)。**
135
- `choose_rows` 原先只按 `(boss, dp_bin)` 分桶,而行是按 fight 排序的,
136
- 于是 200 个状态**全部塌缩到每个 boss 的第一场**。v1 的数字被高估。
137
- 现已改为按 `(boss, fight, dp_bin)` 分层,`sample_set_id` 升为 **`L2-SAMPLE-200-v2`**。
138
- **只引用 v2 的结果。**
139
-
140
- ---
141
-
142
- ## 5. 已知缺口
143
-
144
- - **HK 的 `player_angle_bin` 分类头 acc = 0.0000**(连续角度 3.65° 正常)。是这个 bin 头本身坏了,**未修**。
145
- 不影响 L2(compact 视图不含该字段)。同一个头在 V Rising 是 0.72、Isaac 是 0.79。
146
- - **V Rising 的 RGB cache 已被磁盘写满时清除**。ckpt / beliefs / metrics 都在,**L2 仍可复现**;
147
- 重跑 L1 评测需先从 `data/processed`(38G,完好)重建 cache。
148
- - HK / Isaac 未做:L1 视觉基线对比、belief probe、L2 图像模态消融(V Rising 已做)。
149
- - L2 决策质量的评价口径未定(LLM judge 在另一台机器进行)。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/README.md DELETED
@@ -1,75 +0,0 @@
1
- # Layered Evaluation Code Layout
2
-
3
- This directory is the normalized entry point for layer-by-layer evaluation.
4
- It does not replace the historical `scripts/` and `out/` files. Instead, each
5
- layer directory records the canonical code paths, artifacts, commands, metrics,
6
- and paper-table sources needed to reproduce and audit that layer.
7
-
8
- The reusable experiment protocol lives in `exp.md`. It defines the default
9
- train/test/sample settings for current and future L1/L2 experiments.
10
-
11
- ## Standard Layer Package
12
-
13
- Each layer should follow the same structure:
14
-
15
- ```text
16
- evaluation/
17
- l1/
18
- README.md # layer-specific story, metrics, and canonical commands
19
- registry.json # machine-readable map from names to scripts/artifacts
20
- model/ # model definitions or pointers to canonical source files
21
- train/ # training entry points, configs, and split notes
22
- eval/ # official evaluation commands and metric definitions
23
- baselines/ # comparison baselines and baseline-specific notes
24
- ckpt/ # checkpoint manifest; large ckpts stay under out/ or data/
25
- results/ # canonical result manifests; large outputs stay under out/
26
- ```
27
-
28
- The same layout should be used for `l2/`, `l3/`, and `l4/`.
29
-
30
- ## Storage Rules
31
-
32
- 1. Keep implementation code in one canonical place. If an old script is still
33
- the source of truth, reference it here instead of copying it.
34
- 2. Do not move large artifacts after paper tables have been generated. Store
35
- their paths and provenance in `registry.json`.
36
- 3. Separate smoke outputs from official outputs. Smoke files must not be used
37
- in paper tables.
38
- 4. Record train split, test split, input modality, checkpoint, and latency
39
- definition for every paper-table row.
40
- 5. A result used in a paper table must have:
41
- - a JSON/CSV metric file,
42
- - the exact script or wrapper that produced it,
43
- - the checkpoint or frozen feature cache used,
44
- - whether video decoding is included in latency.
45
-
46
- ## Naming Rules
47
-
48
- Use compact, stable names:
49
-
50
- ```text
51
- {layer}_{method}_{split}_{scope}.{ext}
52
- l1_pact_official_test.json
53
- l1_dinov2_covered_train_official_test.json
54
- l1_latency_b8.json
55
- ```
56
-
57
- Prefer relative paths from the repository root in docs and registries. Use
58
- absolute paths only in final responses or when needed by external tools.
59
-
60
- ## Metric Categories
61
-
62
- Layer evaluations should separate:
63
-
64
- - **Primary task metrics**: the values that support the paper claim.
65
- - **Interface checks**: schema validity, legality, handoff compatibility.
66
- - **Runtime metrics**: model-forward latency and throughput, with a clear note
67
- on whether decoding/rendering is included.
68
- - **Ablation/baseline metrics**: comparisons that isolate design choices.
69
-
70
- ## Paper Table Policy
71
-
72
- Main paper tables should be numeric and compact. Captions may describe split
73
- alignment and latency definitions, but table cells should not contain long
74
- explanations. Put narrative interpretation in the text or in layer README
75
- files.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/REPRODUCE.md CHANGED
@@ -1,100 +1,155 @@
1
- # 跨机器复现指南(打包清单)
2
 
3
- 审计日期 2026-07-14。结论:**pactbench 可以整体打包到另一台机器复现**——代码对旧 pact 无真实依赖
4
- (已验证:把 `src`/`out`/`data` 三个软链全部断开,9 个主线模块 import 全部从 `pact/` 自身解析成功)。
5
 
6
- ## 1. 打包什么
7
 
8
  ```bash
9
- cd pact
10
- tar czf pactbench_$(date +%Y%m%d).tar.gz \
11
- --exclude='pactbench/data' --exclude='pactbench/out' --exclude='pactbench/src' \
12
- --exclude='__pycache__' pactbench/
13
- # ≈ 400 MB:代码 + 6 个 ckpt + 全部 metrics/beliefs/eval_runs + registry + 文档
14
  ```
15
 
16
- 三个软链(`data`/`out`/`src`)**不打包**:`data` 在新机器重新下载(见 §3),`out` 全是可重建 cache,
17
- `src` 是旧 pact L4 闭环代码——主线不需要(几个脚本里的 `sys.path.insert(ROOT/"src")` 是历史残留死代码)。
18
 
19
- ## 2. 新机器上的环境
 
20
 
21
  ```bash
22
- pip install -r requirements.txt # 主环境(L1 + L2 客户端 + 数据构建)
23
- # gemma server 独立 venv(transformers 5.x 才有 Gemma4 类)——见 requirements.txt 尾部注释
 
24
  ```
25
 
26
- 会自动从 HF 下载的权重(无需手动搬):
27
- | 权重 | 用途 | 来源 |
28
- |---|---|---|
29
- | `google/gemma-4-E2B-it` | L2 决策器 | HF(或设 `GEMMA_MODEL_PATH` 指本地快照)|
30
- | `vit_small_patch14_dinov2.lvd142m` | L1 视觉基线 | timm/HF |
31
- | `MCG-NJU/videomae-base` | L1 视觉基线 | HF |
32
- | torchvision ResNet-18 (ImageNet) | L1 主模型 backbone | torchvision |
33
 
34
- ## 3. 数据
 
35
 
36
- 三个游戏的原始数据都在同一个 HF 数据集 **`teawhite/vrising`**(HK/Isaac 子目录):
 
 
 
 
 
37
 
38
  ```bash
39
- mkdir -p data
40
- python pact/download_isaac.py # 走 hf-mirror,绕开 snapshot_download 的 HEAD 风暴(见脚本头注释)
41
- # V Rising 的 processed(38G)同 repo;HK/Isaac 下载后按 games/{g}/config.json 的 processed_root 摆放
42
  ```
43
 
44
- 期望的目录形状(`data` 可以是软链):
 
 
 
45
  ```
46
- data/processed/{StoneBreaker,MilitiaLeader,ToadKing}/ # vrising
47
- data/hk/processed/{FalseKnight,HiveKnight,Hornet}/
48
- data/isaac/processed/{Dingle,...,Pin}/ # 8 boss
49
- 每个 boss 下: policy_view_fight{N}.jsonl + render_view_fight{N}.jsonl + video_fight{N}.mp4
 
 
 
 
 
 
 
 
50
  ```
51
 
52
- ## 4. ckpt 实验 ↔ 数据 setting 对照
53
 
54
- | ckpt(打包内)| 游戏 | 训练 setting | 对应评测入口 |
55
- |---|---|---|---|
56
- | `ckpt/vrising/l1_main_resnet18_e10.pt` | V Rising | train 18,068 行;`distance_norm=30`(默认);5 帧史 [-8,-4,-2,-1,0] 192×336 | `games/vrising/l1/eval_official_from_ckpt.sh`(需先重建 RGB cache)|
57
- | `ckpt/hk/l1_main_train30k_e10.pt` | HK | train 30,000 行;`distance_norm=30`;同 5 帧史 | `games/hk/l1/eval_official_from_ckpt.sh` |
58
- | `ckpt/hk/l1_ablation_curframeonly_e10.pt` | HK | 同上但 `history_offsets=0`(仅当前帧)| 历史帧消融对照 |
59
- | `ckpt/isaac/l1_main_fixed_e10.pt` | Isaac | train 26,984 行;**`distance_norm=1000 --distance_clamp 1.5`(必须)** | `games/isaac/l1/eval_official_from_ckpt.sh`(shell 已内置该参数)|
60
- | `ckpt/isaac/l1_variant_norm_e10.pt` | Isaac | 归一化变体 | 备用 |
61
- | `ckpt/isaac/l1_DEPRECATED_broken_default_norm_e10.pt` | Isaac | 量纲 bug 证据,勿引用 | — |
 
 
 
 
62
 
63
- 数据切分(fight 级、无帧泄漏,manifest 已打包在 `games/{g}/manifest.json`):
64
- | 游戏 | train/val/test fights | 官方测试行数 | L2 随机基线 |
65
- |---|---|---|---|
66
- | V Rising | 54 / 9 / 9 | 8,075 | 22.4% (K̄=4.86) |
67
- | HK | 484 / 9 / 30 | 8,360 | 29.2% (K̄=3.42) |
68
- | Isaac | 4,858 / 24 / 80 | 1,784 | 35.3% (K̄=2.83) |
69
 
70
- ## 5. 复现的三个层级(由浅入深)
 
 
 
71
 
72
- **L0 不跑任何模型即可核验**:`python3 registry/build_registry.py`(逐条核验路径+从 metrics 重读数字);
73
- 所有正式数字都在 `results/{game}/`,`registry/registry.json` 是总账。
74
 
75
- **L1 级 — 只需 GPU + 数据**:
76
  ```bash
77
- source env.sh
78
- bash games/{g}/data/audit_dataset.sh && python3 games/{g}/data/build_metadata.py && bash games/{g}/data/build_manifest.sh
79
- python3 pact/build_rgb_frame_cache.py --workers 32 ... # 重建 RGB cache(分钟级)
80
- CUDA_VISIBLE_DEVICES=<idle> bash games/{g}/l1/eval_official_from_ckpt.sh # 从打包 ckpt 复现 L1 表
81
- bash games/{g}/l1/run_img_ablation.sh # 无图先验(CPU 秒级,读打包的 metrics 即可跑)
82
- bash games/{g}/l1/run_belief_probe.sh # belief 字段筛选(CPU 分钟级)
83
- bash games/{g}/l1/run_foundation_baselines.sh # 视觉基线(抽特征较慢,自动 cache)
84
  ```
85
 
86
- **L2 额外需要 gemma server**:
 
 
 
87
  ```bash
88
- CUDA_VISIBLE_DEVICES=<idle> GEMMA_PORT=8018 gemma4-venv/bin/python pact/gemma_server.py &
89
- bash games/{g}/l2/run_semantic_views.sh # compact+full;--resume 会先逐位复现已打包的 rows
90
- bash games/{g}/l2/run_image_modality_ablation.sh # 图像模态(60 状态配对)
91
  ```
92
- L2 的输入 beliefs(`results/{g}/beliefs_l1_main_official_test.jsonl`)已打包,**不重训 L1 也能复现全部 L2 实验**。
93
 
94
- ## 6. 已知坑(新机器必读)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
- 1. **Isaac 距离是像素量纲**:任何训练/评测/基线都必须 `--distance_norm 1000`(相关 shell 已内置,手写命令别忘)。
97
- 2. **gemma server 必须用 transformers 5.x 的独立 venv**;主环境 4.51 没有 Gemma4 类。
98
- 3. **不要依赖 `${GROUPS:-...}` 这类 shell 默认值**:有的机器预设了 `GROUPS` 环境变量(本机就是 `GROUPS=1000`)。
99
- 4. HK 的 `player_angle_bin` 分类头恒输出(已知坏),HK 的角度证据用连续角度 MAE / dp_bin。
100
- 5. 各脚本对 server 的并发提速无效(server 是 batch=1 串行生成);要提速就多起 server 实例分流。
 
1
+ # Reproducing the Published PACTBench Snapshot
2
 
3
+ Run all commands from the `pactbench` directory.
 
4
 
5
+ ## 1. Environment
6
 
7
  ```bash
8
+ python3 -m venv .venv
9
+ source .venv/bin/activate
10
+ python3 -m pip install --upgrade pip
11
+ python3 -m pip install -r requirements.txt
 
12
  ```
13
 
14
+ The checked-in environment was validated with Python 3.13 and CUDA 12.x. The
15
+ L1 path uses the versions pinned in `requirements.txt`.
16
 
17
+ Gemma serving uses a separate environment because the server requires a newer
18
+ Transformers release than the L1 environment:
19
 
20
  ```bash
21
+ python3 -m venv .venv-gemma
22
+ .venv-gemma/bin/python -m pip install \
23
+ "transformers==5.13.0" "torch==2.5.1" accelerate pillow
24
  ```
25
 
26
+ ## 2. Data and caches
 
 
 
 
 
 
27
 
28
+ Make `data` point to the directory containing the processed layouts documented
29
+ in `docs/DATA.md`. The repository currently uses:
30
 
31
+ ```text
32
+ data -> ../data
33
+ out -> ../out
34
+ ```
35
+
36
+ Audit the available datasets before evaluation:
37
 
38
  ```bash
39
+ bash games/vrising/data/audit_dataset.sh
40
+ bash games/hk/data/audit_dataset.sh
41
+ bash games/isaac/data/audit_dataset.sh
42
  ```
43
 
44
+ RGB caches are rebuildable from processed videos:
45
+
46
+ ```bash
47
+ python3 pact/build_rgb_frame_cache.py --workers 32
48
  ```
49
+
50
+ The canonical cache paths and their content identities are recorded in the
51
+ published registry. The full gate rejects missing, stale, or mismatched caches.
52
+
53
+ ## 3. L1 evaluation
54
+
55
+ Evaluate the published checkpoints:
56
+
57
+ ```bash
58
+ bash games/vrising/l1/eval_official_from_ckpt.sh
59
+ bash games/hk/l1/eval_official_from_ckpt.sh
60
+ bash games/isaac/l1/eval_official_from_ckpt.sh
61
  ```
62
 
63
+ Run the matched frozen-foundation comparisons:
64
 
65
+ ```bash
66
+ bash games/vrising/l1/run_foundation_baselines.sh
67
+ bash games/hk/l1/run_foundation_baselines.sh
68
+ bash games/hk/l1/run_matched_foundation10k.sh
69
+ bash games/isaac/l1/run_foundation_baselines.sh
70
+ ```
71
+
72
+ Run the accepted V Rising end-to-end DINOv2-S L1 comparison experiment:
73
+
74
+ ```bash
75
+ bash games/vrising/l1/run_dinov2_end_to_end.sh
76
+ ```
77
 
78
+ The wrapper preserves accepted artifacts unless `FORCE_RERUN=1` is set and
79
+ writes the canonical metrics, batch-1 latency, and comparison summary under
80
+ `results/vrising/eval_runs/L1-DINOV2-END-TO-END-MATCHED20/`.
 
 
 
81
 
82
+ Isaac's matched PACT checkpoint is produced by
83
+ `pipelines/l1/train/run_isaac_matched_after_weight_selection.sh` after the
84
+ validation-only distance-weight selection. Published checkpoints and metrics
85
+ can be validated without retraining them.
86
 
87
+ The image-input controls are:
 
88
 
 
89
  ```bash
90
+ bash games/vrising/l1/run_img_ablation.sh
91
+ bash games/hk/l1/run_img_ablation.sh
92
+ bash games/isaac/l1/run_img_ablation.sh
 
 
 
 
93
  ```
94
 
95
+ ## 4. L2 service and evaluation
96
+
97
+ Start the pinned Gemma service with a local path or compatible model ID:
98
+
99
  ```bash
100
+ export GEMMA_MODEL_PATH=/path/to/gemma-4-E2B-it/revision-70af34e
101
+ export GEMMA_PORT=8018
102
+ .venv-gemma/bin/python pact/gemma_server.py
103
  ```
 
104
 
105
+ In another shell:
106
+
107
+ ```bash
108
+ export GEMMA_OPENAI_BASE_URL=http://127.0.0.1:8018/v1
109
+ export GEMMA_MODEL=gemma-4-E2B-it
110
+ export GEMMA_TEMPERATURE=0
111
+
112
+ bash games/vrising/l2/run_semantic_views.sh
113
+ bash games/hk/l2/run_semantic_views.sh
114
+ bash games/isaac/l2/run_semantic_views.sh
115
+ ```
116
+
117
+ Rationale correspondence and paired image-modality runs use:
118
+
119
+ ```bash
120
+ bash games/vrising/l2/run_rationale_consistency.sh
121
+ bash games/hk/l2/run_rationale_consistency.sh
122
+ bash games/isaac/l2/run_rationale_consistency.sh
123
+
124
+ bash games/vrising/l2/run_image_modality_ablation.sh
125
+ bash games/hk/l2/run_image_modality_ablation.sh
126
+ bash games/isaac/l2/run_image_modality_ablation.sh
127
+ ```
128
+
129
+ The Hollow Knight and Isaac fixed two-choice controls are selected through the
130
+ game wrapper environment variables documented in their game READMEs.
131
+
132
+ ## 5. Verify the release
133
+
134
+ ```bash
135
+ python3 registry/status.py
136
+ PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests -v
137
+ python3 pact/validate_pactbench.py --require_v5
138
+ ```
139
+
140
+ The current published snapshot passes 46 regression tests and 7,382 full-gate
141
+ checks. To rebuild the machine-readable registry after an accepted change:
142
+
143
+ ```bash
144
+ python3 registry/build_registry.py
145
+ ```
146
+
147
+ The builder reruns the full gate before atomically replacing
148
+ `registry/registry.json`. Do not edit the registry by hand.
149
+
150
+ ## 6. External decision-quality judge
151
 
152
+ The external LLM judge is intentionally excluded from the local deterministic
153
+ queue. Use `pipelines/l2/llm_judge/README.md` with explicit rows, beliefs, and
154
+ skill-library paths. Judge outputs remain review-isolated until accepted by the
155
+ maintainer.
 
docs/VERIFICATION.md DELETED
@@ -1,90 +0,0 @@
1
- # 跑通验证(2026-07-13)
2
-
3
- 迁移到 `pactbench/` 之后,**逐条真跑**每个入口。结论:**全部可跑,且数字逐位复现 canonical**。
4
- 过程中修掉 6 个 bug —— 其中 3 个是迁移引入的,**3 个是原本就存在、会产出错误数字的老 bug**。
5
-
6
- ## 验证矩阵
7
-
8
- | 入口 | V Rising | Hollow Knight | Isaac | 说明 |
9
- |---|---|---|---|---|
10
- | `data/audit_dataset.sh` | ✅ 跑通 | ✅ 跑通 | ✅ 跑通 | |
11
- | `data/build_metadata.py` | —(无,见 vrising README) | ✅ 跑通 | ✅ 跑通 | |
12
- | `data/build_manifest.sh` | ✅ 跑通 | ✅ 跑通 | ✅ 跑通 | |
13
- | `l1/eval_official_from_ckpt.sh` | ⛔ RGB cache 已被清 | ✅ **完全复现** | ✅ **完全复现**(修 bug 后) | |
14
- | `l1/train_l1.sh` | —(无) | ✅ 守卫正常 | ✅ 守卫正常 | 未真训(重活),守卫按预期拦截 |
15
- | `l1/run_foundation_baselines.sh` | ✅ 跑通 | ❌ 未做 | ❌ 未做 | |
16
- | `l1/run_latency_b8.sh` | ✅ 跑通 | — | — | |
17
- | `l1/build_eval_status.sh` | ✅ 跑通 | — | — | |
18
- | `l2/run_semantic_views.sh` | ✅ **完全复现** | ✅ **完全复现** | ✅ **完全复现** | gemma server 在线 |
19
- | `pipelines/l2/run_image_modality_ablation.sh` | (vrising 已有产物) | ❌ 未做 | ❌ 未做 | |
20
- | `pipelines/l2/llm_judge/*` | ⏸ 暂缓 | ⏸ 暂缓 | ⏸ 暂缓 | 口径未定,依赖外部 API |
21
-
22
- **「完全复现」= 重跑产出的指标和 `results/` 里 canonical 的数字逐位一致**(L1 比对 8 个字段,L2 比对
23
- `sample_set_id` / follow / flip / name_bias / n)。
24
-
25
- 唯一跑不了的是 **V Rising 的 L1 评测**:RGB cache 在磁盘写满时被清了,shell 会干净地报错退出(exit=2)。
26
- 重建:`python3 pact/build_rgb_frame_cache.py --workers 32`(约 2–3 分钟,需 ~30G 磁盘,当前只剩 238G,注意)。
27
-
28
- ## 修掉的 bug
29
-
30
- ### 老 bug(原本就在,会产出错误数字)
31
-
32
- **① Isaac 的 L1 评测 shell 默认加载的是「已废弃的坏 ckpt」。**
33
- `eval_official_from_ckpt_isaac.sh` 的 `CKPT` 默认指向 `raw_rgb_..._train30k_...pt` ——
34
- 正是量纲坏掉那个(预测被截断在 45)。已改为 `ckpt/isaac/l1_main_fixed_e10.pt`。
35
-
36
- **② Isaac 的 L1 评测没传 `--distance_norm 1000`,而训练时传了。** 评测与训练量纲不一致 →
37
- 指标全错(`distance_bin` 0.33 vs 真实 0.89)。已把 `--distance_norm/--distance_clamp` 加进评测 shell。
38
- 修完重跑,**8 个字段全部逐位复现 canonical**。
39
-
40
- **③ V Rising / HK 的 L2 shell 默认写进「v1 采样」的旧目录。**
41
- 采样器代码已经修成 v2(按 `(boss, fight, dp_bin)` 分层),但 shell 的默认 tag 仍指向 v1 的 run 目录。
42
- 照默认跑 + `--resume` → **v2 的新状态混进 v1 的旧 rows**,产出坏数字。
43
- (v1 确实高估:HK v1 follow 92.5% vs v2 89.8%。)
44
- 已把默认 tag 改成 v2:`VRISING_RUN_TAG=samplev2`、`HK_RUN_TAG=test10_samplev2`。
45
-
46
- **④ Isaac 的训练 shell `CKPT_OUT` 默认指向「废弃坏 ckpt」的路径。**
47
- 该路径现在是回链,重训会顺着链把 bug 证据文件覆盖掉。已改为 `ckpt/isaac/l1_main_fixed_e10.pt`。
48
- HK 的训练 shell 默认 cache/ckpt 名也和 canonical 对不上(canonical 训练入口其实是
49
- `games/hk/l1/run_train30k_pipeline.sh`)——默认值已对齐。
50
-
51
- ### 迁移引入的 bug(已修)
52
-
53
- **⑤ `games/{hk,isaac}/data/build_metadata.py` 还按旧 `scripts/` 路径 import。** → 改指 `pact/`。
54
-
55
- **⑥ 三个 py 里的默认路径常量仍指向旧布局**:
56
- `eval_l2_skill_description_intervention.py`(`schemas/skill_library.json`)、
57
- `eval_l2_gemma4_img_ablation.py`(`ROOT = parents[4]`,在旧的深 4 层位置才对)、
58
- `l2_gemma_decide.py`(硬编码绝对路径)。已全部改为新布局。
59
- 另外 V Rising 的 L2 shell 现在像 HK/Isaac 一样**显式传 `--beliefs/--skill_library`**,不再依赖默认常量。
60
-
61
- ## 怎么复验
62
-
63
- ```bash
64
- source env.sh
65
- bash games/{game}/data/audit_dataset.sh # 秒级
66
- bash games/{game}/l2/run_semantic_views.sh # 需 gemma server;--resume 下不重调 LLM,只重算指标
67
- CUDA_VISIBLE_DEVICES=<idle> bash games/{game}/l1/eval_official_from_ckpt.sh # HK/Isaac 可跑;vrising 需先重建 cache
68
- ```
69
-
70
- ---
71
-
72
- ## L1 补做(HK/Isaac)+ 过夜整理(2026-07-13 续)
73
-
74
- 给 HK/Isaac 补齐 L1 三块(视觉基线 / 无图先验 / belief 字段筛选),过程中修的 bug:
75
-
76
- **① `eval_l1_foundation_baselines.py` 对 Isaac 像素量纲 probe 塌缩。**
77
- 距离回归 loss 硬编码 `× 30.0`(引擎量纲还原),Isaac dp 是像素(中位数 147),×30=4410 → smooth_l1 loss 爆炸主导总 loss → 分类头没学、塌缩到多数类(dp_bin 0.335=多数类频率,两个 backbone 数字完全相同)。
78
- 已加 `--distance_norm`(默认 30)+ `--distance_clamp`,改 4 处硬编码 30。Isaac 用 `--distance_norm 1000` 重训后救回(dp_bin dinov2 0.335→0.511、videomae→0.399,两 backbone 区分开)。
79
-
80
- **② `eval_l1_foundation_baselines.py` 的 `train_probe` 阈值 KeyError。**
81
- `--max_train_samples 10000` 按顺序截断,漏掉 fight 靠后的 boss(HK HiveKnight、Isaac DukeOfFlies),eval 时该 boss 查不到距离阈值崩溃。已加全局阈值兜底。
82
-
83
- **③ `eval_l2_belief_policy.py` 对 Isaac 4858 场 fight 的 IO 爆炸。**
84
- `collect_decision_samples` 逐 fight 读 jsonl,Isaac train 4858 场读两遍失控。已加 `--max_train_fights`(Isaac 用 400),线性 probe 不需要几千场。
85
-
86
- **④ 标签硬编码。** `eval_l1_no_image_no_engine_prior.py` + `build_l1_img_ablation_summary.py` 的 train/test_set_id 和输出文件名写死成 V Rising 的 8075/18068。已参数化,从数据继承。
87
-
88
- **⑤ 环境变量污染坑。** 当前 shell 有预设的 `GROUPS=1000` 环境变量,会覆盖 `${GROUPS:-default}`。belief probe shell 已改用硬编码数组 `PROBE_GROUPS=(...)` 绕开;启动脚本用 `env -u GROUPS`。
89
-
90
- **验证**:`registry/build_registry.py` 逐条核验通过;`registry/status.py` 显示三游戏除「L2 决策质量评价」外全部完成。所有结果已进 `组会6_三游戏汇总.pptx`(29 页,新增 p22-29)。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/exp.md DELETED
@@ -1,367 +0,0 @@
1
- # PACT L1/L2 Evaluation Protocol
2
-
3
- Version: `pact-eval-v1`
4
- Effective date: 2026-07-09
5
-
6
- This file defines the default setting for current and future L1/L2 experiments.
7
- It is not a result summary. A result is comparable only if it uses the same
8
- setting id, split, sample set, input modality, and metric scope defined here.
9
-
10
- ## Core Rule
11
-
12
- Every experiment must declare:
13
-
14
- - `protocol`: `pact-eval-v1`
15
- - `layer`: `L1` or `L2`
16
- - `setting_id`
17
- - `train_set_id`
18
- - `test_set_id` or `sample_set_id`
19
- - `input_modality`
20
- - `model_id`
21
- - `seed`
22
- - `metric_scope`: `full_set`, `confidence_filtered`, or `diagnostic`
23
-
24
- If any of these change, the run is a different experiment and must not be put
25
- in the same comparison row without an explicit ablation label.
26
-
27
- ## Canonical Data Settings
28
-
29
- ### TRAIN-COVERED-18068
30
-
31
- Default training set for L1 visual models and visual baselines.
32
-
33
- - Manifest: `out/layered/manifest_latent_covered.json`
34
- - Split: `train`
35
- - Rows: `18,068`
36
- - Sampling unit: decision row
37
- - Row identity: `boss`, `fight`, `time` when filtering cached features;
38
- `boss`, `fight`, `index` when using handoff JSONL rows
39
-
40
- All future L1 visual comparisons should train on this set unless the experiment
41
- is explicitly a data-size or split ablation.
42
-
43
- ### TEST-OFFICIAL-8075
44
-
45
- Default test set for L1 and source pool for L2.
46
-
47
- - Manifest: `out/layered/manifest.json`
48
- - Split: `test`
49
- - Rows: `8,075`
50
- - Input video format for L1 visual models:
51
- - RGB history frames
52
- - offsets `[-8, -4, -2, -1, 0]`
53
- - shape `5 x 3 x 192 x 336`
54
- - Default metric scope: full set, no confidence filtering
55
-
56
- All future L1 headline tables and default L1 ablations should use this test set.
57
-
58
- ### L2-SAMPLE-200-v1
59
-
60
- Default fixed L2 sample for API-costly L2 experiments.
61
-
62
- - Source pool: `TEST-OFFICIAL-8075` handoff rows
63
- - Frozen row file:
64
- `out/layered/l2_skill_desc_intervention_gemma_anon_n200_rows.jsonl`
65
- - Rows: `200`
66
- - Original selection strategy: deterministic stratified round-robin over
67
- `boss x dp_bin`, taking rows in source order
68
- - Boss counts in the frozen sample:
69
- - MilitiaLeader: `68`
70
- - StoneBreaker: `68`
71
- - ToadKing: `64`
72
-
73
- Future L2 method comparisons, description interventions, image-input
74
- diagnostics, and LLM-judge runs should use this same row set by default. If a
75
- new L2 sample is needed, create a new sample id such as `L2-SAMPLE-500-v1` and
76
- store the row list before running models.
77
-
78
- ### TEST-COVERED-6013-LEGACY
79
-
80
- Legacy diagnostic set used by earlier L1 image-input ablation.
81
-
82
- - Rows: `6,013`
83
- - Existing use: old `+img` vs strict `-img` distance-bin diagnostic
84
- - Status: allowed for reproducing old numbers only
85
- - Not allowed for new headline L1/L2 comparisons
86
-
87
- Future experiments should not mix `TEST-COVERED-6013-LEGACY` with
88
- `TEST-OFFICIAL-8075` in the same table.
89
-
90
- ## L1 Protocols
91
-
92
- ### L1-MAIN-VISUAL
93
-
94
- Purpose: compare visual situation-understanding models.
95
-
96
- - `train_set_id`: `TRAIN-COVERED-18068`
97
- - `test_set_id`: `TEST-OFFICIAL-8075`
98
- - `metric_scope`: `full_set`
99
- - Input modality: RGB history
100
- - Required methods:
101
- - PACT-L1
102
- - DINOv2-S + MLP
103
- - VideoMAE-B + MLP
104
- - Required metrics:
105
- - `dp_bin_accuracy`: accuracy of the predicted player-distance bin
106
- - `angle_bin_accuracy`: accuracy of the predicted player-angle bin
107
-
108
- Optional diagnostics, not headline metrics:
109
-
110
- - continuous distance MAE / dp@2
111
- - front-cone F1
112
- - decision-zone / tactical-sector accuracy
113
- - latency ms
114
-
115
- DINOv2-S + MLP and VideoMAE-B + MLP are image-based frozen-backbone baselines.
116
- They are not no-image baselines.
117
-
118
- The main table must not filter rows by `distance_confidence >= 0.9`. If a
119
- high-confidence analysis is reported, it must be a separate diagnostic table
120
- with coverage reported for every method.
121
-
122
- ### L1-IMG-ABLATION
123
-
124
- Purpose: test whether L1 geometry depends on image input.
125
-
126
- Default future setting:
127
-
128
- - `train_set_id`: `TRAIN-COVERED-18068`
129
- - `test_set_id`: `TEST-OFFICIAL-8075`
130
- - Paired conditions:
131
- - `+img`: model receives RGB history
132
- - `-img_strict`: model receives no RGB and no current engine truth
133
- - `metric_scope`: `full_set`
134
-
135
- Strict `-img` must not read:
136
-
137
- - RGB frames
138
- - `raw_obs`
139
- - `dp`
140
- - `da`
141
- - `rel_angle`
142
- - current HP
143
- - current cooldowns
144
- - current previous skill
145
- - current row boss/fight/index metadata at inference time
146
-
147
- Allowed strict `-img` information:
148
-
149
- - training-set priors fixed before evaluation
150
- - constants encoded in the experiment config
151
-
152
- If a no-image method uses history, tracker state, previous predictions, or boss
153
- identity, it is not `-img_strict`. Give it a different condition name, such as
154
- `-img_history` or `-img_boss_prior`.
155
-
156
- Required output metrics:
157
-
158
- - `dp_bin_accuracy`
159
- - `angle_bin_accuracy`
160
-
161
- Auxiliary metrics should still be emitted for completeness when available, but
162
- must be marked as auxiliary and must not drive the L1 headline claim:
163
-
164
- - continuous distance / angle diagnostics
165
- - front-cone, decision-zone, tactical-sector, behind diagnostics
166
- - tracker/state diagnostics such as HP phase
167
- - runtime latency
168
-
169
- ### L1-CONFIDENCE-DIAGNOSTIC
170
-
171
- Purpose: measure reliability of high-confidence predictions.
172
-
173
- This is diagnostic, not the main accuracy metric.
174
-
175
- Rules:
176
-
177
- - Must state threshold, e.g. `distance_confidence >= 0.9`
178
- - Must report coverage
179
- - Must report the full-set metric beside the filtered metric
180
- - Must not be compared against another method's full-set metric
181
- - If comparing multiple methods, apply the same confidence rule to all methods
182
- and report coverage for all methods
183
-
184
- For L1 multiclass heads, confidence is the max softmax probability of the
185
- predicted class. For binary heads, confidence is `max(p, 1-p)` after sigmoid.
186
-
187
- ## L2 Protocols
188
-
189
- ### L2 Input Views
190
-
191
- Every L2 run must declare `belief_view`.
192
-
193
- #### `belief_view=full`
194
-
195
- Purpose: test L2 with the current full L1 handoff prompt.
196
-
197
- Allowed L1 input fields:
198
-
199
- - tracker/state fields: previous skill, skill phase, skill finished, HP phase,
200
- cooldown/menu information
201
- - distance fields: `dp`, `dp_bin`, distance text
202
- - angle/front fields: angle value/bin, `front_cone`
203
- - derived geometry fields: `decision_zone`, `tactical_sector`, `behind`
204
-
205
- This is the "as-currently-used" version and may expose overcomplete L1 fields.
206
-
207
- #### `belief_view=compact`
208
-
209
- Purpose: test the paper Fig. 1 compact interface.
210
-
211
- Allowed L1 input fields:
212
-
213
- - tracker/state fields: previous skill, skill phase, skill finished, HP phase,
214
- cooldown/menu information
215
- - `dp`
216
- - `dp_bin`
217
- - `front_cone`
218
-
219
- Forbidden L1 input fields:
220
-
221
- - angle value/bin
222
- - `angle_36bin`
223
- - `decision_zone`
224
- - `tactical_sector`
225
- - `behind`
226
- - any other L1 geometry not listed above
227
-
228
- This is the preferred paper-facing L2 interface unless the experiment is
229
- explicitly a full-vs-compact ablation.
230
-
231
- ### L2-SEMANTIC-INTERVENTION
232
-
233
- Purpose: test whether L2 decisions follow skill mechanics descriptions rather
234
- than skill names, formatting, or priors.
235
-
236
- - `sample_set_id`: `L2-SAMPLE-200-v1`
237
- - Source belief: L1 handoff from `TEST-OFFICIAL-8075`
238
- - Required input versions:
239
- - `belief_view=full`
240
- - `belief_view=compact`
241
- - Default model temperature: `0`
242
- - Required variants:
243
- - `full`: full skill descriptions
244
- - `no_desc`: skill descriptions removed
245
- - `swap_desc`: skill mechanics descriptions swapped across skills
246
- - Required metrics:
247
- - `no_desc_decision_change_rate`
248
- - `swap_desc_decision_change_rate`
249
-
250
- Parsing validity is a sanity check, not a headline metric.
251
-
252
- ### L2-IMG-DIAGNOSTIC
253
-
254
- Purpose: test whether adding current RGB image content changes L2 decisions.
255
-
256
- - `sample_set_id`: `L2-SAMPLE-200-v1`
257
- - Paired conditions:
258
- - `text_only`: L1 belief + skill menu/descriptions
259
- - `text_plus_img`: same text payload plus current RGB frame
260
- - Required metric:
261
- - skill changed rate
262
- - Optional diagnostics:
263
- - family match rate
264
- - macro recall to target skill
265
- - prediction entropy
266
-
267
- This diagnostic does not by itself prove decision quality.
268
-
269
- This is not part of the current L2 headline metric set. Do not include it in
270
- the main L2 table unless explicitly labeled as an image-input diagnostic.
271
-
272
- ### L2-LLM-JUDGE
273
-
274
- Purpose: judge whether the selected L2 skill is tactically acceptable when
275
- exact next-skill labels are not unique.
276
-
277
- - `sample_set_id`: `L2-SAMPLE-200-v1`
278
- - Required input versions:
279
- - `belief_view=full`
280
- - `belief_view=compact`
281
- - Judge input:
282
- - L1 fields permitted by the run's declared `belief_view`
283
- - legal skill options
284
- - skill mechanics descriptions
285
- - selected skill
286
- - Judge must not see:
287
- - hidden engine next-skill label as the answer
288
- - model name of the policy being judged
289
- - Required outputs:
290
- - selected score `1..5`
291
- - selected acceptable boolean
292
- - acceptable option set
293
- - top option set
294
- - short reason
295
- - Required comparisons:
296
- - `llm_judge_selected_acceptable_rate`
297
- - random-choice expectation under the same acceptable/top sets
298
-
299
- L2 confidence is the LLM's self-reported JSON confidence. It is not comparable
300
- to L1 softmax confidence.
301
-
302
- ## Run Storage
303
-
304
- Every official run must create a directory:
305
-
306
- ```text
307
- out/eval_runs/{run_id}/
308
- ```
309
-
310
- where:
311
-
312
- ```text
313
- run_id = {date}_{layer}_{setting_id}_{model_id}_{condition}_{seed}
314
- ```
315
-
316
- Required files:
317
-
318
- - `run_config.json`: all protocol fields and command-line args
319
- - `metrics.json`: machine-readable metrics
320
- - `rows.jsonl` or `predictions.jsonl`: row-level outputs when applicable
321
- - `README.md`: one-paragraph description of what changed
322
- - `DEVIATION.md`: required only if the run differs from this protocol
323
-
324
- Never overwrite an existing official run directory. Create a new run id.
325
-
326
- ## Reporting Rules
327
-
328
- A slide, table, or paper sentence must include:
329
-
330
- - setting id
331
- - train set id
332
- - test/sample set id
333
- - sample count
334
- - metric scope
335
- - whether image input is used
336
-
337
- Allowed concise examples:
338
-
339
- - `L1-MAIN-VISUAL on TEST-OFFICIAL-8075, full-set metrics`
340
- - `L1-IMG-ABLATION on TEST-OFFICIAL-8075, +img vs -img_strict`
341
- - `L2-SEMANTIC-INTERVENTION on L2-SAMPLE-200-v1`
342
- - `L1-CONFIDENCE-DIAGNOSTIC, distance_confidence >= 0.9, coverage reported`
343
-
344
- Forbidden comparisons:
345
-
346
- - DINOv2/VideoMAE full-set metrics vs PACT-L1 confidence-filtered metrics
347
- - `TEST-COVERED-6013-LEGACY` numbers in the same table as
348
- `TEST-OFFICIAL-8075` numbers
349
- - DINOv2/VideoMAE described as no-image baselines
350
- - L2 parsing validity reported as decision performance
351
-
352
- ## Changing The Protocol
353
-
354
- Changing any of the following requires a new protocol version or a new setting
355
- id:
356
-
357
- - train manifest
358
- - test manifest
359
- - L2 sample row list
360
- - RGB history offsets or image resolution
361
- - allowed inputs for no-image conditions
362
- - model temperature for L2 methods
363
- - confidence threshold used for diagnostic filtering
364
- - metric definition
365
-
366
- Protocol changes must be made before running the experiment, not after seeing
367
- the result.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/hk_experiment_checklist.md DELETED
@@ -1,105 +0,0 @@
1
- # HK 实验清单(Hollow Knight)
2
-
3
- > 目标:把 HK 从「数据就绪」一路跑到 L2 语义干预,与 V Rising 主线对齐。
4
- > 每完成一项就把 `[ ]` 改成 `[x]` 并在「产物 / 结果」列填实际数字或路径。
5
- > 最后更新:2026-07-10(B 完成,D 待跑)
6
-
7
- 游戏独立原则:HK 单独训练 L1、单独评测 L2,用 HK 自己的技能机制,不共享多游戏模型。
8
- 协议对齐 V Rising:训练/测试同一套 fight 级切分;L2 用 200 个分层采样状态、匿名技能 ID、Gemma-4-E2B-it、温度 0、三种描述条件(full / no_desc / swap_desc)。
9
-
10
- ---
11
-
12
- ## A. 数据侧(已完成)
13
-
14
- - [x] **A1 数据审计** — `code/hk/data/audit_dataset.sh` 产物:`out/eval_runs/hk_dataset_audit.json`
15
- - [x] **A2 ontology + 技能库** — `code/hk/data/build_metadata.py` 产物:`out/hk/ontology.json`, `schemas/hk_skill_library.json`
16
- - [x] **A3 fight 级切分 manifest** — `code/hk/data/build_manifest.sh` 产物:`out/hk/layered/manifest.json`
17
- - [x] **A4 RGB cache(train 30k + official test)** — `scripts/build_rgb_frame_cache.py`
18
- 产物:`raw_rgb_train30k_current0_h192w336.pt`(29G, 30000/30000 零缺失), `raw_rgb_test_official_current0_h192w336.pt`(2.2G)
19
-
20
- ## B. L1 训练与评测
21
-
22
- - [x] **B1 L1 训练** — ✅ 完成(2026-07-10,10 epoch,GPU2,15:56 落盘;改用 `code/hk/l1/train_l1.sh` 直跑)
23
- log:`out/hk/logs/20260710_hk_l1_train_direct_gpu2.log`
24
- 产物:`out/hk/situation/raw_rgb_resnet18_decision_train30k_from_dp_current0_e10.pt`(ckpt 52MB)
25
- + `..._official_test.json`(metrics) + `beliefs_..._official_test.jsonl`(2242 行)
26
- - [x] **B2 L1 官方测试性能指标** — ✅ 完成(训练自带在 official test 上评测;n=2242)
27
- 产物:`out/hk/situation/raw_rgb_resnet18_decision_train30k_from_dp_current0_e10_official_test.json`
28
- 指标在 json 的 `continuous` / `fields` 键下(顶层 `metrics` 为空):
29
- | 指标 | HK | V Rising 对照 |
30
- |---|---|---|
31
- | Dist. MAE ↓ | **0.516** | 0.2621 |
32
- | dp@2(dp_within_2)↑ | **0.9648** | 0.9962 |
33
- | dp@4 ↑ | **0.9982** | — |
34
- | Angle MAE ↓ | **3.65°** | 11.73° |
35
- | Angle@20° ↑ | **0.9723** | 0.8295 |
36
- | Angle@10° ↑ | **0.9277** | — |
37
- | Range-bin acc.(player_distance_bin)↑ | **0.7021** | 0.8966 |
38
- | hp_phase acc. ↑ | 0.2988 | — |
39
- 结论:HK L1 几何其实相当好——距离/角度连续预测接近甚至优于 V Rising(angle@20° 0.97 vs 0.83)。
40
- ⚠️ 但 `player_angle_bin` 分类头 accuracy=0.0(连续角度好、离散 bin 头坏,bin 定义可能与 HK 不匹配);
41
- Front-cone F1 / Zone Acc. / Tactical-sector 在 HK 这次 eval 输出里未计算(不在 json 内)。
42
-
43
- ## C. L1 → L2 桥接
44
-
45
- - [x] **C1 桥接 → L2 输入** — ✅ 不需单独 handoff:L2 脚本 `nested_belief()` 直接消费 flat beliefs
46
- beliefs jsonl 的 `belief` 字段含全部所需 flat 字段(player_distance_value/bin、front_cone、
47
- decision_zone、tactical_sector、cooldown_ready/seconds、prev_boss_skill、hp_phase…)。
48
- 跑 L2 时把 `HK_L1_HANDOFF` 指向该 beliefs 文件即可(早前指向不存在的 handoff 路径→被 block)。
49
-
50
- ## D. L2 语义干预(核心结果)
51
-
52
- - [x] **D1 L2 full view** — ✅ 完成(2026-07-11 03:15 落盘,200 行,已核实 md5/wc)
53
- 产物:`out/hk/eval_runs/L2-SEMANTIC-INTERVENTION_gemma-4-E2B-it_full_full-no_desc-swap_seed0/metrics.json`(+rows.jsonl 200 行)
54
- 结果:Desc-follow=**62.4%** / Neither=33.5% / Name-bias=**2.0%** / No-desc change=87.0% / Swap change=98.0% / valid=98.5%
55
- - [x] **D2 L2 compact view(Fig.1 接口)** — ✅ 完成(2026-07-11 03:54 落盘,200 行,已核实)
56
- 产物:`out/hk/eval_runs/L2-SEMANTIC-INTERVENTION_gemma-4-E2B-it_compact_full-no_desc-swap_seed0/metrics.json`
57
- 结果:Desc-follow=**95.0%** / Neither=1.0% / Name-bias=**2.0%** / No-desc change=92.4% / Swap change=98.0% / valid=99.0%
58
- - [x] **D3 汇总对比表** — compact vs full,随机 follow 基线≈29.2%(1/K̄, K̄=3.42)
59
- 结论:✅ 复现。compact≫full(95.0% vs 62.4%)、name-bias 仅 2%,
60
- compact=3.25×基线、full=2.1×基线。决策受机制语义强控制,且 compact≥full 与 V Rising 一致。
61
-
62
- ## 可选 / 视时间补(对齐 V Rising 但非主线)
63
-
64
- - [ ] **E1 L1 图像消融** — PACT-L1 有图 vs 严格无图先验(对应 V Rising 第 5 页)
65
- - [ ] **E2 L1 belief→policy probe** — compact vs overcomplete 的 masked MLP probe(对应 V Rising 第 8 页)
66
- - [ ] **E3 L2 boss 级分解** — D 的按 boss(FalseKnight / HiveKnight / Hornet …)拆解
67
-
68
- ---
69
-
70
- ## 依赖链(一眼看清能不能并行)
71
-
72
- ```
73
- A(✓) ── B1(训练,等GPU) ── B2(L1评测) ─┐
74
- └─ C1(handoff) ── D1(L2 full) ─┐
75
- └─ D2(L2 compact) ── D3(汇总)
76
- ```
77
- B2 与 C1 都只依赖 B1,可并行。D1/D2 依赖 C1 + gemma server,可并行(两张卡)。
78
-
79
- ## 阻塞记录
80
-
81
- - 2026-07-10 15:41:B1 一直在轮询「GPU2 busy: memory.used=11059 MiB」——被 L2 模型消融的 gemma server 占用。
82
- - 2026-07-10 15:44:关掉 4 个 gemma server(含一个漏网的 617434),GPU2 释放到 3 MiB。
83
- - 2026-07-10 15:50:`run_train30k_pipeline.sh` 的 build_cache 子进程(PID 3880228)卡死——抽帧早已 30000/30000 完成,却卡在 torch.save 之前空转(163% CPU、48.9G RSS、零写入),挡住整个 pipeline。
84
- - 2026-07-10 15:52:验证两个 cache 完整可加载,终止卡死 pipeline,改用 `train_l1.sh` 直接训练(cache 已在,自动跳过重建)。
85
- - 2026-07-10 15:56:训练正常完成 10 epoch,产物落盘(ckpt 52MB、beliefs 2242 行、metrics json)。
86
- - 2026-07-10(复盘):高负载期 shell 曾返回虚假输出,一度误报 handoff/L2 已完成——经独立核实 `out/hk/eval_runs` 不存在、
87
- handoff 文件不存在、L2 run log 显示每次都被 block。已据实修正本清单;L2 实际需先起 gemma server 再跑。
88
-
89
- ---
90
-
91
- ## HK L2 结果小结(D3)— 待 D1/D2 跑完后填入真实数字
92
-
93
- 协议:n=200 分层采样,匿名技能 ID,Gemma-4-E2B-it,温度 0,三条件 full/no_desc/swap_desc。
94
- 指标:Desc-follow=跟随被交换机制文本的比例(好);Neither=既不跟随也不守身份,漂到无关技能(噪声);Name-bias=守住原技能身份(坏)。三者互斥且合计=Swap-change;随机基线 follow≈1/K̄。
95
-
96
- | Belief view | No-desc change | Swap-change | Desc-follow ↑ | Neither ↓ | Name-bias ↓ | valid |
97
- |---|---|---|---|---|---|---|
98
- | full | 87.0% | 98.0% | 62.4% | 33.5% | 2.0% | 98.5% |
99
- | compact | 92.4% | 98.0% | **95.0%** | 1.0% | 2.0% | 99.0% |
100
-
101
- 随机 follow 基线≈29.2%(K̄=3.42)→ compact=3.25×、full=2.1×。
102
- 按 boss(compact / full 的 desc-follow):FalseKnight 95.6% / 82.4%,HiveKnight 97.0% / 72.7%,Hornet 92.2% / 30.2%。
103
- (full 下 Hornet 是唯一难点 30%,compact 补齐到 92%——belief 视图收窄反而让语义控制更稳。)
104
-
105
- ## 状态:A/B/C/D 全部完成 ✅(含 L1 单帧消融) (可选项 E1/E2/E3 未做)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/hk_experiment_plan.md DELETED
@@ -1,238 +0,0 @@
1
- # Hollow Knight Experiment Plan
2
-
3
- Last updated: 2026-07-09 08:12:54 UTC
4
-
5
- Scope: HK only. Do not modify V Rising or Isaac outputs.
6
-
7
- ## Current Executable State
8
-
9
- | Area | Status | Evidence / Path |
10
- |---|---|---|
11
- | Processed data | Ready | `data/hk/processed -> data/_hf_teawhite_vrising_hk_isaac/HK` |
12
- | Data audit | Passed | `out/eval_runs/hk_dataset_audit.json`, `warnings=[]`, entities: FalseKnight, HiveKnight, Hornet |
13
- | Ontology | Ready, data-derived | `out/hk/ontology.json` from policy actions and render prompts |
14
- | Skill library | Ready, conservative | `schemas/hk_skill_library.json`; mechanics are render-prompt-derived and not human validated |
15
- | Split manifest | Ready | `out/hk/layered/manifest.json` |
16
- | L1 RGB cache smoke | Passed | `out/hk/situation/smoke/raw_rgb_test_current0_smoke24.pt`, kept=24, missing=0 |
17
- | L1 training/eval | Running fast train30k path | Full HK train cache is too slow/heavy for the first run; `code/hk/l1/train_l1.sh` now accepts cache/result path overrides |
18
- | L1 ablation/baselines | Blocked | Needs HK L1 result JSON before no-image prior and image ablation summary can run |
19
- | L2 semantic intervention | Blocked for formal run | Needs HK L1 handoff rows; `code/hk/l2/run_semantic_views.sh` is a guarded entry point |
20
- | LLM judge | Deferred | Same policy as V Rising current plan |
21
-
22
- ## Data And Split
23
-
24
- Split policy is shared with V Rising: sorted fights, last 3 test, preceding 3 validation.
25
-
26
- | Boss | All | Train | Val | Test | Skills |
27
- |---|---:|---:|---|---|---:|
28
- | FalseKnight | 226 | 220 | 221,222,223 | 224,225,226 | 6 |
29
- | HiveKnight | 77 | 71 | 72,73,74 | 75,76,77 | 6 |
30
- | Hornet | 220 | 214 | 215,216,217 | 218,219,220 | 7 |
31
-
32
- Important caveat: FalseKnight `opened` is a high-frequency policy action/state.
33
- The shared manifest logic treats it as a skill because it is not `idle`,
34
- `turn`, `death`, or `move_*`. Do not filter it without a documented protocol
35
- decision.
36
-
37
- ## Commands Completed
38
-
39
- ```bash
40
- python code/hk/data/build_metadata.py
41
- bash code/hk/data/build_manifest.sh
42
- bash code/hk/data/audit_dataset.sh
43
- python -m py_compile code/hk/data/build_metadata.py
44
- python scripts/build_rgb_frame_cache.py \
45
- --manifest out/hk/layered/manifest.json \
46
- --processed_root data/hk/processed \
47
- --split test \
48
- --history_offsets="-8,-4,-2,-1,0" \
49
- --frame_in_cell 2 \
50
- --height 192 \
51
- --width 336 \
52
- --allow_current_frame \
53
- --max_samples 24 \
54
- --out out/hk/situation/smoke/raw_rgb_test_current0_smoke24.pt
55
- bash -n code/hk/l1/train_l1.sh
56
- bash -n code/hk/l2/run_semantic_views.sh
57
- bash code/hk/l1/train_l1.sh
58
- bash code/hk/l2/run_semantic_views.sh
59
- ```
60
-
61
- Validation also checked that ontology, skill library, and manifest cover the
62
- same HK bosses/skills and that train/val/test splits do not overlap.
63
-
64
- ## Required Experiment Blocks
65
-
66
- ### B0: Data Audit And Shared Split
67
-
68
- - Claim tested: HK can use the same fight-level split protocol as V Rising.
69
- - Dataset / split: `out/hk/layered/manifest.json`.
70
- - Metrics: audit warnings, missing video/render files, row/obs field coverage,
71
- split disjointness.
72
- - Status: complete.
73
-
74
- ### B1: PACT-L1 Main HK Result
75
-
76
- - Claim tested: PACT-L1 can predict HK L1 belief fields from RGB under the same
77
- protocol.
78
- - Dataset / split: HK manifest train vs official test split.
79
- - Compared systems: PACT-L1 RGB model, strict no-image global prior, foundation
80
- feature probes if HK feature caches are built.
81
- - Metrics: field accuracy, macro/balanced metrics where available, confidence /
82
- ECE, and overall output summary from the L1 result JSON.
83
- - Status: approved fast run uses a 30,000-sample train cache and the unchanged
84
- official test cache. Report as `HK-L1 train30k`; do not treat it as the final
85
- full-data HK result.
86
-
87
- Train split size audit:
88
-
89
- | Split | Samples |
90
- |---|---:|
91
- | Train full | 144,418 |
92
- | Train fast cache | 30,000 |
93
- | Val | 2,614 |
94
- | Test official | 2,242 |
95
-
96
- The current cache builder's `max_samples` path uses boss-balanced prefix
97
- sampling, so the fast run is useful for pipeline validation and early results
98
- but may under-cover later train fights and long-tail skills.
99
-
100
- Prepared cache commands:
101
-
102
- ```bash
103
- python scripts/build_rgb_frame_cache.py \
104
- --manifest out/hk/layered/manifest.json \
105
- --processed_root data/hk/processed \
106
- --split train \
107
- --history_offsets="-8,-4,-2,-1,0" \
108
- --frame_in_cell 2 \
109
- --height 192 \
110
- --width 336 \
111
- --allow_current_frame \
112
- --max_samples 30000 \
113
- --out out/hk/situation/raw_rgb_train30k_current0_h192w336.pt
114
-
115
- python scripts/build_rgb_frame_cache.py \
116
- --manifest out/hk/layered/manifest.json \
117
- --processed_root data/hk/processed \
118
- --split train \
119
- --history_offsets="-8,-4,-2,-1,0" \
120
- --frame_in_cell 2 \
121
- --height 192 \
122
- --width 336 \
123
- --allow_current_frame \
124
- --out out/hk/situation/raw_rgb_train_full_current0_h192w336.pt
125
-
126
- python scripts/build_rgb_frame_cache.py \
127
- --manifest out/hk/layered/manifest.json \
128
- --processed_root data/hk/processed \
129
- --split test \
130
- --history_offsets="-8,-4,-2,-1,0" \
131
- --frame_in_cell 2 \
132
- --height 192 \
133
- --width 336 \
134
- --allow_current_frame \
135
- --out out/hk/situation/raw_rgb_test_official_current0_h192w336.pt
136
- ```
137
-
138
- Prepared heavy training command, only after an idle GPU is confirmed:
139
-
140
- ```bash
141
- TRAIN_CACHE=out/hk/situation/raw_rgb_train30k_current0_h192w336.pt \
142
- TEST_CACHE=out/hk/situation/raw_rgb_test_official_current0_h192w336.pt \
143
- OUT_JSON=out/hk/situation/raw_rgb_resnet18_decision_train30k_from_dp_current0_e10_official_test.json \
144
- BELIEF_OUT=out/hk/situation/beliefs_raw_rgb_resnet18_decision_train30k_from_dp_current0_e10_official_test.jsonl \
145
- CKPT_OUT=out/hk/situation/raw_rgb_resnet18_decision_train30k_from_dp_current0_e10.pt \
146
- CUDA_VISIBLE_DEVICES=<idle_gpu> \
147
- HK_ALLOW_HEAVY_TRAINING=1 \
148
- bash code/hk/l1/train_l1.sh
149
- ```
150
-
151
- Equivalent guarded pipeline entry point:
152
-
153
- ```bash
154
- GPU_ID=<idle_gpu> bash code/hk/l1/run_train30k_pipeline.sh
155
- ```
156
-
157
- ### B2: PACT-L1 Ablations And Baselines
158
-
159
- - Claim tested: HK L1 gains are not explained by global priors or foundation
160
- features alone.
161
- - Must-run after B1: strict no-image prior from HK L1 JSON, image ablation table,
162
- foundation baselines if HK feature caches exist.
163
- - Status: blocked on B1 output.
164
-
165
- Prepared strict-prior command:
166
-
167
- ```bash
168
- python evaluation/ablations/pact_eval_v1_20260709/scripts/eval_l1_no_image_no_engine_prior.py \
169
- --source out/hk/situation/raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.json \
170
- --out out/hk/ablations/l1_no_image_no_engine_prior_official_test.json \
171
- --test_set_id HK-TEST-OFFICIAL
172
- ```
173
-
174
- ### B3: L2 Semantic Intervention
175
-
176
- - Claim tested: HK L2 decisions change when skill descriptions are removed or
177
- swapped, for both full and compact L1 handoff views.
178
- - Inputs: real HK L1 handoff rows, not oracle policy rows.
179
- - Metrics: no-desc decision change rate, swap-desc decision change rate,
180
- desc-follow, name-bias. LLM judge remains deferred.
181
- - Status: blocked on B1 handoff rows.
182
-
183
- Prepared commands after HK L1 handoff exists:
184
-
185
- ```bash
186
- GEMMA_OPENAI_BASE_URL=http://127.0.0.1:8018/v1 \
187
- GEMMA_MODEL=gemma-4-E2B-it \
188
- GEMMA_TEMPERATURE=0 \
189
- python scripts/eval_l2_skill_description_intervention.py \
190
- --beliefs out/hk/situation/l1_handoff_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.jsonl \
191
- --skill_library schemas/hk_skill_library.json \
192
- --backend gemma \
193
- --limit 200 \
194
- --sample_strategy stratified \
195
- --anonymous_names \
196
- --belief_view full \
197
- --resume \
198
- --out out/hk/eval_runs/L2-SEMANTIC-INTERVENTION_gemma-4-E2B-it_full_full-no_desc-swap_seed0/metrics.json \
199
- --rows_out out/hk/eval_runs/L2-SEMANTIC-INTERVENTION_gemma-4-E2B-it_full_full-no_desc-swap_seed0/rows.jsonl
200
-
201
- GEMMA_OPENAI_BASE_URL=http://127.0.0.1:8018/v1 \
202
- GEMMA_MODEL=gemma-4-E2B-it \
203
- GEMMA_TEMPERATURE=0 \
204
- python scripts/eval_l2_skill_description_intervention.py \
205
- --beliefs out/hk/situation/l1_handoff_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.jsonl \
206
- --skill_library schemas/hk_skill_library.json \
207
- --backend gemma \
208
- --limit 200 \
209
- --sample_strategy stratified \
210
- --anonymous_names \
211
- --belief_view compact \
212
- --resume \
213
- --out out/hk/eval_runs/L2-SEMANTIC-INTERVENTION_gemma-4-E2B-it_compact_full-no_desc-swap_seed0/metrics.json \
214
- --rows_out out/hk/eval_runs/L2-SEMANTIC-INTERVENTION_gemma-4-E2B-it_compact_full-no_desc-swap_seed0/rows.jsonl
215
- ```
216
-
217
- ## Stop / Go Gates
218
-
219
- | Gate | Go Condition | Stop Condition |
220
- |---|---|---|
221
- | G0 metadata | Manifest builds and audit warnings stay zero | Missing render/video/policy rows or schema mismatch |
222
- | G1 cache | Train/test RGB caches build with missing=0 or documented tiny drop | Video decode failures or unexpected sample loss |
223
- | G2 training | `nvidia-smi` shows an idle GPU with memory.used < 500 MiB | No idle GPU or another process owns the GPU |
224
- | G3 L2 | HK L1 handoff rows exist and use `schemas/hk_skill_library.json` | Only oracle rows exist, or semantic fields are judged too weak |
225
-
226
- ## Open Risks
227
-
228
- - HK skill library is conservative and render-prompt-derived. It is usable for
229
- manifest construction and prompt wiring, but formal L2 conclusions should
230
- note that the descriptions are not human validated.
231
- - `export_l1_handoff_payloads.py` defaults include V Rising paths and a
232
- V Rising-derived affordance matrix. HK commands must pass HK paths explicitly,
233
- and the tactical prior should be neutralized or replaced before paper-grade
234
- HK L2 analysis if that field is used.
235
- - HK L1/L2 shell wrappers are guarded entry points. L1 refuses to train unless
236
- formal caches exist, `HK_ALLOW_HEAVY_TRAINING=1` is set, and the selected GPU
237
- has memory.used < 500 MiB. L2 refuses formal evaluation until real HK L1
238
- handoff rows exist.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/legacy/OLD_l1_README.md DELETED
@@ -1,79 +0,0 @@
1
- # L1 Evaluation Package
2
-
3
- L1 is the situation-understanding layer. It converts recent raw RGB history
4
- and structured fight state into the belief interface consumed by L2. The
5
- current official L1 result is a task-trained ResNet18-GRU belief model plus
6
- tracker-compatible handoff fields.
7
-
8
- ## Canonical Question
9
-
10
- L1 answers whether the system understands the current fight state:
11
-
12
- - player--boss distance,
13
- - front / decision-zone geometry,
14
- - cooldown and previous-skill handoff state,
15
- - whether the belief is usable by L2.
16
-
17
- L1 does not choose the next skill and does not render video.
18
-
19
- ## Standard Subdirectories
20
-
21
- ```text
22
- evaluation/l1/
23
- model/ # architecture map and source-of-truth files
24
- train/ # training split and official training/eval entry points
25
- eval/ # official metrics, latency, affordance, handoff checks
26
- baselines/ # DINOv2, VideoMAE, latent/engine baselines
27
- ckpt/ # checkpoint manifest
28
- results/ # canonical result manifest
29
- ```
30
-
31
- ## Current Official Setup
32
-
33
- - Train split: `out/layered/manifest_latent_covered.json`, train rows
34
- `18,068`.
35
- - Test split: `out/layered/manifest.json`, official test rows `8,075`.
36
- - Visual input: 5 RGB history frames, offsets `[-8, -4, -2, -1, 0]`,
37
- frame-in-cell `[2]`, resized to `192 x 336`.
38
- - Model: task-trained ResNet18 frame encoder + GRU + boss embedding +
39
- multi-head belief outputs.
40
- - Checkpoint:
41
- `out/situation/raw_rgb_resnet18_decision_finetune_from_dp_current0_e10.pt`.
42
-
43
- ## Primary Paper Table
44
-
45
- The L1 main table is stored in:
46
-
47
- - `paper/l1_results_table_aaai2027_submit.tex`
48
- - `paper/l1_external_baselines_zh.md`
49
-
50
- The table compares:
51
-
52
- - DINOv2-S + MLP frozen-backbone baseline,
53
- - VideoMAE-B + MLP frozen-backbone baseline,
54
- - PACT-L1.
55
-
56
- Main metrics:
57
-
58
- - Distance MAE,
59
- - `d_p@2`,
60
- - front-cone F1,
61
- - decision-zone accuracy,
62
- - batch-8 model-forward latency.
63
-
64
- Latency excludes mp4 decoding and is measured on decoded RGB histories.
65
-
66
- ## Source-of-Truth Registry
67
-
68
- Use `evaluation/l1/registry.json` for machine-readable paths to scripts,
69
- checkpoints, results, feature caches, and table sources.
70
-
71
- ## Do Not Use For Main Table
72
-
73
- These are useful diagnostics but should not be mixed into the primary paper
74
- table without a separate caption:
75
-
76
- - smoke results under `out/situation/*smoke*`,
77
- - full-manifest foundation probes trained on `22,645` rows,
78
- - latent-covered test results with `6,013` rows,
79
- - latency numbers that include mp4 decoding.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/legacy/OLD_l1_registry.json DELETED
@@ -1,71 +0,0 @@
1
- {
2
- "layer": "L1",
3
- "name": "situation_understanding",
4
- "status": "official_result_with_external_baselines",
5
- "splits": {
6
- "official_train_manifest": "out/layered/manifest_latent_covered.json",
7
- "official_train_n": 18068,
8
- "official_test_manifest": "out/layered/manifest.json",
9
- "official_test_n": 8075,
10
- "rgb_history_offsets": [-8, -4, -2, -1, 0],
11
- "frame_in_cell": [2],
12
- "rgb_shape": [5, 3, 192, 336]
13
- },
14
- "canonical_model": {
15
- "name": "PACT-L1",
16
- "architecture": "ResNet18 frame encoder + GRU + boss embedding + multi-head belief outputs",
17
- "source": "scripts/train_rgb_situation_net.py",
18
- "checkpoint": "out/situation/raw_rgb_resnet18_decision_finetune_from_dp_current0_e10.pt",
19
- "official_metrics": "out/situation/raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.json",
20
- "official_beliefs": "out/situation/beliefs_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.jsonl",
21
- "handoff": "out/situation/l1_handoff_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.jsonl",
22
- "handoff_summary": "out/situation/l1_handoff_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test_summary.json",
23
- "affordance": "out/situation/affordance_eval_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.json"
24
- },
25
- "baselines": [
26
- {
27
- "name": "DINOv2-S + MLP",
28
- "type": "frozen foundation visual backbone",
29
- "source": "scripts/eval_l1_foundation_baselines.py",
30
- "retrain_source": "scripts/retrain_l1_foundation_probe_from_cache.py",
31
- "train_feature_cache": "out/situation/foundation_features/l1_dinov2_small_train_grouped_stream_covered18068_features.pt",
32
- "test_feature_cache": "out/situation/foundation_features/l1_dinov2_small_test_grouped_stream_features.pt",
33
- "official_metrics": "out/situation/foundation_dinov2_small_covered_train_official_test.json"
34
- },
35
- {
36
- "name": "VideoMAE-B + MLP",
37
- "type": "frozen foundation video backbone",
38
- "source": "scripts/eval_l1_foundation_baselines.py",
39
- "retrain_source": "scripts/retrain_l1_foundation_probe_from_cache.py",
40
- "train_feature_cache": "out/situation/foundation_features/l1_videomae_base_train_grouped_stream_covered18068_features.pt",
41
- "test_feature_cache": "out/situation/foundation_features/l1_videomae_base_test_grouped_stream_features.pt",
42
- "official_metrics": "out/situation/foundation_videomae_base_covered_train_official_test.json"
43
- },
44
- {
45
- "name": "engine oracle / majority / obs-history MLP",
46
- "type": "non-visual diagnostic baselines",
47
- "summary": "out/layered/l1_summary.csv"
48
- }
49
- ],
50
- "evaluation_scripts": {
51
- "build_rgb_cache": "scripts/build_rgb_frame_cache.py",
52
- "append_current_rgb": "scripts/append_current_rgb_frame_cache.py",
53
- "train_eval_pact_l1": "scripts/train_rgb_situation_net.py",
54
- "export_handoff": "scripts/export_l1_handoff_payloads.py",
55
- "affordance": "scripts/eval_l1_affordance_metrics.py",
56
- "foundation_baselines": "scripts/eval_l1_foundation_baselines.py",
57
- "retrain_foundation_probe": "scripts/retrain_l1_foundation_probe_from_cache.py",
58
- "latency": "scripts/benchmark_l1_visual_latency.py",
59
- "latent_diagnostics": "scripts/eval_l1_latent_understanding.py",
60
- "latent_cnn_diagnostics": "scripts/eval_l1_latent_cnn_understanding.py"
61
- },
62
- "latency": {
63
- "definition": "batch-8 model-forward latency on decoded RGB histories; excludes mp4 decoding",
64
- "result": "out/situation/l1_visual_latency_benchmark_b8.json"
65
- },
66
- "paper_sources": {
67
- "latex_table": "paper/l1_results_table_aaai2027_submit.tex",
68
- "chinese_summary": "paper/l1_external_baselines_zh.md",
69
- "preview_pdf": "paper/main.pdf"
70
- }
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/legacy/OLD_l2_README.md DELETED
@@ -1,197 +0,0 @@
1
- # L2 Evaluation Package
2
-
3
- L2 is the skill-decision layer. It consumes the L1 belief interface and chooses
4
- the next boss skill. A valid L2 output must include a machine-readable decision
5
- and a short rationale:
6
-
7
- ```json
8
- {"skill": "ground_slam", "reason": "near distance -> close skill", "confidence": 0.7}
9
- ```
10
-
11
- ## Canonical Question
12
-
13
- L2 answers whether the system can make an effective next-skill decision from
14
- the L1 belief state:
15
-
16
- - choose one legal boss skill,
17
- - respect cooldown and handoff constraints,
18
- - use decision-relevant belief fields such as distance, front cone, previous
19
- skill, HP phase, and cooldown,
20
- - provide a rationale that supports the selected skill and is grounded in L1.
21
-
22
- L2 does not estimate visual belief fields and does not render video.
23
-
24
- ## Metric Groups
25
-
26
- Use separate groups in paper tables or ablations.
27
-
28
- 1. Decision quality:
29
- - skill match rate,
30
- - skill macro recall,
31
- - skill-family match rate,
32
- - JS divergence to the real skill distribution,
33
- - normalized entropy / effective skill count.
34
-
35
- 2. Interface validity:
36
- - JSON/schema valid rate,
37
- - legal skill rate,
38
- - cooldown-ok rate,
39
- - rule-grounded rate.
40
-
41
- 3. Rationale quality:
42
- - non-empty reason rate,
43
- - rationale-informative rate,
44
- - decision-rationale alignment rate,
45
- - rationale-belief grounding rate,
46
- - rationale-contradiction rate,
47
- - auxiliary CLIP reason--description cosine.
48
-
49
- 4. Counterfactual reactivity:
50
- - distance changes decision rate,
51
- - distance monotonic far/close rate,
52
- - blocked skill switch rate,
53
- - legal/cooldown-ok rate after blocking,
54
- - style-conditioned close/far deltas.
55
-
56
- 5. Skill-description intervention:
57
- - No-Desc Flip: whether the paired decision changes after removing skill
58
- mechanics descriptions while keeping the same skill names, menu, and
59
- cooldowns,
60
- - Swap Desc-Follow: whether the paired decision follows the swapped-in
61
- mechanics description rather than the original skill name,
62
- - Swap Name-Bias: whether the paired decision remains on the original
63
- full-prompt skill name after descriptions are swapped.
64
-
65
- ## Important Evaluation Logic
66
-
67
- Decision-rationale semantic relevance is useful, but it is not enough to prove
68
- decision effectiveness. A rationale can semantically match the selected skill
69
- while contradicting L1, for example choosing a melee skill because the player is
70
- close when the belief says the player is far. Therefore L2 reports:
71
-
72
- - decision-rationale alignment: whether the reason semantically supports the
73
- chosen skill family,
74
- - rationale-belief grounding: whether the factual claims in the reason are
75
- supported by L1,
76
- - decision quality: whether the selected skill matches the target or target
77
- family and satisfies constraints.
78
-
79
- CLIP text cosine is reported only as an auxiliary semantic-consistency
80
- diagnostic. It can show whether a rationale is textually close to a skill
81
- mechanics description, but it is not a causal test and is weak for fine-grained
82
- text--text distinctions among similar skill descriptions.
83
-
84
- ## Current Official Inputs
85
-
86
- - Official L1 handoff:
87
- `out/situation/l1_handoff_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.jsonl`
88
- - Current row-level L2 heuristic predictions:
89
- `out/layered/predictions_l2_heuristic_official_test_belief_raw_rgb_l1_handoff.jsonl`
90
- - Current L2 heuristic summary:
91
- `out/layered/l2_heuristic_official_test_belief_raw_rgb_l1_handoff.json`
92
-
93
- ## Canonical Commands
94
-
95
- Decision evaluation:
96
-
97
- ```bash
98
- python scripts/eval_l2_decision.py \
99
- --backend heuristic \
100
- --split test \
101
- --beliefs out/situation/l1_handoff_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.jsonl \
102
- --predictions_out out/layered/predictions_l2_heuristic_official_test_belief_raw_rgb_l1_handoff.jsonl \
103
- --out out/layered/l2_heuristic_official_test_belief_raw_rgb_l1_handoff.json
104
- ```
105
-
106
- Rationale evaluation:
107
-
108
- ```bash
109
- python scripts/eval_l2_rationale_alignment.py \
110
- --predictions out/layered/predictions_l2_heuristic_official_test_belief_raw_rgb_l1_handoff.jsonl \
111
- --out out/layered/l2_rationale_heuristic_official_test_belief_raw_rgb_l1_handoff.json
112
- ```
113
-
114
- Counterfactual evaluation:
115
-
116
- ```bash
117
- python scripts/eval_l2_counterfactual.py \
118
- --backend heuristic \
119
- --split test \
120
- --beliefs out/situation/l1_handoff_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.jsonl \
121
- --out out/layered/l2_counterfactual_heuristic_official_test_belief_raw_rgb_l1_handoff.json
122
- ```
123
-
124
- Skill-description intervention:
125
-
126
- ```bash
127
- GEMMA_OPENAI_BASE_URL=http://127.0.0.1:8000/v1 \
128
- python scripts/eval_l2_skill_description_intervention.py \
129
- --backend gemma \
130
- --limit 200 \
131
- --sample_strategy stratified \
132
- --anonymous_names \
133
- --resume \
134
- --out out/layered/l2_skill_desc_intervention_gemma_anon_n200.json \
135
- --rows_out out/layered/l2_skill_desc_intervention_gemma_anon_n200_rows.jsonl
136
- ```
137
-
138
- Use `--dry_run_prompts` to audit the prompt triplets without calling a model.
139
- The intervention changes only `function`, `effect_on_distance`, and `role`; it
140
- keeps the same skill menu, anonymous skill IDs, cooldowns, and L1 belief.
141
-
142
- Decision-summary generation:
143
-
144
- ```bash
145
- python scripts/summarize_l2_intervention_for_paper.py \
146
- --anonymous_rows out/layered/l2_skill_desc_intervention_gemma_anon_n200_rows.jsonl \
147
- --out_json out/layered/l2_skill_desc_intervention_paper_summary_n200.json \
148
- --out_tex /tmp/l2_decision_semantic_control_check.tex
149
- ```
150
-
151
- Rationale-decision consistency:
152
-
153
- ```bash
154
- python scripts/eval_l2_rationale_consistency.py \
155
- --rows out/layered/l2_skill_desc_intervention_gemma_anon_n200_rows.jsonl \
156
- --out_json out/layered/l2_rationale_consistency_gemma_anon_n200.json \
157
- --out_tex paper/l2_rationale_consistency_rows.tex
158
- ```
159
-
160
- Formal L2 table generation:
161
-
162
- ```bash
163
- python scripts/build_l2_formal_table.py \
164
- --decision_summary out/layered/l2_skill_desc_intervention_paper_summary_n200.json \
165
- --rationale_summary out/layered/l2_rationale_consistency_gemma_anon_n200.json \
166
- --out_tex paper/l2_skill_description_intervention_table.tex
167
- ```
168
-
169
- CLIP reason--description similarity:
170
-
171
- ```bash
172
- HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 \
173
- python scripts/eval_l2_clip_reason_similarity.py \
174
- --predictions out/layered/l2_skill_desc_intervention_gemma_anon_n30_rows.jsonl \
175
- --out out/layered/l2_clip_reason_similarity_gemma_anon_n30.json
176
- ```
177
-
178
- The default evaluation masks skill names and anonymous IDs from rationales
179
- before CLIP encoding. CLIP is an auxiliary diagnostic and is not the formal main
180
- L2 result.
181
-
182
- ## Paper Table Shape
183
-
184
- For the main paper, use compact numeric columns:
185
-
186
- ```text
187
- Method | Belief | Skill MR | Family Acc. | Legal | Cooldown | R-D Align. | R-B Ground. | CF Switch
188
- ```
189
-
190
- Where `R-D Align.` is rationale-decision alignment and `R-B Ground.` is
191
- rationale-belief grounding. Keep long explanations out of table cells.
192
-
193
- For the description-sensitivity ablation, keep it separate and short:
194
-
195
- ```text
196
- Setting / subset | n | No-Desc Flip | Desc-Follow | Name-Bias
197
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/legacy/OLD_l2_registry.json DELETED
@@ -1,80 +0,0 @@
1
- {
2
- "layer": "L2",
3
- "name": "skill_decision",
4
- "status": "core_metrics_reset_to_description_change_and_llm_judge",
5
- "official_belief_source": "out/situation/l1_handoff_raw_rgb_resnet18_decision_finetune_from_dp_current0_e10_official_test.jsonl",
6
- "canonical_methods": [
7
- {
8
- "name": "heuristic",
9
- "type": "deterministic distance/cooldown policy",
10
- "decision_script": "scripts/eval_l2_decision.py",
11
- "official_summary": "out/layered/l2_heuristic_official_test_belief_raw_rgb_l1_handoff.json",
12
- "official_predictions": "out/layered/predictions_l2_heuristic_official_test_belief_raw_rgb_l1_handoff.jsonl",
13
- "rationale_eval": "out/layered/l2_rationale_heuristic_official_test_belief_raw_rgb_l1_handoff.json",
14
- "counterfactual_eval": "out/layered/l2_counterfactual_heuristic_official_test_belief_raw_rgb_l1_handoff.json"
15
- },
16
- {
17
- "name": "belief_mlp",
18
- "type": "learned policy over structured belief fields",
19
- "decision_script": "scripts/eval_l2_belief_policy.py",
20
- "representative_summary": "out/layered/l2_belief_mlp_test_all_covered_belief_latent_cnn_gru_full_e24.json",
21
- "representative_predictions": "out/layered/predictions_l2_belief_mlp_test_all_covered_belief_latent_cnn_gru_full_e24.jsonl"
22
- },
23
- {
24
- "name": "gemma",
25
- "type": "LLM skill selector with strict JSON output",
26
- "decision_script": "scripts/eval_l2_decision.py",
27
- "closed_loop_script": "scripts/l2_gemma_decide.py",
28
- "skill_description_intervention": {
29
- "official_anonymous_ids_n200": "out/layered/l2_skill_desc_intervention_gemma_anon_n200.json",
30
- "official_anonymous_ids_n200_rows": "out/layered/l2_skill_desc_intervention_gemma_anon_n200_rows.jsonl",
31
- "official_paper_summary_n200": "out/layered/l2_skill_desc_intervention_paper_summary_n200.json",
32
- "required_belief_views": [
33
- "full",
34
- "compact"
35
- ],
36
- "core_metrics": [
37
- "no_desc_decision_change_rate",
38
- "swap_desc_decision_change_rate"
39
- ],
40
- "original_names_n30": "out/layered/l2_skill_desc_intervention_gemma_n30.json",
41
- "anonymous_ids_n30": "out/layered/l2_skill_desc_intervention_gemma_anon_n30.json",
42
- "clip_original_names_n30": "out/layered/l2_clip_reason_similarity_gemma_n30.json",
43
- "clip_anonymous_ids_n30": "out/layered/l2_clip_reason_similarity_gemma_anon_n30.json",
44
- "latex_table": "paper/l2_skill_description_intervention_table.tex",
45
- "clip_latex_table": "paper/l2_clip_reason_similarity_table.tex",
46
- "chinese_summary": "paper/l2_skill_description_intervention_zh.md",
47
- "clip_chinese_summary": "paper/l2_clip_reason_similarity_zh.md"
48
- }
49
- }
50
- ],
51
- "evaluation_scripts": {
52
- "decision": "scripts/eval_l2_decision.py",
53
- "belief_mlp": "scripts/eval_l2_belief_policy.py",
54
- "skill_description_intervention": "scripts/eval_l2_skill_description_intervention.py",
55
- "intervention_paper_table": "scripts/summarize_l2_intervention_for_paper.py",
56
- "llm_judge": "scripts/eval_l2_llm_judge.py",
57
- "formal_l2_table": "scripts/build_l2_formal_table.py",
58
- "analysis": "scripts/analyze_l2_predictions.py",
59
- "calibration": "scripts/analyze_l2_rule_calibration.py"
60
- },
61
- "paper_tables": {
62
- "skill_description_intervention": "paper/l2_skill_description_intervention_table.tex",
63
- "rationale_consistency": "out/layered/l2_rationale_consistency_gemma_anon_n200.json"
64
- },
65
- "primary_metrics": [
66
- "no_desc_decision_change_rate",
67
- "swap_desc_decision_change_rate",
68
- "llm_judge_selected_acceptable_rate"
69
- ],
70
- "paper_table_policy": {
71
- "main_table": "numeric compact columns only",
72
- "semantic_similarity": "not a current core metric",
73
- "required_separation": [
74
- "description-removal decision change",
75
- "description-swap decision change",
76
- "independent LLM judge decision quality",
77
- "full vs compact L1 input view"
78
- ]
79
- }
80
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
env.sh CHANGED
@@ -5,9 +5,8 @@ BENCH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
  export BENCH
6
  cd "$BENCH"
7
 
8
- # L2 需要一个常驻的 Gemma OpenAI 兼容服务(必须用 gemma4-venv 环境起,
9
- # 其它环境transformers 版本没有 Gemma4 类):
10
- # /dev_vepfs/junhaochen/envs/gemma4-venv/bin/python pact/gemma_server.py
11
  export GEMMA_OPENAI_BASE_URL="${GEMMA_OPENAI_BASE_URL:-http://127.0.0.1:8018/v1}"
12
  export GEMMA_MODEL="${GEMMA_MODEL:-gemma-4-E2B-it}"
13
  export GEMMA_TEMPERATURE="${GEMMA_TEMPERATURE:-0}"
 
5
  export BENCH
6
  cd "$BENCH"
7
 
8
+ # L2 需要一个常驻的 Gemma OpenAI 兼容服务。服务环境和便携式启动命令见
9
+ # docs/REPRODUCE.md;不要在这里写机器专用Python 或模型绝对路径。
 
10
  export GEMMA_OPENAI_BASE_URL="${GEMMA_OPENAI_BASE_URL:-http://127.0.0.1:8018/v1}"
11
  export GEMMA_MODEL="${GEMMA_MODEL:-gemma-4-E2B-it}"
12
  export GEMMA_TEMPERATURE="${GEMMA_TEMPERATURE:-0}"
evaluation/ablations/pact_eval_v1_20260709/vrising_experiment_status.md DELETED
@@ -1,25 +0,0 @@
1
- # V Rising Evaluation Implementation Status
2
-
3
- ## L1 Main Comparison
4
-
5
- | Method | Train n | Test n | Dist. MAE | dp@2 | Front F1 | Zone Acc. | Lat. ms |
6
- |---|---:|---:|---:|---:|---:|---:|---:|
7
- | DINOv2-S + MLP | 18068 | 8075 | 0.7016 | 0.9336 | 0.8822 | 0.7538 | 4.2276 |
8
- | VideoMAE-B + MLP | 18068 | 8075 | 0.6858 | 0.925 | 0.8706 | 0.7324 | 20.1978 |
9
- | PACT-L1 | 18068 | 8075 | 0.2621 | 0.9962 | 0.9227 | 0.8406 | 0.832 |
10
-
11
- ## L1 Image Ablation
12
-
13
- | Metric | +img PACT-L1 | -img strict prior | Delta |
14
- |---|---:|---:|---:|
15
-
16
- ## L2 Semantic Intervention
17
-
18
- | Belief view | Status | n | No-desc change | Swap-desc change | Desc-follow | Name-bias |
19
- |---|---|---:|---:|---:|---:|---:|
20
- | full_existing_legacy_metadata | missing | None | MISSING | MISSING | MISSING | MISSING |
21
- | full | complete | 200 | 43.7% | 87.8% | 78.7% | 12.2% |
22
- | compact | complete | 200 | 54.4% | 90.2% | 85.9% | 9.8% |
23
-
24
- ## Blockers
25
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
games/hk/README.md CHANGED
@@ -1,111 +1,69 @@
1
  # Hollow Knight
2
 
3
- 3 boss 2D 横版战斗。主线(数据 / L1 / L2)齐全,另外**独有一个历史帧消融**(V Rising 没做)。
 
 
 
4
 
5
- ## 1. 数据是怎么构造的
6
 
7
- ```
8
  data/hk/processed/{FalseKnight,HiveKnight,Hornet}/
9
- policy_view_fight{N}.jsonl ← 决策行:action + obs
10
- render_view_fight{N}.jsonl ← 渲染 prompt → 技能机制描述的来源
11
- video_fight{N}.mp4
12
  ```
13
 
14
- **切分:fight 级**,每个 boss 按 fight 排序,**最后 10 场 test、前 3 场 val**、其余 train。整场对局为单位,无帧泄漏。
15
-
16
- | boss | 总 fight | train / val / test | 技能数 |
17
- |---|---:|---|---:|
18
- | FalseKnight | 226 | 213 / 3 / 10 | 6 |
19
- | HiveKnight | 77 | 64 / 3 / 10 | 6 |
20
- | Hornet | 220 | 207 / 3 / 10 | 7 |
21
- | **合计** | **523** | **484 / 9 / 30** | |
22
-
23
- **官方测试 8,360 行**(30 场)。平均可选技能数 K̄ = 3.42 → **L2 随机基线 29.2%**。
24
-
25
- **距离量纲**:引擎单位,用默认 `--distance_norm 30`。
26
-
27
  ```bash
28
- bash games/hk/data/audit_dataset.sh # → results/hk/dataset_audit.json
29
- python3 games/hk/data/build_metadata.py # → games/hk/{ontology,skill_library}.json
30
- bash games/hk/data/build_manifest.sh # → games/hk/manifest.json
31
  ```
32
 
33
- 技能机制描述来自 `render_view` 的 prompt 短语,冷却/时长统计来自 `policy_view` 日志行 —— **不是人手编的**。
34
- 只有 `build_metadata.py` 里的 `MECHANICS` 表是 HK 特有的,其余推导逻辑共享 `pact/build_game_metadata.py`。
35
-
36
- ## 2. 做了哪些实验
37
-
38
- | 实验块 | 状态 | 入口代码 | 产物 |
39
- |---|---|---|---|
40
- | 数据审计与切分 | ✅ | `games/hk/data/*.sh` `build_metadata.py` | `results/hk/dataset_audit.json` |
41
- | L1 官方评测(主结果) | ✅ | `games/hk/l1/{train_l1,eval_official_from_ckpt}.sh` | `results/hk/l1_main_official_test.json` |
42
- | **L1 消融:历史帧** | ✅ | `games/hk/l1/train_l1.sh`(`history_offsets=0`) | `results/hk/l1_ablation_curframeonly_official_test.json` |
43
- | L2 机制语义干预(compact + full) | ✅ | `games/hk/l2/run_semantic_views.sh` | `results/hk/eval_runs/L2-SEMANTIC-INTERVENTION_*_samplev2_*` |
44
- | L1 主对比(DINOv2/VideoMAE 基线)※ | ✅ | `games/hk/l1/run_foundation_baselines.sh` | `results/hk/l1_baseline_*_official_test.json` |
45
- | L1 预测可信度(无图先验) | ✅ | `games/hk/l1/run_img_ablation.sh` | `results/hk/eval_runs/L1-IMG-ABLATION/` |
46
- | L1 筛选字段(belief probe) | ✅ | `games/hk/l1/run_belief_probe.sh` | `results/hk/eval_runs/L1-FIELD-SELECTION/` |
47
- | L2 图像模态消融(60 状态配对) | ✅ | `games/hk/l2/run_image_modality_ablation.sh`(`--limit 60`) | `results/hk/eval_runs/L2-IMAGE-MODALITY-ABLATION_*` |
48
- | **L2 理由-决策对应(核心)** | ✅ | `games/hk/l2/run_rationale_consistency.sh` | `results/hk/eval_runs/L2-RATIONALE-CONSISTENCY_*` |
49
- | L2 决策质量(LLM judge) | ⏸ 暂缓 | — | 口径未定 |
50
-
51
- > ※ **基线口径(重要)**:基线是冻结主干 + 轻量 probe,PACT-L1 是端到端从零训。两者含「端到端 vs 冻结」这一项差异,故成立的命题是「**任务专训的小网优于冻结的通用视觉特征(作为 belief 抽取器)**」,**不是**「架构 > DINOv2」。要隔离该混淆需补一个基础模型端到端微调的对照(待做)。数据/历史/考卷已对齐(balanced 全 boss、同 5 帧、同 8360)。
52
- >
53
- > V Rising 独有的 **L2 模型消融 / L1 延迟基准 / CLIP 诊断**本游戏未做(聚焦核心块)。完整三游戏清单见 [顶层 README](../../README.md#完整实验清单权威来源) 或 `python3 registry/status.py`。
54
-
55
- ## 3. ckpt
56
-
57
- | ckpt | 用途 |
58
- |---|---|
59
- | `ckpt/hk/l1_main_train30k_e10.pt` | **主结果**。5 帧历史(−8/−4/−2/−1/0),30k 训练样本,10 epoch |
60
- | `ckpt/hk/l1_ablation_curframeonly_e10.pt` | 消融:**只输入当前帧**(同架构、同训练集、同 10 epoch) |
61
-
62
- ## 4. 结果
63
 
64
- **L1**(official test,n = 8,360)
65
 
66
- | 指标 | 值 |
67
- |---|---:|
68
- | 距离 MAE | 0.4695 |
69
- | dp@2 | 0.9726 |
70
- | 角度 MAE | **3.6488°** |
71
- | angle@20° | **0.9792** |
72
- | distance_bin acc | 0.7243 |
73
- | angle_bin acc | **0.0000** ⚠️ 见下 |
74
-
75
- **L1 历史帧消融**(旧口径 test,n = 2,242,两边同口径可比)
76
-
77
- | 输入 | 距离 MAE | 角度 MAE | angle@20° |
78
- |---|---:|---:|---:|
79
- | 5 帧历史 | 0.5160 | — | — |
80
- | 仅当前帧 | 0.5478 | 3.8737° | 0.9737 |
81
-
82
- → **几何主要由当前帧承载**:去掉历史,距离 MAE 只退化约 6%,角度几乎不变。历史帧有贡献但非必需。
83
 
84
- **L2 机制语义干预**(gemma-4-E2B-it,温度 0,200 状态,匿名技能 ID,`L2-SAMPLE-200-v2`,30 场覆盖)
85
 
86
- | belief 视图 | 跟随描述 | 抹除后翻转 | 交换后翻转 | 名字偏见 |
87
- |---|---:|---:|---:|---:|
88
- | **compact**(正典 v3) | **76.2%**(2.61× 随机 29.2%) | 92.2% | 89.6% | 10.4% |
89
- | full(过全 belief 对照 v3) | 47.5%(1.63×) | 89.3% | 94.5% | 5.5% |
 
 
90
 
91
- > **勘误(2026-07-14)**:v2 版输入被未训练头污染(prev/hp 96%+ 错),曾使 HK 虚高(compact follow 89.8→76.2)。
92
- > v3 = 修复后干净输入 + menu≥2 口径;v2 存档于 samplev2 目录仅作 A/B。
 
93
 
94
- 两个结论:
95
 
96
- 1. HK 是三个游戏里 L2 最干净的:抹掉机制描述几乎必然改变决策(89.4%),名字偏见只有 3.0%(三游戏最低)。
97
- 2. **compact 远优于 full,落差 −28.7 点**(V Rising 只有 −8.3 点)——干净数据下结论不变。full 的交换后翻转仍有 94.5%:决策照样会变,只是不再跟着描述走。
98
 
 
 
 
 
 
99
 
100
- **L2 理由-决策对应**(核心指标,确定性审计,同一批 200 状态,compact)
101
 
102
- | 点名对应(覆盖) | 机制重构 | 换述忠实 | 矛盾率 |
103
- |---:|---:|---:|---:|
104
- | 100% (45%) | 75.3% | 100.0% | 11.6% |
 
 
105
 
106
- 四组件+三重负对照定义见 `pact/eval_l2_rationale_consistency.py` 头注释;负对照(no_desc / 错位理由)均塌向随机,指标有区分度。
107
 
108
- ## 5. 已知问题
 
 
 
109
 
110
- - **`player_angle_bin` 分类头 acc = 0.0000** —— 是这个 bin 头本身坏了(连续角度 3.65° 完全正常,同一个头在 V Rising 是 0.72、Isaac 是 0.79)。**未修**。
111
- 不影响 L2:compact 视图不含该字段。
 
1
  # Hollow Knight
2
 
3
+ Hollow Knight contributes False Knight, Hive Knight, and Hornet. Its official
4
+ test split contains 30 fight-disjoint fights. The compact L2 interface uses
5
+ distance and an explicit player-relative side derived from the trained angle
6
+ head.
7
 
8
+ ## Data
9
 
10
+ ```text
11
  data/hk/processed/{FalseKnight,HiveKnight,Hornet}/
 
 
 
12
  ```
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ```bash
15
+ bash games/hk/data/audit_dataset.sh
16
+ python3 games/hk/data/build_metadata.py
17
+ bash games/hk/data/build_manifest.sh
18
  ```
19
 
20
+ ## L1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
+ Published checkpoints:
23
 
24
+ ```text
25
+ ckpt/hk/l1_main_train30k_e10_provenance_v2.pt
26
+ ckpt/hk/l1_ablation_curframeonly_e10.pt
27
+ ckpt/hk/l1_matched_foundation10k_seed0_e10.pt
28
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ Primary entry points:
31
 
32
+ ```bash
33
+ bash games/hk/l1/eval_official_from_ckpt.sh
34
+ bash games/hk/l1/run_foundation_baselines.sh
35
+ bash games/hk/l1/run_matched_foundation10k.sh
36
+ bash games/hk/l1/run_img_ablation.sh
37
+ ```
38
 
39
+ The matched comparison binds exactly 10,000 ordered training rows and all 8,360
40
+ official test rows across PACT-L1, DINOv2-S, and VideoMAE-B. The 30k checkpoint
41
+ is the canonical L1 handoff for downstream L2 evaluation.
42
 
43
+ ## L2
44
 
45
+ The canonical compact protocol is balanced-v3 / HP-free-v6 /
46
+ samplev6-side with 200 states.
47
 
48
+ ```bash
49
+ bash games/hk/l2/run_semantic_views.sh
50
+ bash games/hk/l2/run_rationale_consistency.sh
51
+ bash games/hk/l2/run_image_modality_ablation.sh
52
+ ```
53
 
54
+ The fixed two-choice control uses:
55
 
56
+ ```bash
57
+ HK_MENU_POLICY=counterfactual_two \
58
+ HK_RUN_TAG=test10_samplev6_side_explicit_twochoice \
59
+ bash games/hk/l2/run_semantic_views.sh
60
+ ```
61
 
62
+ Published L2 inputs and outputs are rooted at:
63
 
64
+ ```text
65
+ results/hk/beliefs_l1_main_official_test_compact_side_v1.jsonl
66
+ results/hk/eval_runs/
67
+ ```
68
 
69
+ See `docs/EXPERIMENTS.md` for the current numbers and interpretation.
 
games/hk/config.json CHANGED
@@ -2,8 +2,8 @@
2
  "game_id": "hk",
3
  "hf_repo": "teawhite/vrising",
4
  "processed_root": "data/hk/processed",
5
- "ontology_path": "out/hk/ontology.json",
6
- "skill_library_path": "schemas/hk_skill_library.json",
7
  "entities": [
8
  "FalseKnight",
9
  "HiveKnight",
@@ -12,7 +12,7 @@
12
  "split_policy": {
13
  "unit": "fight",
14
  "val_count": 3,
15
- "test_count": 3,
16
  "rule": "sorted fights; test is last N, val is preceding M"
17
  },
18
  "l1": {
@@ -36,13 +36,12 @@
36
  },
37
  "l2": {
38
  "sample_size": 200,
39
- "sample_strategy": "stratified",
40
  "belief_views": [
41
- "full",
42
  "compact"
43
  ],
44
  "model_id": "gemma-4-E2B-it",
45
  "temperature": 0
46
  },
47
- "status": "data_audit_ontology_skill_library_and_manifest_ready_l1_l2_training_blocked"
48
  }
 
2
  "game_id": "hk",
3
  "hf_repo": "teawhite/vrising",
4
  "processed_root": "data/hk/processed",
5
+ "ontology_path": "games/hk/ontology.json",
6
+ "skill_library_path": "games/hk/skill_library.json",
7
  "entities": [
8
  "FalseKnight",
9
  "HiveKnight",
 
12
  "split_policy": {
13
  "unit": "fight",
14
  "val_count": 3,
15
+ "test_count": 10,
16
  "rule": "sorted fights; test is last N, val is preceding M"
17
  },
18
  "l1": {
 
36
  },
37
  "l2": {
38
  "sample_size": 200,
39
+ "sample_strategy": "balanced boss/fight/distance stratified v3",
40
  "belief_views": [
 
41
  "compact"
42
  ],
43
  "model_id": "gemma-4-E2B-it",
44
  "temperature": 0
45
  },
46
+ "status": "official_test10_l1_l2_available"
47
  }
games/hk/data/README.md DELETED
@@ -1,14 +0,0 @@
1
- # HK Data
2
-
3
- Expected location after download:
4
-
5
- `data/hk/processed`
6
-
7
- The processed directory should contain one subdirectory per controllable entity
8
- with `video_fight*.mp4`, `policy_view_fight*.jsonl`, `render_view_fight*.jsonl`,
9
- and `dataset_manifest.json`.
10
-
11
- `build_metadata.py` derives `games/hk/ontology.json` and
12
- `games/hk/skill_library.json` from HK policy rows and render prompts. The
13
- skill mechanics are conservative data-derived descriptions, not human-validated
14
- game-design annotations.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
games/hk/l1/README.md DELETED
@@ -1,8 +0,0 @@
1
- # HK L1
2
-
3
- HK L1 should be trained independently from V Rising. The HK dataset audit and
4
- manifest are ready, and a 24-sample RGB cache smoke test passed.
5
-
6
- `train_l1.sh` is a guarded entry point. It refuses to start heavy training until
7
- formal HK train/test RGB caches exist, `HK_ALLOW_HEAVY_TRAINING=1` is set, and
8
- the selected GPU is idle enough.
 
 
 
 
 
 
 
 
 
games/hk/l1/run_matched_foundation10k.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
4
+ cd "$ROOT"
5
+ bash pipelines/l1/train/run_hk_matched_foundation10k.sh
games/hk/l1/run_train30k_pipeline.sh CHANGED
@@ -14,9 +14,9 @@ GPU_WAIT_SECONDS="${GPU_WAIT_SECONDS:-300}"
14
 
15
  TRAIN_CACHE="${TRAIN_CACHE:-out/hk/situation/raw_rgb_train30k_current0_h192w336.pt}"
16
  TEST_CACHE="${TEST_CACHE:-out/hk/situation/raw_rgb_test_official_current0_h192w336.pt}"
17
- OUT_JSON="${OUT_JSON:-out/hk/situation/raw_rgb_resnet18_decision_train30k_from_dp_current0_e10_official_test.json}"
18
- BELIEF_OUT="${BELIEF_OUT:-out/hk/situation/beliefs_raw_rgb_resnet18_decision_train30k_from_dp_current0_e10_official_test.jsonl}"
19
- CKPT_OUT="${CKPT_OUT:-ckpt/hk/l1_main_train30k_e10.pt}"
20
 
21
  mkdir -p out/hk/situation out/hk/logs
22
 
 
14
 
15
  TRAIN_CACHE="${TRAIN_CACHE:-out/hk/situation/raw_rgb_train30k_current0_h192w336.pt}"
16
  TEST_CACHE="${TEST_CACHE:-out/hk/situation/raw_rgb_test_official_current0_h192w336.pt}"
17
+ OUT_JSON="${OUT_JSON:-results/hk/l1_main_official_test.json}"
18
+ BELIEF_OUT="${BELIEF_OUT:-results/hk/beliefs_l1_main_official_test_compact_side_v1.jsonl}"
19
+ CKPT_OUT="${CKPT_OUT:-ckpt/hk/l1_main_train30k_e10_provenance_v2.pt}"
20
 
21
  mkdir -p out/hk/situation out/hk/logs
22
 
games/hk/l2/README.md DELETED
@@ -1,50 +0,0 @@
1
- # HK L2
2
-
3
- Semantic intervention: swap the mechanic description of skill A onto skill B and
4
- check whether the decision follows the swapped semantics instead of the skill
5
- identity.
6
-
7
- ## Canonical setting
8
-
9
- - `belief_view=compact` (the Fig. 1 interface).
10
- - `gemma-4-E2B-it`, temperature 0, 200 stratified states, anonymous skill IDs.
11
- - Variants per state: `full` / `no_desc` / `swap_desc`.
12
-
13
- L2 consumes the flat L1 beliefs directly (`out/hk/situation/beliefs_*.jsonl`).
14
- There is no separate handoff file.
15
-
16
- ## Run
17
-
18
- Needs a Gemma OpenAI-compatible endpoint on `GEMMA_OPENAI_BASE_URL`
19
- (default `http://127.0.0.1:8018/v1`, started from the `gemma4-venv` env).
20
-
21
- ```bash
22
- bash games/hk/l2/run_semantic_views.sh
23
- ```
24
-
25
- Writes `metrics.json`, `rows.jsonl`, and `run_config.json` under
26
- `results/hk/eval_runs/L2-SEMANTIC-INTERVENTION_gemma-4-E2B-it_compact_.../`.
27
-
28
- ## Result (n=200, verified)
29
-
30
- | metric | compact |
31
- |---|---|
32
- | no-description change | 92.4% |
33
- | swapped-description change | 98.0% |
34
- | **desc-follow** | **95.0%** |
35
- | neither (noise) | 1.0% |
36
- | valid (on-menu) | 99.0% |
37
-
38
- Random follow baseline is 29.2% (mean menu size 3.42), so compact is 3.25x
39
- chance. Per boss: FalseKnight 95.6%, HiveKnight 97.0%, Hornet 92.2%.
40
-
41
- `name_bias` is not reported as independent evidence: it is identically
42
- `100% - swap_change`, so it restates the change rate rather than adding
43
- information. The informative split is desc-follow vs neither.
44
-
45
- ## Kept for reference, not canonical
46
-
47
- A `belief_view=full` run exists under `results/hk/eval_runs/..._full_.../` (desc-follow
48
- 62.4%, neither 33.5%). It is the evidence for "compact beats full" and is cited in
49
- the summary deck, but it is not part of the canonical HK L2 setting. To reproduce
50
- it: `HK_BELIEF_VIEW=full bash games/hk/l2/run_semantic_views.sh`.