fix(spatial): 稳定性家族加入"无害编辑",打破"编辑⇒false"的一位捷径

基线表量出:三个训练家族的标签被"发生过编辑就答 false"完全可分(各 1.000),
模型在 10 个家族里有 6 个与该规则的分数逐位相同,说明四个结构件没有一个被用到。

稳定性家族此前唯一的编辑是移走基座 P,必然倒塌,于是"移走了东西"和"目标失去
支撑"在所有样本上是同一个事件。改为:
- 增加诱饵块 D(坐在地面上、不承载任何东西、可见),移走它不改变结论;
- 目标固定为 T;n_blocks>=3 时移走 U 也不改变结论;
- 编辑分布:40% 移 P(倒塌)、35% 移无害块(无影响)、25% 不编辑。

同时把旧的可分配置留作对照 configs/cross_oneshot.json。
This commit is contained in:
liuhuajie committed 2026-12-03 18:19:57 +08:00
1 parent 14f93019ac
commit f5443278b9
3 files changed
+64 -12

No files matched your search

+4 -4
View File
@@ -5,11 +5,11 @@
"rounds": 2, "n_evidence": 4 "rounds": 2, "n_evidence": 4
}, },
"data": { "data": {
"train_families": ["cond.p1", "area.sup2", "dof.c6"], "train_families": ["cond.p1", "cond.p3", "area.sup2", "area.sup3", "dof.c6", "dof.c6r", "cond.p1h"],
"val_families": ["cond.p1h", "area.sup2h", "dof.c6h"], "val_families": ["cond.p3h", "area.sup2h", "dof.c6h"],
"test_families": ["cond.p3h", "area.sup3", "dof.c6r"] "test_families": ["cond.p3h", "area.sup2h", "dof.c6h"]
}, },
"optim": { "lr": 0.003, "weight_decay": 0.01, "steps": 1200, "batch": 32, "log_every": 200 }, "optim": { "lr": 0.003, "weight_decay": 0.01, "steps": 2400, "batch": 32, "log_every": 400 },
"eval": { "n": 192 }, "eval": { "n": 192 },
"out_dir": "out_spatial/cross" "out_dir": "out_spatial/cross"
} }
+40
View File
@@ -0,0 +1,40 @@
{
"seed": 0,
"model": {
"d": 192,
"n_layer": 4,
"n_head": 6,
"dropout": 0.1,
"max_entities": 32,
"rounds": 2,
"n_evidence": 4
},
"data": {
"train_families": [
"cond.p1",
"area.sup2",
"dof.c6"
],
"val_families": [
"cond.p1h",
"area.sup2h",
"dof.c6h"
],
"test_families": [
"cond.p3h",
"area.sup3",
"dof.c6r"
]
},
"optim": {
"lr": 0.003,
"weight_decay": 0.01,
"steps": 1200,
"batch": 32,
"log_every": 200
},
"eval": {
"n": 192
},
"out_dir": "out_spatial/cross_oneshot"
}
+20 -8
View File
@@ -99,13 +99,21 @@ def _build_connection(rng, n_paths: int, hidden: int):
def _build_stability(rng, n_blocks: int, hidden: int): def _build_stability(rng, n_blocks: int, hidden: int):
# D is a decoy: it rests on the ground next to the stack and carries
# nothing. Without it "something was removed" and "the target lost support"
# are the same event on every sample, and a one-bit rule fits the whole
# family -- measured: that rule scores 1.000 here while knowing no physics.
ents = [Entity("G", "ground", attrs={"plane": 0}), ents = [Entity("G", "ground", attrs={"plane": 0}),
Entity("P", "block", attrs={"box": [40, 40, 0, 60, 60, 20]}), Entity("P", "block", attrs={"box": [40, 40, 0, 60, 60, 20]}),
Entity("T", "block", attrs={"box": [42, 42, 20, 58, 58, 36]})] Entity("T", "block", attrs={"box": [42, 42, 20, 58, 58, 36]}),
edges = [Edge("kPG", "contact", "P", "G"), Edge("kPT", "contact", "T", "P")] Entity("D", "block", attrs={"box": [80, 40, 0, 100, 60, 16]})]
edges = [Edge("kPG", "contact", "P", "G"), Edge("kPT", "contact", "T", "P"),
Edge("kDG", "contact", "D", "G")]
top = None
if n_blocks >= 3: if n_blocks >= 3:
ents.append(Entity("U", "block", attrs={"box": [44, 44, 36, 56, 56, 48]})) ents.append(Entity("U", "block", attrs={"box": [44, 44, 36, 56, 56, 48]}))
edges.append(Edge("kTU", "contact", "U", "T")) edges.append(Edge("kTU", "contact", "U", "T"))
top = "U"
vis_edges = {e.eid for e in edges} vis_edges = {e.eid for e in edges}
vis_ents = {e.eid for e in ents} vis_ents = {e.eid for e in ents}
layers = set() layers = set()
@@ -118,12 +126,16 @@ def _build_stability(rng, n_blocks: int, hidden: int):
vis_edges.discard(e.eid) vis_edges.discard(e.eid)
vis_ents.discard("P") vis_ents.discard("P")
target = "U" if n_blocks >= 3 else "T" # the target is T on purpose: it survives every legal edit except the one
query = Query(kind="stability", a=target) # that removes P, so "removed something" no longer implies "answer false"
# an edit can only name something the observation shows; with the pedestal query = Query(kind="stability", a="T")
# hidden the only legal edit is "nothing changes" r = rng.random()
if not hidden and rng.random() < 0.5: if not hidden:
query.edit = {"op": "remove_entity", "entity": "P"} harmless = top or "D"
if r < 0.4:
query.edit = {"op": "remove_entity", "entity": "P"} # collapses
elif r < 0.75:
query.edit = {"op": "remove_entity", "entity": harmless} # no effect
return ents, edges, query, vis_edges, vis_ents, layers, ["front", "iso"], {"length": "mm", "per_unit": 1} return ents, edges, query, vis_edges, vis_ents, layers, ["front", "iso"], {"length": "mm", "per_unit": 1}