Virtual Embryo Challenge更新于 10-04 02:57(北京时间) / 每 5 分钟更新

总览 · ← 返回运行 20261003-172000-search-t2-heart-extrap-chain-12h

节点 n42

dp 钉死下的空间速度扩散(W=0.7,15-NN)+同型 NN 再闭合参考+逐基因方差对齐:DE 逐位冻结,nb_mmd/mmd_u 随强度单调改善。

运行?一次完整的自动搜索或 Agent 会话,有自己的锁定配置和证据包。20261003-172000-search-t2-heart-extrap-chain-12h
父节点n40
子节点n45
操作?种子:人写的起点;改进:在父节点上改;草稿:从头写;修复:修父节点的报错。改进
状态已打分
分数搜索目标分 57.82(+0.2) · proxy_noscale 57.82(+0.2) · 3 次复测均分 57.85
审查通过 1 越界读取:未发现问题——run.py 仅经 src.task2_spatial.view_io(load_manifest/read_stage/panel_genes/anchor_entry/extrap_step)与 sample.take 读取 manifest 指定输入;无绝对路径、'..'、/mnt、data/raw、external/、prior/、评分器路径,无网络访问(全文无 open/urllib/requests 命中)。; 2 硬编码目标统计量:未发现问题——所有量(伪批量、速度、比率场、型中位、NN 参考、PBC 基准=median 原始总量 run.py:11…
用时?从运行开始到结束(或到现在)的挂钟时间。1 小时 25 分
程序版本22a4ad8a331b6b24c6885c062eacc72cfacd41da (programs.git)

方法说明?节点程序自带的 METHOD.md:这个程序做了什么、为什么。

来自 programs.git 22a4ad8a33:solution/METHOD.md

dp 钉死下的空间速度扩散(W=0.7,15-NN)+同型 NN 再闭合参考+逐基因方差对齐:DE 逐位冻结,nb_mmd/mmd_u 随强度单调改善。

节点 42:dp 钉死的空间速度扩散(T2:heart:val_extrap,T2HX-01,父=节点 40)

方法(提交配置 = run.py 默认值)

基座完全承自节点 40:copy_last(坐标/行序/细胞数/组成冻结)、ε=0.1 两步支撑掩码扩散底物、 rel 速度 v_t=(m_a−m_p)/(m_p+1)、k=0.5 软阈值、α=1 乘法位移、γ=1.35 几何再闭合、 β_rec=0.15 场低通+电平中性、型内中位参考(封顶 [1/3,3]×全局)、PBC=10、双硬门控、 逐基因伪批量 Newton 复原。本节点新增三件事:

  1. 并行路径重构 + dp 钉死(保护层扩展):并行(钉死)路径现在从未扩散的速度场完整重跑 节点 40 的计算(自己的位移、比率场、低通、全局参考再闭合、电平匹配、PBC),硬门控也改读这条 路径的 dp——pb 复原把写出的 dp 钉到它,门控保护的就是实际写出的输出。因此主路径上的任何 "再分配类"机制在构造上不可能移动 de_score/de_direction(本节点所有查分中两项逐位冻结在 父值 0.2778/0.3839 A 半)。
  2. 主机制:空间速度扩散(VEC_VDIFF_W=0.7,K=15):V ← (1−W)·V + W·mean(V over 15 个最近 坐标邻居)。节点 37 曾测得 nb_mmd 随 W 跨 9 个解码单调改善,但因扩散搬动群体 dp、 以 de_direction 等值交换而被证否;在 dp 钉死下该代价消失,机制只能把表达在基因列内空间 连贯地重排。这是被证否机制在新保护层下的复活,不是重复。
  3. 同型 NN 再闭合参考(PLAN 主机制,VEC_REC_REF=nn,NN_MIN=1)+ 逐基因方差对齐 (VEC_VAR_ALIGN=1):r_ref_i = i 的坐标 15-NN 中同型邻居的平滑比率场 r̃ 均值 (封顶同 [1/3,3]×全局中位;同型邻居 < NN_MIN 时退回型内中位=节点 40 行为)。方差对齐在 pb 复原后把每个基因列绕自身均值的离差按 σ(并行路径)/σ(当前) 缩放(列均值不动 → dp 精确不变), 重贴支撑掩码后再做一次 Newton 复原把 pb 重新钉死(残差 ≤ 2e-15)。

单输入阶段(<2 个输入)时整体逐位回退 copy_last(与父相同,已复验)。 --ablate nn_ref(任意名同样处理)关闭本节点全部三个机制(W→0、参考退回型内中位、方差对齐关), 输出逐位等于父节点 40(h5 array_equal 验证通过)。

关键参数

参数值说明
VEC_VDIFF_W / K / STEPS0.7 / 15 / 1主机制幅度;W 网格 0.3–1.0 内点峰
VEC_REC_REF / NN_MIN / NN_K / λ / meannn / 1 / 15 / 1.0 / linPLAN 主机制;NN_MIN 10→1 单调
VEC_VAR_ALIGN / CAP1 / 2.0二级机制;cap 在 W=0.7 下不绑定(ratio q10–q90 = 1.03–1.10)
其余承自节点 40ε=0.1、γ=1.35、β_rec=0.15、cap=3、PBC=10、k=0.5、α=1

查分记录(A 半,proxy_noscale,共 15 次;父节点 40 的 A 半 = 57.332,见其 README)

配置总分nb_mmdmmd_uvariogramde_score/de_dir
父 40(README 记录值)57.3320.076210.046300.0354140.2778/0.3839
PLAN 主机制 nn NN_MIN=557.3520.075980.046310.035929冻结
nn λ=0.5 / λ=0.2557.352/57.3440.07604/0.076110.0462/0.04623~0.03596冻结
nn NN_MIN=10 / 3 / 157.299/57.374/57.3740.07638/0.07585/—0.04658/0.04610/—~0.03597冻结
nn 几何均值解码57.3380.076150.046280.035965冻结
nn1 + 方差对齐57.4650.075640.045370.035655冻结
型参考 + 方差对齐57.3830.076100.046050.035659冻结
vdiff W=0.3 / 0.5 / 0.7(+va)57.463/57.501/57.5140.07573/0.07508/0.074860.04576/0.04490/0.044700.03593/0.03615/0.03637冻结
vdiff W=0.7(无 va)57.3670.075730.045760.036435冻结
vdiff W=1.0(+va)57.5100.074820.044530.036597冻结
vdiff W=0.7 K=30(nn1+va)57.5300.074580.044570.036546冻结
vdiff W=0.85(nn1+va)57.5290.074720.044460.036515冻结
vdiff 2 步 W=0.5(nn1+va)57.5320.074680.044480.036509冻结
直方图匹配解码(nn1+vd07)51.780.129210.070780.038420冻结
提交:nn1+vd07+va57.5410.074680.044470.036399冻结

机制生效的证据

  • 实际改变了哪些细胞:全部 24,826 个细胞的表达都参与扩散重排(moved_frac=1.0);同型 NN 参考覆盖 91%(NN_MIN=1,中位同型邻居数 8;NN_MIN=5 时 73%);方差对齐逐列缩放中位 1.058。 输出与父逐位不同(mean abs diff ≈ 0.03 log1p 单位),坐标/行序/细胞数/零支撑逐位不变。
  • 四组分变化(A 半 vs 父 README A 半):local_spatial 60.13→60.54(nb_mmd 0.07621→0.07468, 跨 W∈{0.3,0.5,0.7,0.85,1.0}+K30+2步 共 7 个解码单调,结构性位移);cell_state 59.01→59.33(mmd_u 0.04630→0.04447 单调改善;variogram 0.035414→0.036399 是代价, 方差对齐吸收了约 1/4);expression_change 60.29 逐位冻结(dp 钉死按构造保证, 全部 15 次查分 de_score=0.2778、de_direction=0.3839 无一例外);shape_scale 50.00 地板不变 (坐标冻结,结构门=1,邻域 skill 0.60>0.5)。
  • 生物学读法:位移场空间扩散 = 假设发育信号在局部组织中连贯(旁分泌/邻域效应), 邻居共享的位移方向比单细胞型级估计更接近真实外推;再闭合参考局部化 = 把"离群亮度" 校正定义在空间邻域内。两者都只用输入数据现场计算,无任何阶段特异常数。
  • 对照:--ablate nn_ref 输出与父节点 40 预测文件 array_equal = True(本次会话实测)。 mechanism_active = yes(关闭后输出逐位变化)。

验证过什么

  • 默认配置输出 == 最佳查分配置预测(逐位);seed 0/1/2 逐位一致(锚阶段细胞数 ≤ max_cells, 分层抽取返回全部行)。
  • 伪装视图(时间统一 +1 天、manifest 键序打乱、文件改名换路径)输出逐位一致 → 视图无关。
  • 单输入视图:逐位 copy_last(24,826 细胞原样)。
  • vec-check 通过;float64 中间量有限、非负;pb 复原残差 ≤ 2e-15、方差对齐后二次复原残差 ≤ 2e-15。
  • 运行时 ~13 s、峰值内存 2.6 GB(限额 30 min / 28 GB);CPU(EXECUTION.json gpu:false)。

没验证什么 / 风险

  • 本地 A 半 +0.209 小于 T2 约 1 分的总分噪声;提交依据是父节点教训要求的跨解码单调 raw 位移 (nb_mmd/mmd_u 各 7 个解码单调),不是总分。本榜本地尺子历史上高估外推(54.2→49.6), B 半与官网分可能不兑现全部增益。
  • variogram 付出 0.035414→0.036399:扩散改变列内分布形状(型边界细胞拿到混合速度 → 中间值增多),σ 对齐只吸收一部分;直方图匹配(钉死全部边际)已实测灾难性失败 (列独立重排摧毁跨基因联合结构,nb_mmd 0.129、结构门 0.61),不要重试。
  • W=0.7 是 A 半上的内点峰(0.5→0.7→0.85/1.0 = 57.501→57.541→57.529/57.510),峰很平; B 半峰位可能略移,但单调性保证不会崩塌。
  • 真实 final 视图(3 输入)上速度来自最后两个输入,与代理结构相同;同型 NN 覆盖率、 扩散强度都由数据现场决定,无视图特判。未在 final 视图实跑(不可得)。

知识来源

  • 位移场空间连贯性假设:通用旁分泌/形态梯度信号知识(局部细胞群共享信号环境), 非阶段特异测量;未使用任何保留阶段(E8.5/E10.5/E12.5、禁窗 9.5<E≤13.5、(8.25,8.75)) 数据或其测量值。view 的 external/、prior/ 未被本方法读取。
  • 评分规则事实(八项指标、结构门、dp 只读列均值/列内成对距离)来自任务书评分简报(公开评分代码)。
  • 继承基座的生物学与参数依据见父节点 40 的 METHOD/README(型级速度、CP10k 总量不变量、 PBC 钳位等),本节点未新增任何硬编码统计量。

已证否(本节点新增,勿在此基座重试)

  • 逐列直方图匹配到并行路径(VEC_HIST_MATCH=1):51.78,见上。钉死全部边际但列间独立重排 → 联合结构(细胞状态)被摧毁。教训:再分配类机制必须保持跨基因的细胞级耦合, 只能钉"每列的均值"(Newton 复原)或"每列的二阶矩"(方差对齐),不能钉整列多重集再重排。
  • PLAN 主机制单独使用(同型 NN 参考,6 个解码:NN_MIN∈{10,5,3,1}、λ∈{0.5,0.25}、 lin/log 均值):57.299–57.374 vs 父 57.332,全部在 ±0.05 噪声带内;nb_mmd 有单调但 微小的改善(0.07638→0.07585),variogram 付出更多。按 PLAN 判无效门槛属"不优于父", 已按任务书要求换备选机制(dp 钉死的 vdiff)提交,NN 参考仅作为叠加组件保留(+0.027)。
  • VDIFF 2 步核(W=0.5×2):57.5315,与单步 W=0.7 持平且 variogram 更差。
  • VDIFF_K=30:nb_mmd 最好(0.07458)但 variogram/mmd_u 付出更多,总分 57.5304 < 提交配置。

调研员的计划

名称空间局部再闭合参考:同型15-NN均值替代型中位数,攻nb_mmd
动机父节点40(57.59)的local_spatial组60.69为全树最佳但仍远低于天花板:nb_mmd raw 0.07304(skill 0.607,12.5/25分),权重25+门,是剩余最大杠杆。cell_state组59.32中variogram 0.03528比祖父节点33的0.03471微付(-0.05分),是唯一退步项。Analyst建议'用邻域均值版r̃作参考'和'逐基因二阶矩对齐'。已证否方向:β_rec增大(节点35网格,nb_mmd单调变差)、VDIFF速度场混合(节点37,de_direction等值交换)、线性空间锚点混合(节点39,全劣于父)。本方案区别于β_rec:β_rec平滑的是r̃场本身(分子分母同时模糊),本方案只把参考点(分子)换成空间局部统计量,保持逐细胞r̃(分母)锐利,是对离群值的局部校正而非全局模糊。
做法在节点40管线(copy_last基座、ε=0.1、rel速度、k=0.5、α=1、γ=1.35、β_rec=0.15+电平中性、PBC=10、双硬门控、型内中位再闭合+cap3+pb复原)上,仅改再闭合参考点r_ref_i的计算:

1) 主机制(VEC_REC_REF=nn):对每个锚阶段细胞i,在坐标15-NN中取与i同型的邻居集合N_i;r_ref_i = mean(r̃_j, j∈N_i)。同型邻居<VEC_NN_MIN(默认5)时退回型中位数(=节点40行为)。r_ref_i仍经cap [global_med/3, global_med×3]。s_i=(r_ref_i/r̃_i)^γ,后续PBC、pb复原(并行跑全局参考路径、Newton列缩放)完全不变。

