feat(harness): correctness 三口径 + gate 块按 unit 跑
进化引擎与 gate e-process 从 question_id 口径迁至 unit_id 口径,AR pair 双向 AND 折叠为单元、不被 P/Q 单题计分污染;逐题 predictions 仅作溯源。 - question_units: 新增 unit_correctness_view(units, per_q)->dict[unit_id,bool] 作为逐题→单元折叠的唯一入口(复用 unit_correctness)。 - core/evolution/validate: pair_block/compute_accuracy 参数改 unit_ids、 分母按单元数(键即 unit_id)。 - app/harness/validate(gate 实际执行路径):阶梯题序聚合为单元并保持信息 阶梯序(_ladder_units),gate 块按单元切分(AR pair 整锁不跨块拆); baseline_cache 键含 unit_id、存单元级对错;候选逐题读回后折叠成单元视图; n_used/W/L/四象限/准确率均按单元计;证据行按 unit 口径,candidate_correctness 独立保留逐题对错供 runner 二轨合并。 - runner: probation 结算按 unit 折叠计 W/L(_probation_unit_flips);quadrant 四象限 id 承载 unit_id。 核心算法保真 #5(信息阶梯 e-process):本次仅迁移 correctness 口径,不改冷启动 2:1 / gamma-EMA / 反泄漏算法本身(gate_ladder 迁移见 Task 8)。
This commit is contained in:
@@ -111,3 +111,25 @@ def unit_correctness(unit: QuestionUnit, per_q: dict[str, bool]) -> bool:
|
||||
强制上游先补齐全部单题结果再计单元正确性。
|
||||
"""
|
||||
return all(per_q[q.question_id] for q in unit.questions)
|
||||
|
||||
|
||||
def unit_correctness_view(units: list[QuestionUnit], per_q: dict[str, bool]) -> dict[str, bool]:
|
||||
"""把逐题对错折叠成单元级视图:unit_id → 单元是否整体正确。
|
||||
|
||||
进化引擎(gate e-process / quadrant / probation / pair_block / compute_accuracy)
|
||||
统一消费此单元视图,保证 AR pair 双向 AND、非 AR single 单题,混格池中
|
||||
孪生对折叠为一个单元、不被 P/Q 单题计分污染(核心算法保真 #5)。
|
||||
|
||||
参数:
|
||||
units: 目标单元列表(single 或 pair)。
|
||||
per_q: 题目 question_id → 该题是否作答正确(唯一逐题溯源来源)。
|
||||
|
||||
返回:
|
||||
unit_id → 单元级正确性。single 的 unit_id 等于其 question_id,
|
||||
pair 的 unit_id 等于共享 pair_id。
|
||||
|
||||
关键实现:
|
||||
逐单元复用 unit_correctness(内部以 per_q[q.question_id] 取值,缺任一题
|
||||
触发 KeyError),禁静默兜底、强制上游先补齐全部单题结果。
|
||||
"""
|
||||
return {u.unit_id: unit_correctness(u, per_q) for u in units}
|
||||
|
||||
Reference in New Issue
Block a user