2) 参数初值与搜索:
- 第一档:VEC_NN_MIN=5,直接查分(1次)。
- 若优于父(A半>57.59):扫NN_MIN∈{3,10}(2次)。
- 若不优于父:试混合参考 r_ref=(1-λ)×type_median+λ×nn_mean,λ∈{0.5,0.25}(2次)。
- 上限6次查分用于主机制网格。

3) 二级机制(仅当主机制确认后、仍有查分余额):VEC_VAR_ALIGN=1,pb复原后逐基因方差对齐:x'_g=mean_g+(x_g-mean_g)×(σ_parent_g/σ_cur_g),预期修复variogram 0.03528→≤0.0347。1-2次查分。

4) 离线预检(不耗查分):
a) 确认输出与父逐位不同(节点40教训:3次额度浪费在静默回退);
b) 统计同型15-NN覆盖率:若>50%细胞的同型邻居<5,说明型内空间聚集度不足,主机制退化为型中位(=无操作),应提前终止;
c) 计算nn_mean与type_median的相关性:若Pearson>0.98,空间变异不足,预期增益<噪声。

5) 单输入阶段退路:与父相同,输入阶段<2时整体回退copy_last(已验证)。

6) vec-score快速筛选:每次查分前离线算nb_mmd的替代指标(预测的15-NN均值表达与锚阶段15-NN均值表达的余弦距离),只有替代指标改善才送查分。
风险1) 型内空间聚集度不足:若同型细胞在空间上均匀散布,15-NN中同型邻居极少,r_ref退回型中位=无操作。Engineer应在离线预检(b)中发现(>50%细胞邻居不足),立即终止不查分。2) 空间变异不足:若型内r̃空间梯度很弱(nn_mean≈type_median),机制等效于无操作,输出与父逐位相同。离线预检(c)可提前发现。3) nb_mmd改善但variogram进一步恶化:空间局部参考可能改变基因列内方差结构。二级机制(方差对齐)可补救;若variogram raw>0.0360,优先加方差对齐而非继续扫主机制参数。4) 本榜是外推榜、本地尺子已知高估(历史本地54.2→官网49.6):A半+0.3以内应视为噪声,判断依据是nb_mmd raw的跨解码单调性而非总分。5) 查分额度有限(20次):主机制最多6次+二级2次+确认2次=10次,留余量给意外。

代码改动?这个节点的程序和父节点程序的逐行差别:绿色是新增,红色是删除。

对比:父节点版本 40f41eea76。改动的文件:solution/METHOD.md +115 −56、solution/README.md +23 −17、solution/run.py +346 −57

diff --git a/solution/METHOD.md b/solution/METHOD.mdindex dd8037a..d23ea1d 100644--- a/solution/METHOD.md+++ b/solution/METHOD.md@@ -1,59 +1,118 @@-型内中位再闭合(封顶±3×)+逐基因伪批量精确复原:保留位移导致的型间总量结构、同时 dp 与父节点逐位一致,机制只能在细胞间再分配表达--## 方法族与谱系--- family_id: T2HX-01(按型伪批量乘法外推),父节点 35,管线其余全部冻结(copy_last 基座、ε=0.1 两步底物平滑、rel 速度 v_t=(m_a−m_p)/(m_p+1)、k=0.5 软阈值、α=1、γ=1.35 几何再闭合、β_rec=0.15 场平滑+电平中性、PBC=10、双硬门控、坐标/行序/细胞数/组成不动)。-- 本节点唯一改动:再闭合参考点 `s_i=(r_ref_i/r̃_i)^γ` 中的 `r_ref_i`,以及一层伪批量复原保护。--## 提交配置(默认值已烧进 run.py)--1. **型内参考**(`VEC_REC_SCOPE=type`):`r_ref_i` = 细胞 i 所属型内平滑总量比场 r̃ 的中位数;型内锚细胞 <30(`VEC_REC_TYPE_MIN`)时用全局中位数(PLAN 风险 1 的守卫)。-2. **封顶**(`VEC_REC_CAP=3.0`):型内中位数夹到 [全局/3, 全局×3]。本视图上原始型内中位数跨 0.44×–44823×全局(Allantois 8×10⁴、SOM 5916、Neural Tube 332)——不封顶时高速型细胞被留在 PBC=10× 钳位上(19% 细胞钳死),DE 崩塌的直接来源。-3. **伪批量精确复原**(`VEC_PB_RESTORE=1`,20 次对数域 Newton,残差 ≤2e-15):并行跑一遍全局参考(=父节点 35 逐位)的再闭合+PBC 得到目标逐基因 pb;型内参考输出在 PBC 之后按逐基因单一列因子缩放,使最终 pb 与父节点**精确相等**。因此 dp、de_score、de_direction 逐位保持父节点值(实测两项 raw 0.2778/0.3839 与父完全一致),机制只能在每个基因列内部**再分配**细胞间表达,无法倾斜群体均值。列因子保零模式(支撑集两路相同)、不引入任何拟合常数(两路都是输入数据的纯函数)。--## PLAN 机制的证否记录(不封顶的 λ 混合,PLAN 原样实现)--守卫(PLAN 给定):nb_mmd raw ≤0.0820、de_direction ≥0.383、de_score ≥0.2778。A 半查分(评分器确定性已复核:同一文件重查逐位同分):--| 配置 | A半总分 | de_score | de_direction | mmd_u | variogram | nb_mmd | 守卫 |-|---|---|---|---|---|---|---|---|-| 父节点 35 | 56.869 | 0.2778 | 0.3839 | 0.04853 | 0.035414 | 0.08093 | — |-| λ=0.15 | 55.981 | 0.2222 | 0.3379 | 0.04770 | 0.040441 | 0.08200 | DE 双破 |-| λ=0.3 | 56.017 | 0.2222 | 0.3327 | 0.04696 | 0.040987 | 0.08130 | DE 双破 |-| λ=0.5 | 56.009 | 0.2222 | 0.3175 | 0.04616 | 0.041623 | 0.08056 | DE 双破 |-| λ=1.0 | 55.633 | 0.1667 | 0.2684 | 0.04564 | 0.042577 | 0.07925 | DE 双破 |--mmd_u 按 PLAN 预期单调改善、nb_mmd 也改善,但 de_direction/de_score 随 λ **单调崩塌**(型间亮度倾斜直接搬动群体伪批量),variogram 同步变差,λ 全网格远低于父节点——PLAN 原样机制证否(4 个幅度 + 下方封顶 2 个解码,共 ≥6 次查分)。--**PLAN 动机的事实性修正**:锚阶段每个细胞的线性总量精确 =1e4(CP10k),31 个型的型内中位总量全部逐位相同(运行时实测,CV=0)。“真值中型间总量有天然差异”在本数据里不成立;r̃ 的型间差异完全来自**速度导致的位移膨胀**。机制仍然有效,但生效通道是“保留与位移幅度成比例的型级总量结构”,不是恢复什么天然差异。--## 提交解码的查分(封顶 + pb 复原)--| 配置 | A半总分 | mmd_u | variogram | nb_mmd | DE 两项 |-|---|---|---|---|---|---|-| cap1.5+restore | 57.190 | 0.04699 | 0.035649 | 0.07778 | 逐位=父 |-| cap2+restore | 57.290 | 0.04669 | 0.035783 | 0.07661 | 逐位=父 |-| cap2.5+restore | 57.317 | 0.04649 | 0.035883 | 0.07633 | 逐位=父 |-| **cap3+restore(提交)** | **57.332** | **0.04630** | 0.035963 | **0.07621** | 逐位=父 |-| λ=1 不封顶+restore | 57.271 | 0.04590 | 0.036896 | 0.07635 | 逐位=父 |-| cap3+restore+γ=1.45 | 57.323 | 0.04669 | 0.035297 | 0.07629 | 0.2639/0.3900 |--cap 曲线在 3.0 处内部峰值(+0.463 A半 vs 父),γ=1.45 持平(de_score −1 量化步)故保 γ=1.35。分组:cell_state mmd_u 升(PLAN 目标 ≤0.046 达成)、variogram 微付;local_spatial nb_mmd 0.08093→0.07621 为**全树最佳**且随机制强度跨 5 个解码单调(父→cap1.5→cap2→cap2.5→cap3→不封顶:0.08093/0.07778/0.07661/0.07633/0.07621/0.07635)——结构性而非噪声;expression_change 逐位冻结;shape_scale 坐标冻结=地板。细胞总量中位 1.825×→~1.5× 基线,**更靠近**实测阶段的 CP10k 不变量(与节点 35 拒绝的“提亮”方向相反)。--## 机制生效证据(对照 PLAN mechanism_evidence)--1. 型间 r̃ 中位比跨 0.44×–44823×(CV=5.12)≫10% —— 机制有作用空间(但来源是速度膨胀,见上)。-2. mmd_u raw 0.04853→0.04630(skill 0.551→0.558,+0.11 pts);nb_mmd raw −0.0047(skill +0.014,+0.22 pts,权重 25)。-3. 型间总量结构:父节点输出各型中位总量被压向共同水平;提交版按位移幅度恢复型级差(封顶后 ≤3^γ≈5.5×,pb 复原后基因均值不变、型间相对差保留在列内)。-4. de_score/de_direction 逐位不变(pb 最大残差 1.8e-15)——改动不触碰基因排序,与 PLAN 判据一致。-5. 关闭对照:`--ablate <任意名>`(含 `mechanism`、`rec_scope`)→ 型内参考与 pb 复原同时关闭 → 输出与父节点 35 **逐位相同**(h5 data/indptr/坐标 array_equal 验证);`VEC_REC_SCOPE=global` 等效。harness 对照运行将得到 mechanism_active=yes 的逐位差异证据。--## 验证过 / 未验证--- 已验证:seed 0/1/2 逐位一致(锚阶段 ≤ max_cells,逐位与 seed 无关);伪装视图(时间统一 +1、manifest 键序打乱、换路径)逐位一致;单输入视图退路 = copy_last(合成单输入视图实测,vec-check 过);`vec-check` 通过;8.1s / 1.88GB(限值 30min / 28GB)。-- 未验证:B 半与真实 final 视图(本地无法检验;nb_mmd/mmd_u 增益为跨解码单调的结构性位移,预期可迁移,但幅度未知);TYPE_MIN=60(不封顶档实测与 30 无差,封顶使极端小型失效);REC_TYPE_MIN 在 final 视图上的小样本型行为(已由 cap 兜底)。-- 查分台账:18/20 已用。其中 3 次浪费在 `VEC_REC_SCOPE` 默认值笔误("dist" 静默落入 global 分支,输出与父逐位相同仍被送分)——**教训:查分前必须先离线确认输出与父逐位不同**;1 次用于复核评分器确定性。+dp 钉死下的空间速度扩散(W=0.7,15-NN)+同型 NN 再闭合参考+逐基因方差对齐:DE 逐位冻结,nb_mmd/mmd_u 随强度单调改善。++# 节点 42:dp 钉死的空间速度扩散(T2:heart:val_extrap,T2HX-01,父=节点 40)++## 方法(提交配置 = run.py 默认值)++基座完全承自节点 40:copy_last(坐标/行序/细胞数/组成冻结)、ε=0.1 两步支撑掩码扩散底物、+rel 速度 v_t=(m_a−m_p)/(m_p+1)、k=0.5 软阈值、α=1 乘法位移、γ=1.35 几何再闭合、+β_rec=0.15 场低通+电平中性、型内中位参考(封顶 [1/3,3]×全局)、PBC=10、双硬门控、+逐基因伪批量 Newton 复原。本节点新增三件事:++1. **并行路径重构 + dp 钉死(保护层扩展)**:并行(钉死)路径现在从**未扩散**的速度场完整重跑+   节点 40 的计算(自己的位移、比率场、低通、全局参考再闭合、电平匹配、PBC),硬门控也改读这条+   路径的 dp——pb 复原把写出的 dp 钉到它,门控保护的就是实际写出的输出。因此主路径上的任何+   "再分配类"机制**在构造上不可能移动 de_score/de_direction**(本节点所有查分中两项逐位冻结在+   父值 0.2778/0.3839 A 半)。+2. **主机制:空间速度扩散(VEC_VDIFF_W=0.7,K=15)**:V ← (1−W)·V + W·mean(V over 15 个最近+   **坐标**邻居)。节点 37 曾测得 nb_mmd 随 W 跨 9 个解码单调改善,但因扩散搬动群体 dp、+   以 de_direction 等值交换而被证否;在 dp 钉死下该代价消失,机制只能把表达在基因列内**空间+   连贯地**重排。这是被证否机制在新保护层下的复活,不是重复。+3. **同型 NN 再闭合参考(PLAN 主机制,VEC_REC_REF=nn,NN_MIN=1)+ 逐基因方差对齐+   (VEC_VAR_ALIGN=1)**:r_ref_i = i 的坐标 15-NN 中**同型**邻居的平滑比率场 r̃ 均值+   (封顶同 [1/3,3]×全局中位;同型邻居 < NN_MIN 时退回型内中位=节点 40 行为)。方差对齐在+   pb 复原后把每个基因列绕自身均值的离差按 σ(并行路径)/σ(当前) 缩放(列均值不动 → dp 精确不变),+   重贴支撑掩码后再做一次 Newton 复原把 pb 重新钉死(残差 ≤ 2e-15)。++单输入阶段(<2 个输入)时整体逐位回退 copy_last(与父相同,已复验)。+`--ablate nn_ref`(任意名同样处理)关闭本节点全部三个机制(W→0、参考退回型内中位、方差对齐关),+输出**逐位等于父节点 40**(h5 array_equal 验证通过)。++## 关键参数++| 参数 | 值 | 说明 |+|---|---|---|+| VEC_VDIFF_W / K / STEPS | 0.7 / 15 / 1 | 主机制幅度;W 网格 0.3–1.0 内点峰 |+| VEC_REC_REF / NN_MIN / NN_K / λ / mean | nn / 1 / 15 / 1.0 / lin | PLAN 主机制;NN_MIN 10→1 单调 |+| VEC_VAR_ALIGN / CAP | 1 / 2.0 | 二级机制;cap 在 W=0.7 下不绑定(ratio q10–q90 = 1.03–1.10) |+| 其余 | 承自节点 40 | ε=0.1、γ=1.35、β_rec=0.15、cap=3、PBC=10、k=0.5、α=1 |++## 查分记录(A 半,proxy_noscale,共 15 次;父节点 40 的 A 半 = 57.332,见其 README)++| 配置 | 总分 | nb_mmd | mmd_u | variogram | de_score/de_dir |+|---|---:|---:|---:|---:|---|+| 父 40(README 记录值) | 57.332 | 0.07621 | 0.04630 | 0.035414 | 0.2778/0.3839 |+| PLAN 主机制 nn NN_MIN=5 | 57.352 | 0.07598 | 0.04631 | 0.035929 | 冻结 |+| nn λ=0.5 / λ=0.25 | 57.352/57.344 | 0.07604/0.07611 | 0.0462/0.04623 | ~0.03596 | 冻结 |+| nn NN_MIN=10 / 3 / 1 | 57.299/57.374/57.374 | 0.07638/0.07585/— | 0.04658/0.04610/— | ~0.03597 | 冻结 |+| nn 几何均值解码 | 57.338 | 0.07615 | 0.04628 | 0.035965 | 冻结 |+| nn1 + 方差对齐 | 57.465 | 0.07564 | 0.04537 | 0.035655 | 冻结 |+| 型参考 + 方差对齐 | 57.383 | 0.07610 | 0.04605 | 0.035659 | 冻结 |+| vdiff W=0.3 / 0.5 / 0.7(+va) | 57.463/57.501/57.514 | 0.07573/0.07508/0.07486 | 0.04576/0.04490/0.04470 | 0.03593/0.03615/0.03637 | 冻结 |+| vdiff W=0.7(无 va) | 57.367 | 0.07573 | 0.04576 | 0.036435 | 冻结 |+| vdiff W=1.0(+va) | 57.510 | 0.07482 | 0.04453 | 0.036597 | 冻结 |+| vdiff W=0.7 K=30(nn1+va) | 57.530 | 0.07458 | 0.04457 | 0.036546 | 冻结 |+| vdiff W=0.85(nn1+va) | 57.529 | 0.07472 | 0.04446 | 0.036515 | 冻结 |+| vdiff 2 步 W=0.5(nn1+va) | 57.532 | 0.07468 | 0.04448 | 0.036509 | 冻结 |+| 直方图匹配解码(nn1+vd07) | **51.78** | 0.12921 | 0.07078 | 0.038420 | 冻结 |+| **提交:nn1+vd07+va** | **57.541** | **0.07468** | **0.04447** | 0.036399 | 冻结 |++## 机制生效的证据++- **实际改变了哪些细胞**:全部 24,826 个细胞的表达都参与扩散重排(moved_frac=1.0);同型 NN+  参考覆盖 91%(NN_MIN=1,中位同型邻居数 8;NN_MIN=5 时 73%);方差对齐逐列缩放中位 1.058。+  输出与父逐位不同(mean abs diff ≈ 0.03 log1p 单位),坐标/行序/细胞数/零支撑逐位不变。+- **四组分变化(A 半 vs 父 README A 半)**:local_spatial 60.13→60.54(nb_mmd 0.07621→0.07468,+  跨 W∈{0.3,0.5,0.7,0.85,1.0}+K30+2步 共 7 个解码**单调**,结构性位移);cell_state+  59.01→59.33(mmd_u 0.04630→0.04447 单调改善;variogram 0.035414→0.036399 是代价,+  方差对齐吸收了约 1/4);expression_change 60.29 逐位冻结(dp 钉死按构造保证,+  全部 15 次查分 de_score=0.2778、de_direction=0.3839 无一例外);shape_scale 50.00 地板不变+  (坐标冻结,结构门=1,邻域 skill 0.60>0.5)。+- **生物学读法**:位移场空间扩散 = 假设发育信号在局部组织中连贯(旁分泌/邻域效应),+  邻居共享的位移方向比单细胞型级估计更接近真实外推;再闭合参考局部化 = 把"离群亮度"+  校正定义在空间邻域内。两者都只用输入数据现场计算,无任何阶段特异常数。+- **对照**:`--ablate nn_ref` 输出与父节点 40 预测文件 array_equal = True(本次会话实测)。+  mechanism_active = yes(关闭后输出逐位变化)。++## 验证过什么++- 默认配置输出 == 最佳查分配置预测(逐位);seed 0/1/2 逐位一致(锚阶段细胞数 ≤ max_cells,+  分层抽取返回全部行)。+- 伪装视图(时间统一 +1 天、manifest 键序打乱、文件改名换路径)输出逐位一致 → 视图无关。+- 单输入视图:逐位 copy_last(24,826 细胞原样)。+- vec-check 通过;float64 中间量有限、非负;pb 复原残差 ≤ 2e-15、方差对齐后二次复原残差 ≤ 2e-15。+- 运行时 ~13 s、峰值内存 2.6 GB(限额 30 min / 28 GB);CPU(EXECUTION.json gpu:false)。++## 没验证什么 / 风险++- 本地 A 半 +0.209 小于 T2 约 1 分的总分噪声;提交依据是父节点教训要求的**跨解码单调 raw 位移**+  (nb_mmd/mmd_u 各 7 个解码单调),不是总分。本榜本地尺子历史上高估外推(54.2→49.6),+  B 半与官网分可能不兑现全部增益。+- variogram 付出 0.035414→0.036399:扩散改变列内分布**形状**(型边界细胞拿到混合速度 →+  中间值增多),σ 对齐只吸收一部分;直方图匹配(钉死全部边际)已实测灾难性失败+  (列独立重排摧毁跨基因联合结构,nb_mmd 0.129、结构门 0.61),不要重试。+- W=0.7 是 A 半上的内点峰(0.5→0.7→0.85/1.0 = 57.501→57.541→57.529/57.510),峰很平;+  B 半峰位可能略移,但单调性保证不会崩塌。+- 真实 final 视图(3 输入)上速度来自最后两个输入,与代理结构相同;同型 NN 覆盖率、+  扩散强度都由数据现场决定,无视图特判。未在 final 视图实跑(不可得)。  ## 知识来源 -无外部生物学知识条目;全部量为运行时从视图输入计算(型内中位、全局中位、封顶界、pb 目标、PBC 界),无任何阶段特异常数、无绝对发育时间(只用 manifest 输入的先后与时间差)。PLAN sources 为空,一致。+- 位移场空间连贯性假设:通用旁分泌/形态梯度信号知识(局部细胞群共享信号环境),+  非阶段特异测量;未使用任何保留阶段(E8.5/E10.5/E12.5、禁窗 9.5<E≤13.5、(8.25,8.75))+  数据或其测量值。view 的 `external/`、`prior/` 未被本方法读取。+- 评分规则事实(八项指标、结构门、dp 只读列均值/列内成对距离)来自任务书评分简报(公开评分代码)。+- 继承基座的生物学与参数依据见父节点 40 的 METHOD/README(型级速度、CP10k 总量不变量、+  PBC 钳位等),本节点未新增任何硬编码统计量。++## 已证否(本节点新增,勿在此基座重试)++- **逐列直方图匹配到并行路径**(VEC_HIST_MATCH=1):51.78,见上。钉死全部边际但列间独立重排+  → 联合结构(细胞状态)被摧毁。教训:再分配类机制必须保持**跨基因的细胞级耦合**,+  只能钉"每列的均值"(Newton 复原)或"每列的二阶矩"(方差对齐),不能钉整列多重集再重排。+- **PLAN 主机制单独使用**(同型 NN 参考,6 个解码:NN_MIN∈{10,5,3,1}、λ∈{0.5,0.25}、+  lin/log 均值):57.299–57.374 vs 父 57.332,全部在 ±0.05 噪声带内;nb_mmd 有单调但+  微小的改善(0.07638→0.07585),variogram 付出更多。按 PLAN 判无效门槛属"不优于父",+  已按任务书要求换备选机制(dp 钉死的 vdiff)提交,NN 参考仅作为叠加组件保留(+0.027)。+- VDIFF 2 步核(W=0.5×2):57.5315,与单步 W=0.7 持平且 variogram 更差。+- VDIFF_K=30:nb_mmd 最好(0.07458)但 variogram/mmd_u 付出更多,总分 57.5304 < 提交配置。diff --git a/solution/README.md b/solution/README.mdindex 14cbc78..9a5917a 100644--- a/solution/README.md+++ b/solution/README.md@@ -1,20 +1,26 @@-# 型内中位再闭合(封顶±3×)+ 伪批量精确复原(T2:heart:val_extrap,T2HX-01,节点40)+# dp 钉死的空间速度扩散 + 同型 NN 再闭合参考 + 方差对齐(T2:heart:val_extrap,T2HX-01,节点42) -copy_last 基座(坐标/行序/细胞数/组成冻结)承自节点 35:锚阶段表达先在坐标 15-NN 图上做两步支撑掩码-扩散平滑(ε=0.1,保零模式,逐基因列缩放复原伪批量),按共有型 rel 速度 v_t=(m_a−m_p)/(m_p+1)-乘法位移 x′=x·2^(α·v̂_t)(α=1,k=0.5 软阈值),过双硬门控后做几何再闭合 s_i=(r_ref/r̃_i)^γ-(γ=1.35,r̃ 为 β_rec=0.15 空间低通+电平中性的总量比场),PBC=10 钳亮尾。+基座承自节点 40(坐标/行序/细胞数/组成冻结的 copy_last;ε=0.1 扩散底物;rel 速度乘法外推+α=1、k=0.5;γ=1.35 几何再闭合、β_rec=0.15 低通+电平中性;型内中位参考封顶 ±3×;PBC=10;+双硬门控;逐基因伪批量 Newton 复原)。 -**节点 40 改动**:再闭合参考 r_ref 从全局中位改为**型内中位**(封顶 [1/3,3]×全局,型内 <30 细胞退回全局),-并在 PBC 之后按逐基因列因子(对数域 Newton,20 步,残差≤2e-15)把伪批量**精确复原**到并行计算的全局参考-(=父节点)输出上:dp、de_score、de_direction 逐位保持父值,机制只能在基因列内部再分配细胞间表达。-proxy_noscale A 半 56.869→57.332:nb_mmd 0.08093→0.07621(全树最佳,跨 5 个解码单调)、-mmd_u 0.04853→0.04630、variogram 0.035414→0.035963(小代价)、DE 两项逐位不变、形状组地板不变。+**节点 42 改动**:+1. 并行(钉死)路径从未扩散速度完整重跑节点 40 计算,硬门控改读该路径 dp——写出的+   de_score/de_direction 对任何主路径机制**逐位冻结**(全部 15 次查分验证)。+2. 主机制:位移速度场空间扩散 V←(1−W)V+W·mean(15 坐标邻居),W=0.7。节点 37 曾因+   de_direction 等值交换证否;dp 钉死后 nb_mmd/mmd_u 随 W 跨 7 个解码单调改善,代价只剩+   variogram +0.001。+3. PLAN 主机制(同型 15-NN 再闭合参考,NN_MIN=1)单独为噪声内持平(57.299–57.374 vs 父+   57.332),作为叠加组件保留(+0.027);方差对齐(列离差按 σ_并行/σ_当前 缩放,均值不动,+   二次 Newton 复原)单独 +0.05、在 vdiff 上 +0.15。+4. 直方图匹配解码证否(51.78:钉全列多重集但列间独立重排摧毁跨基因联合结构),默认关。 -- 运行:`python run.py --data <view> --out <pred.h5ad> --seed <int>`;CPU ~8s、<2GB(`EXECUTION.json gpu:false`)。-- 关闭对照:`--ablate <任意名>` → 型内参考与 pb 复原同时关 → 输出逐位 = 节点 35(已验证)。-- PLAN 原样机制(不封顶 λ 混合)已证否:λ 0.15–1.0 全网格 de_direction 0.338→0.268、de_score 0.222→0.167-  单调崩塌(型间亮度倾斜搬动群体 pb),总分 55.6–56.0 < 父;pb 复原解码正是针对这一失败通道。-- 其余已证否方向(默认关,代码保留,明细见 run.py docstring 与 METHOD.md):再闭合场平滑对 nb_mmd 的假设、-  提亮方向、事后平滑、PBC∈{4,6,8,12}、k=0.4/0.6、SMOOTH_K=30、γ=1.45(持平)、TYPE_MIN=60(无差)。-- 确定性:seed 0/1/2 逐位一致;伪装视图(时间 +1、键序打乱、换路径)逐位一致;单输入退路逐位 copy_last。+提交配置 A 半 57.5413(父 57.332):nb_mmd 0.07621→0.07468、mmd_u 0.04630→0.04447(均单调)、+variogram 0.035414→0.036399(代价)、DE 冻结、形状组地板不动(结构门 1)。++- 运行:`python run.py --data <view> --out <pred.h5ad> --seed <int>`;CPU ~13s、峰值 2.6GB+  (`EXECUTION.json gpu:false`)。+- 关闭对照:`--ablate <任意名>` → W=0、参考退回型内中位、方差对齐关 → 输出逐位 = 节点 40(已验证)。+- 确定性:seed 0/1/2 逐位一致;伪装视图(时间 +1、键序打乱、换路径换文件名)逐位一致;+  单输入视图逐位 copy_last(已验证)。+- 明细与查分表见 METHOD.md 与 run.py docstring。diff --git a/solution/run.py b/solution/run.pyindex f00ee1f..8a50f1b 100644--- a/solution/run.py+++ b/solution/run.py@@ -24,13 +24,69 @@ Mechanism (on by default, alpha = 1.0):  Coordinates, row order and cell count are never modified. ---ablate <name> (any name) turns THIS node's mechanism (the per-type-re-closure reference + pb-restore, node 40) off and keeps the rest of the-pipeline unchanged: the re-closure reference reverts to the global median-and the pb-restore is skipped, making the output bit-for-bit parent node 35-(verified by array comparison).+--ablate <name> (any name) turns THIS node's mechanisms off and keeps the+rest of the pipeline unchanged: the velocity diffusion weight goes to 0, the+re-closure reference reverts to the capped per-type median and the variance+alignment is skipped, making the output bit-for-bit parent node 40 (verified+by array comparison). The node-40 semantics of --ablate (revert to node 35)+are reachable with VEC_REC_SCOPE=global. -Node 40 addition on top of node 35 (the submitted configuration):+Node 42 addition on top of node 40 (the submitted configuration):++(10) DP-PINNED spatial velocity diffusion + same-type-NN re-closure reference+     + per-gene variance alignment+     (VEC_VDIFF_W=0.7, VEC_VDIFF_K=15, VEC_REC_REF=nn, VEC_REC_NN_MIN=1,+     VEC_REC_NN_K=15, VEC_VAR_ALIGN=1).+     The parallel (pinning) path is refactored to run the FULL node-40+     computation from the UNDIFFUSED velocity (its own displacement, ratio+     field, low-pass, global-reference re-closure, level match, PBC), and the+     hard gates now read that path's dp -- the pb restore pins the written dp+     to it, so the gate protects the output that is actually written and the+     mechanisms can NEVER move de_score/de_direction (frozen at the parent's+     0.2778/0.3839 A-half in every scored decode below).+     (a) Velocity diffusion (node 37's mechanism, resurrected under the dp+         pin): V <- (1-W)*V + W*mean(V over the 15 nearest COORDINATE+         neighbours). Node 37 measured nb_mmd improving MONOTONICALLY with W+         across 9 decodes but rejected it because the diffusion moved the+         population dp and paid with de_direction (equal-value trade). With+         dp pinned, the trade disappears: A-half (type ref, var_align) W =+         0.3/0.5/0.7 -> 57.463/57.501/57.514 with nb_mmd 0.07573/0.07508/+         0.07486 and mmd_u 0.04576/0.04490/0.04470 monotone in W; W=1.0 ->+         57.510 (nb_mmd 0.07482, variogram 0.036597) -- interior peak at+         W~0.7, the variogram pays the residual cost (0.035414 -> 0.036365,+         within-column distribution SHAPE change that the sigma alignment+         only partly absorbs).+     (b) Same-type-NN re-closure reference (the PLAN's mechanism; ALONE it is+         noise-flat and its PLAN main decode is falsified): r_ref_i = mean of+         the smoothed ratio field r~ over the SAME-TYPE cells among i's 15+         nearest coordinate neighbours (capped to [1/3, 3]x the global median;+         fallback to the capped type median when fewer than VEC_REC_NN_MIN+         same-type neighbours). A-half, no vdiff: NN_MIN 10/5/3/1 -> 57.299/+         57.352/57.374/57.374 vs parent 57.332; log-mean decode 57.338;+         lambda blends 0.5/0.25 -> 57.352/57.344. nb_mmd monotone in+         mechanism strength (0.07638 -> 0.07585) but tiny; the variogram+         pays. STACKED on vdiff W=0.7 it adds +0.027 (57.5413 = submitted,+         tree-best A-half on this base).+     (c) Variance alignment (secondary): after the pb restore, rescale each+         gene column's deviations around its own mean by+         std(parallel path)/std(current), re-apply the support mask and pin+         the pb again with a second Newton solve (mean-preserving by+         construction). Alone on the parent base: +0.051 A-half (57.383);+         on vdiff W=0.7: +0.147 (57.367 -> 57.514).+     SUBMITTED (nn1 + vdiff W=0.7 + var_align): A-half 57.5413 vs parent+     57.332 (+0.209) with the structural evidence the parent's lessons ask+     for: nb_mmd 0.07621 -> 0.07468 and mmd_u 0.04630 -> 0.04447, both+     MONOTONE across the 7-decode W sweep; de_score/de_direction frozen+     bit-for-bit; shape group untouched (coordinates frozen).+     FALSIFIED (do not retry on this base): per-column HISTOGRAM MATCH to the+     parallel path (pins every per-gene marginal exactly but re-arranges+     values across cells independently per column, destroying the cross-gene+     joint structure): A-half 51.78, nb_mmd 0.12921 -> structure gate 0.61,+     mmd_u 0.07078. VDIFF 2-step kernel W=0.5x2 -> 57.5315 (dead even,+     variogram worse). VDIFF_K=30 at W=0.7 -> 57.5304 (nb_mmd 0.07458 best+     but variogram/mmd_u pay). W=0.85+nn1 -> 57.5292.++Node 40 addition on top of node 35 (inherited base):  (9) Per-type re-closure reference, capped and pb-restored     (VEC_REC_SCOPE=type, VEC_REC_CAP=3.0, VEC_REC_TYPE_MIN=30,@@ -309,6 +365,12 @@ VEC_BETA_REC (0.15), VEC_REC_STEPS (1), VEC_REC_K (15), VEC_REC_LEVEL (matched), VEC_REC_BRIGHT (1.0 = off, diagnostic only), VEC_REC_SCOPE (type), VEC_REC_TYPE_MIN (30), VEC_REC_LAMBDA (1.0), VEC_REC_CAP (3.0), VEC_PB_RESTORE (1), VEC_PB_RESTORE_ITERS (20),+VEC_VDIFF_W (0.7 = node 42 main mechanism), VEC_VDIFF_K (15),+VEC_VDIFF_STEPS (1),+VEC_REC_REF (nn = node 42), VEC_REC_NN_K (15), VEC_REC_NN_MIN (1),+VEC_REC_NN_LAMBDA (1.0), VEC_REC_NN_MEAN (lin),+VEC_VAR_ALIGN (1 = node 42 secondary), VEC_VAR_ALIGN_CAP (2.0),+VEC_HIST_MATCH (0, falsified), VEC_POST_EPS (0.0 = off, falsified), VEC_POST_STEPS (2), VEC_POST_K (15), VEC_PBC (10.0), VEC_MIXMODE (rel), VEC_MIXREL (1.0), VEC_MIXEPS (1.0), VEC_DOMAIN (log), VEC_SOFTD (0), VEC_CAPD (0), VEC_CVEL (-1 = legacy@@ -368,14 +430,23 @@ REC_SCOPE = os.environ.get("VEC_REC_SCOPE", "type")  # node 40 re-closure refere REC_TYPE_MIN = int(os.environ.get("VEC_REC_TYPE_MIN", "30"))  # types with fewer anchor cells than this use the global median (PLAN risk 1: unstable per-type medians) REC_LAMBDA = float(os.environ.get("VEC_REC_LAMBDA", "1.0"))  # blend of the per-type reference toward the global one: r_ref = (1-lam)*r_med_global + lam*r_med_type (PLAN fallback grid) REC_CAP = float(os.environ.get("VEC_REC_CAP", "3.0"))  # clamp the per-type reference to [r_med_global/CAP, r_med_global*CAP] (0 = off); protects extreme-velocity types from pinning at the PBC cap -- uncapped type medians span 0.44x..44823x the global median on this view+REC_REF_MODE = os.environ.get("VEC_REC_REF", "nn")  # node 42 re-closure reference: "nn" = per-cell mean of the smoothed ratio field over its SAME-TYPE coordinate neighbours (spatially local outlier correction), "type" = per-type median (node 40, bit-for-bit)+REC_NN_K = int(os.environ.get("VEC_REC_NN_K", "15"))  # coordinate neighbours searched for same-type neighbours+REC_NN_MIN = int(os.environ.get("VEC_REC_NN_MIN", "1"))  # cells with fewer same-type neighbours than this fall back to the capped type median (PLAN risk 1)+REC_NN_LAMBDA = float(os.environ.get("VEC_REC_NN_LAMBDA", "1.0"))  # log-domain blend of the reference: r_ref = exp((1-lam)*log(tmed_capped) + lam*log(nn_capped)); 1 = pure nn (PLAN main), <1 = PLAN fallback blend+REC_NN_MEAN = os.environ.get("VEC_REC_NN_MEAN", "lin")  # "lin": arithmetic mean of r~ over same-type neighbours (PLAN); "log": geometric mean (exp of the mean of log r~) -- robust to the heavy right tail of r~+VAR_ALIGN = os.environ.get("VEC_VAR_ALIGN", "1") not in ("0", "", "false", "False")  # node 42 secondary: after the pb restore, rescale each gene column's deviations around its own mean by std(parent path)/std(current) -- column means (hence pb, dp, DE) preserved EXACTLY by construction; targets the variogram regression (0.03471 -> 0.03528) of node 40+VAR_ALIGN_CAP = float(os.environ.get("VEC_VAR_ALIGN_CAP", "2.0"))  # clamp of the per-gene variance-alignment ratio (safety for degenerate columns; 0 = off)+HIST_MATCH = os.environ.get("VEC_HIST_MATCH", "0") not in ("0", "", "false", "False")  # FALSIFIED node 42 decode (default off): per-gene-column histogram match to the parallel path -- pins every per-gene marginal exactly but re-arranges values across cells independently per column, destroying the cross-gene joint structure: A-half 51.78 (nb_mmd 0.12921 -> structure gate 0.61, mmd_u 0.07078, variogram 0.03842). Do not retry. PB_RESTORE = os.environ.get("VEC_PB_RESTORE", "1") not in ("0", "", "false", "False")  # node 40 submitted decode: after the type-scoped re-closure, rescale each gene column (Newton solve) so the pseudobulk equals the GLOBAL-reference (parent) re-closure's EXACTLY -- dp, hence de_score/de_direction, preserved bit-for-bit; the mechanism can then only REDISTRIBUTE expression between cells/types, never tilt the population mean PB_RESTORE_ITERS = int(os.environ.get("VEC_PB_RESTORE_ITERS", "20"))  # Newton iterations of the log-domain column solve (convex monotone problem, steps clipped to e^+-5; residual < 1e-9) REC_BRIGHT = float(os.environ.get("VEC_REC_BRIGHT", "1.0"))  # diagnostic: constant linear-domain multiplier on the re-closure scale s_i (1.0 = off); isolates the brightening side-effect of field smoothing from its dispersion removal POST_EPS = float(os.environ.get("VEC_POST_EPS", "0.0"))  # node 35 submitted mechanism: support-masked diffusion smoothing AFTER re-closure+PBC, with exact per-gene pseudobulk restoration (0 = off) POST_STEPS = int(os.environ.get("VEC_POST_STEPS", "2"))  # diffusion steps of the post-hoc smoothing POST_K = int(os.environ.get("VEC_POST_K", "15"))  # coordinate neighbours of the post-hoc smoothing-VDIFF_W = float(os.environ.get("VEC_VDIFF_W", "0.0"))  # spatial velocity diffusion weight (0 = off)+VDIFF_W = float(os.environ.get("VEC_VDIFF_W", "0.7"))  # node 42 main mechanism: spatial velocity diffusion weight -- each cell's displacement velocity is blended with the mean over its VDIFF_K nearest COORDINATE neighbours, making the displacement field locally coherent; the pb restore pins the final dp to the UNDIFFUSED parallel path (node-40-exact), so the diffusion only redistributes expression spatially (node 37's mechanism, resurrected under dp protection: nb_mmd/mmd_u improve monotonically in W, DE frozen) VDIFF_K = int(os.environ.get("VEC_VDIFF_K", "15"))  # coordinate neighbours for the velocity diffusion+VDIFF_STEPS = int(os.environ.get("VEC_VDIFF_STEPS", "1"))  # repeated application of the diffusion blend (wider effective kernel at the same per-step weight) REGRESS_MODE = os.environ.get("VEC_REGRESS_MODE", "type")  # "type" (per-type OLS) or "global" (pooled slope) REGRESS_W = float(os.environ.get("VEC_REGRESS_W", "1.0"))  # blend weight of the residual velocity (1 = pure residual) REGRESS_MINGENES = int(os.environ.get("VEC_REGRESS_MINGENES", "50"))  # types with fewer positive-pb genes skip regression@@ -407,6 +478,32 @@ def soft_threshold(v: np.ndarray, k: float) -> tuple[np.ndarray, float]:     return vt, float((vt == 0.0).mean())  +_NB_CACHE: dict[tuple[int, int], tuple[np.ndarray, np.ndarray]] = {}+++def _knn_idx(coords: np.ndarray, knn: int) -> np.ndarray:+    """Coordinate k-NN neighbour indices, shape (n, k), self excluded.++    Deterministic (cKDTree query); cached per (n, knn) with an identity check+    on the coordinate array, so the substrate smoothing, the re-closure field+    smoothing and the node-42 same-type reference share one tree query.+    """+    from scipy.spatial import cKDTree++    cpt = np.asarray(coords, dtype=np.float64)[:, :3]+    n = cpt.shape[0]+    k = int(min(knn, max(n - 1, 1)))+    key = (n, k)+    hit = _NB_CACHE.get(key)+    if hit is not None and hit[0] is cpt:+        return hit[1]+    tree = cKDTree(cpt)+    _, idx = tree.query(cpt, k=k + 1)+    idx = np.atleast_2d(idx)[:, 1:]+    _NB_CACHE[key] = (cpt, idx)+    return idx++ def _knn_w(coords: np.ndarray, knn: int):     """Row-normalised coordinate k-NN adjacency (self excluded), CSR. @@ -415,14 +512,9 @@ def _knn_w(coords: np.ndarray, knn: int):     re-closure field smoothing (node 35).     """     from scipy import sparse-    from scipy.spatial import cKDTree      n = coords.shape[0]-    k = int(min(knn, max(n - 1, 1)))-    tree = cKDTree(np.asarray(coords, dtype=np.float64)[:, :3])-    _, idx = tree.query(np.asarray(coords, dtype=np.float64)[:, :3], k=k + 1)-    idx = np.atleast_2d(idx)-    nb = idx[:, 1:]  # drop self (column 0)+    nb = _knn_idx(coords, knn)     rows = np.repeat(np.arange(n), nb.shape[1])     return sparse.csr_matrix(         (np.full(rows.size, 1.0 / nb.shape[1]), (rows, nb.ravel())),@@ -608,15 +700,21 @@ def main() -> None:     shrink_on = SHRINK_N0 > 0.0 and args.ablate is None     vdiff_w = VDIFF_W if args.ablate is None else 0.0     reclose_geo = RECLOSE_GEO-    # Node 40 off-control: --ablate <any> turns OFF THIS node's mechanism-    # (per-type re-closure reference) and NOTHING else: the re-closure-    # reference reverts to the global median, all node-35 components-    # (beta_rec=0.15, REC_LEVEL=matched, post pass off) stay as submitted, so-    # the ablated run is bit-for-bit parent node 35 (verified).+    # Node 42 off-control: --ablate <any> turns OFF THIS node's mechanism+    # (the same-type NN re-closure reference and the variance alignment) and+    # NOTHING else: the reference reverts to the capped per-type median and+    # the node-40 pb restore stays on, so the ablated run is bit-for-bit+    # parent node 40 (verified by array comparison). The node-40 semantics+    # of --ablate (revert to node 35) are reachable with VEC_REC_SCOPE=global.     beta_rec = BETA_REC     post_on = True-    rec_scope_type = REC_SCOPE == "type" and args.ablate is None+    rec_scope_type = REC_SCOPE == "type"     pb_restore_on = PB_RESTORE and rec_scope_type+    rec_ref_nn = rec_scope_type and REC_REF_MODE == "nn" and args.ablate is None+    var_align_on = VAR_ALIGN and pb_restore_on and args.ablate is None+    hist_match_on = HIST_MATCH and pb_restore_on and args.ablate is None+    if hist_match_on:+        var_align_on = False  # the histogram match subsumes both restore decodes      manifest = load_manifest(args.data)     genes = panel_genes(args.data, manifest)@@ -629,6 +727,9 @@ def main() -> None:         rows = np.sort(rng.choice(stage.n, size=n, replace=True))     X = stage.X[rows].toarray().astype(np.float32)     coords = stage.coords[rows]+    # Canonical float64 (n, 3) coordinate array: every k-NN consumer in this+    # run receives THIS object so the neighbour cache hits (identity check).+    coords = np.ascontiguousarray(np.asarray(coords, dtype=np.float64)[:, :3])      if alpha > 0:         prev_entry, last_entry, _ratio = extrap_step(manifest)@@ -644,6 +745,8 @@ def main() -> None:             # smoothed anchor Xs. steps=0/eps=0 -> Xs is Xa bit-for-bit.             Xs, sinfo = spatial_smooth(Xa, coords, SMOOTH_STEPS, SMOOTH_EPS, SMOOTH_K)             pb_target = None  # node 40 backup decode: set only when pb_restore_on+            var_std_target = None  # node 42 secondary: per-gene std of the parallel parent path+            Xpar_keep = None  # node 42 hist-match decode: full parallel-path matrix             if DEBUG:                 print(f"smooth: active={sinfo['active']} steps={SMOOTH_STEPS} eps={SMOOTH_EPS} "                       f"k={SMOOTH_K} changed_frac_pos={sinfo.get('changed_frac_pos', 0.0):.4f} "@@ -652,26 +755,53 @@ def main() -> None:                       f"col_scale_med={sinfo.get('col_scale_med', 1.0):.4f}", flush=True)             c_vel = pseudocount if pseudocount > 0 else (CVEL if CVEL >= 0 else 1.0)             V, per_type = type_velocity(Xa, stage.labels[rows], Xb, prev.labels, c_vel, SOFT_K, regress, shrink_on)-            if vdiff_w > 0:-                # Spatial velocity diffusion: blend each cell's type velocity-                # with the mean type velocity over its VDIFF_K nearest-                # COORDINATE neighbours, making the displacement field locally-                # coherent (targets neighborhood_mmd, the heaviest metric).-                from scipy import sparse-                from scipy.spatial import cKDTree-                m = V.shape[0]-                kk = int(min(VDIFF_K, max(m - 1, 1)))-                cpt = np.asarray(coords, dtype=np.float64)[:, :3]-                tree = cKDTree(cpt)-                _, vidx = tree.query(cpt, k=kk + 1)-                vnb = np.atleast_2d(vidx)[:, 1:]-                vrows = np.repeat(np.arange(m), vnb.shape[1])-                Wv = sparse.csr_matrix(-                    (np.full(vrows.size, 1.0 / vnb.shape[1]), (vrows, vnb.ravel())),-                    shape=(m, m))-                V = (1.0 - vdiff_w) * V + vdiff_w * (Wv @ V)             pba = Xa.mean(axis=0)             dt_approx = pba - Xb.mean(axis=0)+            # ---- PARALLEL (pinning) PATH: node-40-exact computation from the+            # undiffused velocity. Its raw displacement feeds the gates (the+            # final dp is pinned to this path by the pb restore, so the gate+            # protects the output that is actually written), and its re-closure+            # feeds pb_target / var_std_target. With vdiff_w == 0 this path is+            # the same formula sequence as the main decode below -> bit-for-bit+            # identical results (verified against the node-40 parent output).+            A_par = np.where(V > 0, alpha * AUP, alpha * ADN)+            Xraw_par = Xs * np.power(2.0, A_par * V)+            Xp_par = np.maximum(Xraw_par, 0.0)+            dp_par = Xp_par.mean(axis=0) - pba+            std_ratio = float(np.std(dp_par) / (np.std(dt_approx) + 1e-12))+            sp = float(np.corrcoef(_rank(dp_par), _rank(dt_approx))[0, 1])+            lin_par0 = np.expm1(Xp_par)+            tot_new_par = lin_par0.sum(axis=1, keepdims=True)+            tot_old_g = np.expm1(Xs).sum(axis=1, keepdims=True)+            r_par = tot_new_par / np.maximum(tot_old_g, 1e-12)+            if beta_rec > 0.0 and REC_STEPS > 0:+                logr_par = np.log(np.maximum(r_par, 1e-12)).ravel()+                Wr_par = _knn_w(coords, REC_K)+                for _ in range(int(REC_STEPS)):+                    logr_par = (1.0 - beta_rec) * logr_par + beta_rec * (Wr_par @ logr_par)+                logr_par = (logr_par - np.median(logr_par)+                            + np.median(np.log(np.maximum(r_par, 1e-12))))+                r_use_par = np.exp(logr_par)[:, None]+            else:+                r_use_par = r_par+            if vdiff_w > 0:+                # Spatial velocity diffusion (node 37 mechanism, resurrected+                # under the node-40 pb-restore protection): blend each cell's+                # type velocity with the mean type velocity over its VDIFF_K+                # nearest COORDINATE neighbours, making the displacement field+                # locally coherent (targets neighborhood_mmd, the heaviest+                # metric). Node 37 measured nb_mmd improving MONOTONICALLY+                # with W across 9 decodes, but the diffusion moved the+                # population dp and paid for it with de_direction (equal-value+                # trade -> rejected). Here the final dp is pinned to the+                # undiffused parallel path by the pb restore, so the nb_mmd+                # gain comes WITHOUT the DE cost; the diffusion can only+                # redistribute expression spatially within gene columns.+                V = (1.0 - vdiff_w) * V + vdiff_w * (_knn_w(coords, VDIFF_K) @ V)+                if VDIFF_STEPS > 1:+                    Wv2 = _knn_w(coords, VDIFF_K)+                    for _ in range(int(VDIFF_STEPS) - 1):+                        V = (1.0 - vdiff_w) * V + vdiff_w * (Wv2 @ V)             if DOMAIN == "lin":                 # Multiplicative shift in the LINEAR domain: per-gene fold                 # change 2**(alpha*v) applied to expm1(x). Per-cell total@@ -745,14 +875,15 @@ def main() -> None:                 Xp = np.maximum(Xs + D, 0.0)                 Xraw = Xp             dp = Xp.mean(axis=0) - pba-            std_ratio = float(np.std(dp) / (np.std(dt_approx) + 1e-12))-            clip_frac = float((Xraw < 0).mean())+            clip_frac = float((Xraw_par < 0).mean())             moved = float((np.abs(V).sum(axis=1) > 1e-9).mean())-            sp = float(np.corrcoef(_rank(dp), _rank(dt_approx))[0, 1])             if DEBUG:                 print(f"gate: alpha={alpha} c={pseudocount} k={SOFT_K} "                       f"std(dp)/std(dt_approx)={std_ratio:.4f} "-                      f"clip_frac={clip_frac:.4f} moved_frac={moved:.4f} spearman(dp,dt_approx)={sp:.4f}",+                      f"clip_frac={clip_frac:.4f} moved_frac={moved:.4f} spearman(dp,dt_approx)={sp:.4f} "+                      f"(gates on the PARALLEL undiffused path: the pb restore pins the "+                      f"written dp to that path, so the gate protects the output; "+                      f"main-path spearman={float(np.corrcoef(_rank(dp), _rank(dt_approx))[0, 1]):.4f})",                       flush=True)                 for t, na, nb, vn, zfrac, rinfo in per_type:                     line = f"  type {t}: n_anchor={na} n_prev={nb} |v_t|={vn:.4f} zeroed_frac={zfrac:.3f}"@@ -848,6 +979,55 @@ def main() -> None:                                 if n_t >= REC_TYPE_MIN:                                     r_ref[m_t] = tm                                 t_meds.append((t, n_t, tm))+                            if rec_ref_nn:+                                # Node 42 mechanism: SPATIALLY LOCAL re-closure+                                # reference. For each cell i take the mean of+                                # the smoothed ratio field r~ over i's+                                # SAME-TYPE neighbours among its REC_NN_K+                                # nearest coordinate neighbours (self+                                # excluded); cells with fewer than REC_NN_MIN+                                # same-type neighbours keep the capped type+                                # median (node-40 reference). The nn mean is+                                # capped to the same [1/CAP, CAP] x global+                                # median window and blended with the type+                                # median in the LOG domain (REC_NN_LAMBDA;+                                # 1 = pure nn). The re-closure s_i =+                                # (r_ref_i/r~_i)**gamma then becomes a local+                                # outlier correction: a cell brighter than its+                                # spatial peers is dimmed, a cell consistent+                                # with its peers is left alone, which makes+                                # the correction field spatially coherent+                                # (targets neighborhood_mmd, 25 pts + the+                                # structure gate). The pb restore below still+                                # pins dp (de_score/de_direction) bit-for-bit.+                                from scipy import sparse+                                nb = _knn_idx(coords, REC_NN_K)+                                same = (lab_rec[nb] == lab_rec[:, None])+                                n_rows = np.arange(lab_rec.size)+                                rows_sp = np.repeat(n_rows, nb.shape[1])+                                cols_sp = nb.ravel()+                                vals_sp = same.ravel().astype(np.float64)+                                Wn = sparse.csr_matrix((vals_sp, (rows_sp, cols_sp)),+                                                       shape=(lab_rec.size, lab_rec.size))+                                nsum = np.asarray(Wn @ r_flat).ravel()+                                cnt = np.asarray(Wn.sum(axis=1)).ravel()+                                if REC_NN_MEAN == "log":+                                    nsum_l = np.asarray(Wn @ np.log(np.maximum(r_flat, 1e-12))).ravel()+                                    nn_ref = np.exp(np.divide(nsum_l, cnt, out=np.zeros_like(cnt),+                                                              where=cnt > 0))+                                else:+                                    nn_ref = np.divide(nsum, cnt, out=np.zeros_like(cnt),+                                                       where=cnt > 0)+                                if REC_CAP > 0.0:+                                    nn_ref = np.clip(nn_ref, r_med / REC_CAP, r_med * REC_CAP)+                                use_nn = cnt >= max(int(REC_NN_MIN), 1)+                                r_nn = np.where(use_nn, nn_ref, r_ref)+                                lam_nn = float(REC_NN_LAMBDA)+                                if lam_nn != 1.0:+                                    r_ref = np.exp((1.0 - lam_nn) * np.log(np.maximum(r_ref, 1e-12))+                                                   + lam_nn * np.log(np.maximum(r_nn, 1e-12)))+                                else:+                                    r_ref = r_nn                             r_ref = (1.0 - REC_LAMBDA) * r_med + REC_LAMBDA * r_ref                             sg = np.power(np.divide(r_ref[:, None],                                                     np.maximum(r_use, 1e-12)), gamma)@@ -864,6 +1044,22 @@ def main() -> None:                                 for t, n_t, tm in t_meds:                                     print(f"  rmed {t}: n={n_t} r_ref={tm:.4f} ratio={tm / r_med:.4f}",                                           flush=True)+                                if rec_ref_nn:+                                    ls = np.log(np.maximum(sg.ravel(), 1e-12))+                                    lsc = ls - ls.mean()+                                    nb15 = _knn_idx(coords, REC_K)+                                    moran_s = float((lsc * lsc[nb15].mean(axis=1)).mean()+                                                    / max((lsc ** 2).mean(), 1e-30))+                                    lr_u = np.log(np.maximum(r_flat, 1e-12))+                                    lru_c = lr_u - lr_u.mean()+                                    moran_r = float((lru_c * lru_c[nb15].mean(axis=1)).mean()+                                                  / max((lru_c ** 2).mean(), 1e-30))+                                    print(f"rec_nn: mode={REC_REF_MODE} k={REC_NN_K} "+                                          f"nn_min={REC_NN_MIN} lam={lam_nn} mean={REC_NN_MEAN} "+                                          f"use_nn_frac={float(use_nn.mean()):.4f} "+                                          f"cnt_med={float(np.median(cnt)):.1f} "+                                          f"moran_logr={moran_r:.4f} moran_logs={moran_s:.4f}",+                                          flush=True)                         else:                             sg = np.power(np.divide(np.full_like(r_use, r_med),                                                     np.maximum(r_use, 1e-12)), gamma)@@ -888,28 +1084,33 @@ def main() -> None:                         pb_target = None                         if pb_restore_on:                             # PB-restoring decode (node 40 backup mechanism):-                            # run the GLOBAL-reference re-closure in parallel-                            # (bit-for-bit the parent node 35 pass, incl. the-                            # matched level and the PBC clamp) and record its-                            # per-gene pseudobulk. After the type-scoped pass-                            # (and its PBC clamp), each gene column is rescaled-                            # by a single factor (Newton solve) so the final-                            # pseudobulk equals this target EXACTLY: dp, hence+                            # the GLOBAL-reference re-closure of the PARALLEL+                            # (undiffused) path -- bit-for-bit the parent+                            # node-35/40 pass incl. the matched level and the+                            # PBC clamp -- supplies the per-gene pseudobulk+                            # target. After the type-scoped pass (and its PBC+                            # clamp), each gene column is rescaled by a single+                            # factor (Newton solve) so the final pseudobulk+                            # equals this target EXACTLY: dp, hence                             # de_score/de_direction, is preserved bit-for-bit,                             # and the mechanism can only REDISTRIBUTE                             # expression between cells within a gene column,                             # never tilt the population mean. Both passes are                             # pure functions of the input data -- no fitted or-                            # tuned constants.-                            sg_par = np.power(np.divide(np.full_like(r_use, r_med),-                                                        np.maximum(r_use, 1e-12)), gamma)+                            # tuned constants. With vdiff_w > 0 the parallel+                            # path keeps the UNDIFFUSED velocity, so the dp+                            # stays pinned at the node-40 value even though the+                            # main displacement field is spatially diffused.+                            r_med_par = float(np.median(r_use_par))+                            sg_par = np.power(np.divide(np.full_like(r_use_par, r_med_par),+                                                        np.maximum(r_use_par, 1e-12)), gamma)                             if REC_LEVEL == "matched" and beta_rec > 0.0:-                                sg_raw_p = np.power(np.divide(np.full_like(r, float(np.median(r))),-                                                              np.maximum(r, 1e-12)), gamma)-                                m_raw_p = float(np.median((lin * sg_raw_p).sum(axis=1)))-                                m_par = float(np.median((lin * sg_par).sum(axis=1)))+                                sg_raw_p = np.power(np.divide(np.full_like(r_par, float(np.median(r_par))),+                                                              np.maximum(r_par, 1e-12)), gamma)+                                m_raw_p = float(np.median((lin_par0 * sg_raw_p).sum(axis=1)))+                                m_par = float(np.median((lin_par0 * sg_par).sum(axis=1)))                                 sg_par = sg_par * (m_raw_p / max(m_par, 1e-12))-                            Xpar = np.log1p(lin * sg_par)+                            Xpar = np.log1p(lin_par0 * sg_par)                             if PBC > 0:                                 lin_par = np.expm1(Xpar)                                 tot_par = lin_par.sum(axis=1, keepdims=True)@@ -917,6 +1118,21 @@ def main() -> None:                                 sc_par = np.minimum(1.0, (PBC * base_par) / np.maximum(tot_par, 1e-12))                                 Xpar = np.log1p(lin_par * sc_par)                             pb_target = Xpar.mean(axis=0)+                            if hist_match_on:+                                # keep the full parallel matrix: the histogram+                                # match below replaces every gene column's+                                # MULTISET of values with this path's, pinning+                                # all per-gene marginals (pb, de_score,+                                # de_direction AND the variogram's within-column+                                # pairwise-distance distribution) by+                                # construction; ~100 MB, inside the 28 GB limit.+                                Xpar_keep = Xpar+                            if var_align_on:+                                # per-gene std of the parallel parent path+                                # (POST-PBC, PRE-restore): the node-35 output+                                # whose variogram (0.03471) node 40 (0.03528)+                                # regressed from -- the alignment target.+                                var_std_target = Xpar.std(axis=0)                         Xp = np.log1p(lin * sg)                         if DEBUG:                             lraw = np.log(np.maximum(r, 1e-12)).ravel()@@ -974,7 +1190,34 @@ def main() -> None:                         print(f"pbc: cap={PBC} clamped_frac={float((sc < 1).mean()):.4f} "                               f"post_tot med={float(np.median(np.expm1(Xp).sum(axis=1)) / base):.3f}",                               flush=True)-                if pb_target is not None:+                if pb_target is not None and hist_match_on:+                    # Histogram-match decode (node 42): replace the Newton+                    # pb restore. Each gene column of the mechanism output is+                    # rank-remapped onto the SORTED values of the parallel+                    # (undiffused, node-40-exact) path's column: the written+                    # column keeps WHICH cells are brighter than which (the+                    # spatial arrangement the mechanism created -- a monotone+                    # per-column map preserves the ordering, and zeros stay+                    # zeros because both paths share the anchor support) but+                    # its MULTISET of values becomes the parent path's exactly.+                    # All per-gene marginals are therefore pinned by+                    # construction: pb (= de_score/de_direction), the+                    # within-column pairwise-distance distribution (= the+                    # variogram, which reads each column as an unordered+                    # sample), mean and variance. The mechanism can only+                    # RE-ARRANGE values between cells -- exactly the freedom+                    # neighborhood_mmd (expression-position pairing) and mmd_u+                    # (joint cloud) read. Ties are value-identical, so the+                    # output is deterministic under any stable sort.+                    order_cur = np.argsort(Xp, axis=0, kind="stable")+                    sorted_par = np.sort(Xpar_keep, axis=0)+                    Xp = np.take_along_axis(sorted_par, order_cur, axis=0)+                    if DEBUG:+                        resid_h = float(np.max(np.abs(Xp.mean(axis=0) - pb_target)))+                        print(f"hist_match: max pb resid={resid_h:.3e} "+                              f"std_rel_dev med={float(np.median(np.abs(Xp.std(axis=0) - Xpar_keep.std(axis=0)) / np.maximum(Xpar_keep.std(axis=0), 1e-12))):.3e}",+                              flush=True)+                elif pb_target is not None:                     # Column restore (node 40 backup decode): per-gene factor                     # c_g solving mean_i log1p(lin_ig * c_g) = pb_target_g by                     # Newton (h(c) is concave increasing -> monotone safe with@@ -998,6 +1241,52 @@ def main() -> None:                         print(f"pb_restore: iters={PB_RESTORE_ITERS} max_resid={resid:.3e} "                               f"c_min={float(c.min()):.4f} c_max={float(c.max()):.4f} "                               f"c_med={float(np.median(c)):.4f}", flush=True)+                if var_align_on and var_std_target is not None and pb_target is not None:+                    # Node 42 secondary: per-gene second-moment alignment.+                    # Rescale each gene column's deviations around its OWN+                    # mean by sigma_parent_g / sigma_cur_g (sigma_parent =+                    # the parallel global-reference path, post-PBC -- the+                    # node-35 output whose variogram 0.03471 node 40's+                    # type-scoped re-closure regressed to 0.03528). The+                    # column mean is the fixed point of the rescale, so pb+                    # (and dp, de_score, de_direction) is preserved EXACTLY+                    # by construction; the pass only equalises the+                    # within-column spread. The rescale can push values+                    # below 0, so the anchor support mask is re-applied and+                    # a second Newton column restore pins the pb again --+                    # the zero pattern and dp stay bit-preserved.+                    mu = Xp.mean(axis=0)+                    sig_cur = Xp.std(axis=0)+                    ratio = np.divide(var_std_target, sig_cur, out=np.ones_like(sig_cur),+                                      where=sig_cur > 1e-12)+                    if VAR_ALIGN_CAP > 0.0:+                        ratio = np.clip(ratio, 1.0 / VAR_ALIGN_CAP, VAR_ALIGN_CAP)+                    Xv = mu + (Xp - mu) * ratio+                    Xv = np.maximum(Xv, 0.0)+                    Xv = np.where(Xs > 0, Xv, 0.0)+                    Lin2 = np.expm1(Xv)+                    u2 = np.zeros(Lin2.shape[1], dtype=np.float64)+                    active2 = pb_target > 0.0+                    for _ in range(PB_RESTORE_ITERS):+                        c2_it = np.exp(u2)+                        Lc2 = Lin2 * c2_it+                        h2 = np.log1p(Lc2).mean(axis=0) - pb_target+                        d2 = (Lc2 / (1.0 + Lc2)).mean(axis=0)+                        step2 = np.divide(-h2, d2, out=np.zeros_like(u2),+                                          where=(d2 > 1e-15) & active2)+                        u2 = u2 + np.clip(step2, -5.0, 5.0)+                    c2 = np.exp(u2)+                    Xp = np.log1p(Lin2 * c2)+                    if DEBUG:+                        resid2 = float(np.max(np.abs(Xp.mean(axis=0) - pb_target)))+                        sig_post = Xp.std(axis=0)+                        print(f"var_align: cap={VAR_ALIGN_CAP} "+                              f"ratio_med={float(np.median(ratio)):.4f} "+                              f"ratio_q10={float(np.quantile(ratio, 0.1)):.4f} "+                              f"ratio_q90={float(np.quantile(ratio, 0.9)):.4f} "+                              f"sig_post/target med_rel_dev="+                              f"{float(np.median(np.abs(sig_post - var_std_target) / np.maximum(var_std_target, 1e-9))):.4f} "+                              f"max_resid2={resid2:.3e}", flush=True)                 if POST_EPS > 0.0 and POST_STEPS > 0 and post_on:                     # FALSIFIED alternative (node 35, default off -- POST_EPS                     # ships at 0.0): a post-hoc

调研来源?调研员查到并用到的知识条目和文献检索结果(只列标题和编号)。

用到的知识库条目

编号标题出处
k007Interval staging and held-out-window filtering of external datanotes/official/来件/virtualembryo.ai/rules.md
k024World-model evaluation dimensions for state-transition predictorsnotes/competition/07_biomedical_world_models.md
k016Degenerate-solution checks for population predictionsnotes/handover/02_知识学习路线.md

分析结果?分析员写的 ANALYSIS.json:改了什么、各组分数怎么变、假设是否成立、经验和下一步建议。

改了什么PLAN 主机制(同型 15-NN 再闭合参考,NN_MIN=1)单独实测在噪声带内持平(A 半 57.299–57.374 vs 父 57.332),Engineer 遂将节点 37 被证否的速度场空间扩散(W=0.7,K=15)在扩展的 dp 钉死保护层下复活(并行路径从未扩散速度完整重跑节点 40 计算并接管硬门控),叠加 NN 参考和逐基因方差对齐后提交;另证否直方图匹配解码(51.78)。
各组分数的变化cell_state:在噪声内偏正:+0.36(59.32→59.68),其中 mmd_u raw 0.04529→0.04348(skill 0.563→0.573,得分 +0.12),variogram raw 0.03528→0.0357 微付(得分 -0.04)
expression_change:噪声内:de_score 0.2778、de_direction 0.3874 均逐位不变(得分 +0.00),dp 钉死按构造保证
local_spatial:在噪声内偏正:+0.56(60.69→61.25),neighborhood_mmd raw 0.07304→0.07134(skill 0.607→0.613,得分 +0.14)
shape_scale:噪声内:+0.00,坐标冻结,三项 raw 逐位不变,全在地板 0.500
family_idT2HX-01
假设是否成立unclear
经验
  1. 在 dp 被逐基因 Newton 复原精确钉死的基座上,任何主路径'再分配类'机制在构造上无法移动 de_score/de_direction,可安全复活此前因 DE 等值交换被证否的机制(节点 37 的速度扩散在本节点 W 扫描下 nb_mmd/mmd_u 单调改善)。
  2. 同型 15-NN 再闭合参考单独使用是噪声内持平(6 个解码全在父 ±0.05 带内):型内空间局部统计量与型中位数差异太小,不足以驱动分数;作为叠加组件只值 +0.027 A 半。
  3. 逐列直方图匹配到并行路径灾难性失败(A 半 51.78,nb_mmd 0.12921,结构门 0.61):钉死每列边际但列间独立重排会摧毁跨基因联合结构;再分配机制只能钉列均值或列二阶矩,不能钉整列多重集。
  4. 速度扩散改变列内分布形状,variogram 付出(0.03541→0.03640 A 半),逐基因方差对齐只吸收约 1/4 的代价;diffusion 类机制的净收益 = nb_mmd/mmd_u 增益 − variogram 代价。
  5. 本榜为外推榜、本地尺子已知高估;总分 +0.23 在 T2 约 1 分噪声内,判断依据应是 raw 指标跨解码单调性(nb_mmd 7 个解码单调)而非总分。
mechanism_active是
下一步建议
  1. 针对 cell_state(variogram):在扩散后做列内软截尾/分位压缩再二次 Newton 复原(保持跨基因细胞级耦合),目标把 variogram raw 从 0.0364 拉回 ≤0.0354 而不伤 nb_mmd;不要重试直方图匹配。
  2. 针对 local_spatial/cell_state:在 dp 钉死保护层下重扫底物平滑 ε∈{0,0.05,0.2} 与 β_rec∈{0,0.1,0.3}——旧最优是在无保护基座上测的,现在这些参数的 DE 代价已被钉死层吸收,可能有净增益。
  3. 针对 local_spatial:W 峰很平(0.5–1.0 都在 57.50–57.54 A 半),不必重调 W;可试扩散核各向异性(只在同型邻居内扩散 vs 全邻居)对比 nb_mmd raw 是否进一步单调下降。

对话摘要?每个角色和大模型对话的统计:轮数、工具调用、用时、token 数和最后的回答摘录;原始记录只给路径。

只给统计和最后回答的摘录;完整对话请到原始记录位置里列出的文件看。

分析员

角色?调研员写计划、工程师改代码、分析员解读分数、审查员检查作弊。分析员 alibaba-token-plan-cn/qwen3.8-max
调用次数1 次
轮数?大模型一共回复了几轮(每轮可以调用多个工具)。3
工具调用?大模型调用读文件、执行命令等工具的次数,按工具名统计。共 2 次:bash 1、write 1
用时不到 1 分
token 数?输入 / 输出(含思考)的 token 数,来自接口返回的用量。输入 22,715 · 输出 1,223 · 思考 888
任务(第一行)分析节点 n42 的打分结果,写 ANALYSIS.json
最后的回答(摘录)
ANALYSIS.json written
原始记录位置?完整对话记录在 Spark 上的文件路径;看板不复制原始内容。/home/spark-longxinyang/vec/runs/formal/20261003-172000-search-t2-heart-extrap-chain-12h/nodes/42/analyst.jsonl 7 KB
/home/spark-longxinyang/vec/runs/formal/20261003-172000-search-t2-heart-extrap-chain-12h/nodes/42/analyst.stderr

工程师

角色工程师 alibaba-token-plan-cn/qwen3.8-max
调用次数1 次
轮数102
工具调用共 105 次:bash 55、edit 31、read 15、write 4
用时1 小时 20 分
token 数输入 304,186 · 输出 45,660 · 思考 79,258
任务(第一行)按计划修改程序:空间局部再闭合参考:同型15-NN均值替代型中位数,攻nb_mmd
最后的回答(摘录)
All verifications pass. Final state of `solution/`:

- **run.py** defaults = submitted config (nn1 + vdiff W=0.7 + var_align), clean-env output bit-equal to the best-scored prediction
- **--ablate nn_ref** → bit-for-bit parent node 40 (mechanism_active=yes)
- Seeds 0/1/2 identical; disguised view (+1 day shift, shuffled manifest, renamed files) identical; single-input view = verbatim copy_last; vec-check ok; ~13 s / 2.6 GB CPU
- **METHOD.md / README.md** rewritten with full query table and falsification records

---

**做了什么**:按 PLAN 实现同型 15-NN 再闭合参考(6 个解码),单独使用时全部在父节点 A 半 ±0.05 噪声带内(57.299–57.374 vs 57.332),按 PLAN 判定规则视为不优于父;遂按任务书要求转备选机制——把节点 37 被证否的速度场空间扩散(当时 nb_mmd 随 W 单调改善但以 de_direction 等值交换)在扩展的 dp 钉死保护层下复活:并行路径从未扩散速度完整重跑节点 40 计算并接管硬门控,主路径做 W=0.7 的 15-NN 速度扩散 + NN_MIN=1 同型 NN 参考 + 逐基因方差对齐(二次 Newton 复原钉死 pb)。另实测证否直方图匹配解码(51.78,列间独立重排摧毁跨基因联合结构)。

**查分结果**(18/20 次,A 半):提交配置 57.5413 vs 父 57.332(+0.209);nb_mmd 0.07621→0.07468、mmd_u 0.04630→0.04447 跨 7 个解码单调(结构性证据,符合父节点教训的判据);de_score/de_direction 15 次查分全部逐位冻结在 0.2778/0.3839;variogram 0.035414→0.036399 是唯一付出项;形状组地板不动、结构门=1。

**下一步最值得试**:(1) variogram 的列内分布**形状**代价——σ 对齐只吸收 1/4,直方图匹配已证否,可试列内软截尾/分位压缩后再 Newton 复原(保持跨基因耦合的前提下修形状);(2) dp 钉死保护层下重新扫 ε(底物平滑)与 β_rec——它们的旧最优是在无保护基座上测的,dp 通道现在可控;(3) W 峰很平(0.5–1.0 都在 57.50–57.54),B 半复跑无需重调。
原始记录位置/home/spark-longxinyang/vec/runs/formal/20261003-172000-search-t2-heart-extrap-chain-12h/nodes/42/engineer.jsonl 791 KB
/home/spark-longxinyang/vec/runs/formal/20261003-172000-search-t2-heart-extrap-chain-12h/nodes/42/engineer.stderr

调研员

角色调研员 alibaba-token-plan-cn/qwen3.8-max
调用次数1 次
轮数1
工具调用共 0 次:—
用时3 分
token 数输入 22,382 · 输出 1,679 · 思考 5,876
任务(第一行)为节点 n42(改进,父节点 n40)写改进计划 PLAN.json
最后的回答(摘录)
r_ref_i/r̃_i)^γ,后续PBC、pb复原(并行跑全局参考路径、Newton列缩放)完全不变。\n\n2) 参数初值与搜索:\n   - 第一档:VEC_NN_MIN=5,直接查分(1次)。\n   - 若优于父(A半>57.59):扫NN_MIN∈{3,10}(2次)。\n   - 若不优于父:试混合参考 r_ref=(1-λ)×type_median+λ×nn_mean,λ∈{0.5,0.25}(2次)。\n   - 上限6次查分用于主机制网格。\n\n3) 二级机制(仅当主机制确认后、仍有查分余额):VEC_VAR_ALIGN=1,pb复原后逐基因方差对齐:x'_g=mean_g+(x_g-mean_g)×(σ_parent_g/σ_cur_g),预期修复variogram 0.03528→≤0.0347。1-2次查分。\n\n4) 离线预检(不耗查分):\n   a) 确认输出与父逐位不同(节点40教训:3次额度浪费在静默回退);\n   b) 统计同型15-NN覆盖率:若>50%细胞的同型邻居<5,说明型内空间聚集度不足,主机制退化为型中位(=无操作),应提前终止;\n   c) 计算nn_mean与type_median的相关性:若Pearson>0.98,空间变异不足,预期增益<噪声。\n\n5) 单输入阶段退路:与父相同,输入阶段<2时整体回退copy_last(已验证)。\n\n6) vec-score快速筛选:每次查分前离线算nb_mmd的替代指标(预测的15-NN均值表达与锚阶段15-NN均值表达的余弦距离),只有替代指标改善才送查分。",
  "expected_groups": ["local_spatial", "cell_state"],
  "risks": "1) 型内空间聚集度不足:若同型细胞在空间上均匀散布,15-NN中同型邻居极少,r_ref退回型中位=无操作。Engineer应在离线预检(b)中发现(>50%细胞邻居不足),立即终止不查分。2) 空间变异不足:若型内r̃空间梯度很弱(nn_mean≈type_median),机制等效于无操作,输出与父逐位相同。离线预检(c)可提前发现。3) nb_mmd改善但variogram进一步恶化:空间局部参考可能改变基因列内方差结构。二级机制(方差对齐)可补救;若variogram raw>0.0360,优先加方差对齐而非继续扫主机制参数。4) 本榜是外推榜、本地尺子已知高估(历史本地54.2→官网49.6):A半+0.3以内应视为噪声,判断依据是nb_mmd raw的跨解码单调性而非总分。5) 查分额度有限(20次):主机制最多6次+二级2次+确认2次=10次,留余量给意外。",
  "family_id": "T2HX-01",
  "mechanism": "将再闭合参考点从型级全局中位数改为同型空间邻居(15-NN)的r̃均值,使再闭合成为空间局部离群值校正:与邻居一致的细胞不被调整,偏离邻居的细胞被拉回,从而增强表达-位置配对的空间连贯性。",
  "vs_constant_shift": "常数位移对每个细胞施加相同的乘法因子,不改变细胞间表达分布;本机制根据每个细胞相对其空间邻居的偏离程度施加不同的再闭合因子(偏离大→校正强,一致→不校正),是空间条件化的逐细胞重分配,且受pb复原约束只改列内分布不改列均值。",
  "mechanism_evidence": "1) 离线:统计每个细胞的|nn_mean_i - type_median|/type_median,若中位>5%则机制有作用空间;2) 离线:比较机制开/关时每个细胞再闭合因子s_i的空间自相关(Moran's I on 15-NN graph),机制开时应显著更高;3) 查分:nb_mmd raw从0.07304下降(目标≤0.0720),且随NN_MIN从10→5→3单调(结构性证据);4) mmd_u raw维持≤0.04529;5) de_score/de_direction逐位不变(pb复原保证);6) 四组分变化:local_spatial升、cell_state持平或升、expression_change不变、shape_scale不变。",
  "mechanism_off_control": "--ablate nn_ref(或VEC_REC_REF=type):r_ref退回型中位数,输出与父节点40逐位相同(h5 array_equal验证)。预期差别:关闭后nb_mmd raw回到0.07304,local_spatial组回到60.69;开启后nb_mmd raw应≤0.0720。若关闭后输出与父不同,说明实现有bug。"
}
```
原始记录位置/home/spark-longxinyang/vec/runs/formal/20261003-172000-search-t2-heart-extrap-chain-12h/nodes/42/researcher.jsonl 6 KB
/home/spark-longxinyang/vec/runs/formal/20261003-172000-search-t2-heart-extrap-chain-12h/nodes/42/researcher.stderr

审查员

角色审查员 alibaba-token-plan-cn/qwen3.8-max
调用次数1 次
轮数6
工具调用共 12 次:read 8、bash 2、glob 1、write 1
用时1 分
token 数输入 51,306 · 输出 1,659 · 思考 1,585
任务(第一行)审查节点 n42 的程序是否越界读取、写死目标、钻评分器漏洞
最后的回答(摘录)
REVIEW.json written
原始记录位置/home/spark-longxinyang/vec/runs/formal/20261003-172000-search-t2-heart-extrap-chain-12h/nodes/42/reviewer.jsonl 263 KB
/home/spark-longxinyang/vec/runs/formal/20261003-172000-search-t2-heart-extrap-chain-12h/nodes/42/reviewer.stderr