ai-labeling: Prompt 1 v0.3(80%) + Prompt 3 v0.2(90%) + GT v0.4.2

Prompt 1 迭代 v0.1→v0.3:
- 多选字段加显著篇幅门槛+从属零件反例教学
- 前沿科技vs横切类比拆清(技术主角测试)
- 装备深解加同类体系/窄类别测试
- 跨域改为传播分类框(≥3域即标,非军事术语)
- 全对率 40%→80%

Prompt 3 开篇钩子 v0.1→v0.2:
- 阅读范围扩至3段(导视+主持人+首段解说)
- 强判定从紧迫感硬门槛改为6条独立路径
- 弱判定区分信息性提问vs悬念式提问
- 命中率 50%→90%

ground-truth v0.4.2:ep008补标跨域 + 20期opening_hook全标注
脚本:run_labeling/summarize 支持 opening_hook,summarize改从源GT读取

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
simonkoson
2026-06-25 13:26:42 +08:00
parent d8057b07e9
commit 81b331d6d7
6 changed files with 440 additions and 79 deletions
+3 -2
View File
@@ -44,6 +44,7 @@ ALL_EPISODES = list(range(1, 21))
FIELD_PROMPT_MAP = {
"narrative": "prompt2_narrative.md",
"classification": "prompt1_classification.md",
"opening_hook": "prompt3_opening_hook.md",
}
@@ -145,8 +146,8 @@ def main():
parser.add_argument("--ep", type=int, help="单期编号")
parser.add_argument("--all", action="store_true", help="跑全部")
parser.add_argument("--model", default="mimo-v2.5-pro", help="模型键名")
parser.add_argument("--field", default="narrative", choices=["narrative", "classification"],
help="打标字段: narrative(叙事结构) / classification(4分类)")
parser.add_argument("--field", default="narrative", choices=["narrative", "classification", "opening_hook"],
help="打标字段: narrative(叙事结构) / classification(4分类) / opening_hook(开篇钩子)")
args = parser.parse_args()
if args.all:
for ep in ALL_EPISODES:
+43 -5
View File
@@ -14,6 +14,16 @@ from pathlib import Path
BASE_DIR = Path(__file__).parent.parent
EXPERIMENTS_DIR = BASE_DIR / "experiments"
GROUND_TRUTH = BASE_DIR / "benchmark-set" / "ground-truth.json"
def load_ground_truth_map():
"""从 ground-truth.json 源文件加载最新 GT(而非实验文件中的快照)。"""
try:
data = json.loads(GROUND_TRUTH.read_text(encoding="utf-8"))
return {ep["ep"]: ep for ep in data["episodes"]}
except Exception:
return {}
def load_json(path):
@@ -57,6 +67,7 @@ def run(model, field="narrative"):
return
ep_files = latest_per_ep(files)
gt_map = load_ground_truth_map() # 从源文件读最新 GT
rows = []
parse_fail = 0
@@ -67,12 +78,22 @@ def run(model, field="narrative"):
rows.append({"ep": ep, "title": "?", "gt": "?", "pred": "解析失败", "hit": False, "conf": "?"})
continue
gt = data.get("ground_truth", {})
# 优先用源文件 GT,回退到实验文件中的快照
gt = gt_map.get(ep, data.get("ground_truth", {}))
result = data.get("result")
title = gt.get("title", "?")
if field == "narrative":
if field == "opening_hook":
gt_val = gt.get("opening_hook")
pred_val = result.get("opening_hook") if result else None
conf = result.get("confidence", "?") if result else "?"
if gt_val is None:
rows.append({"ep": ep, "title": title, "gt": "(无标注)", "pred": pred_val or "解析失败", "hit": None, "conf": conf})
else:
hit = pred_val == gt_val if pred_val is not None else False
rows.append({"ep": ep, "title": title, "gt": gt_val, "pred": pred_val or "解析失败", "hit": hit, "conf": conf})
elif field == "narrative":
gt_val = gt.get("narrative_structure", "?")
pred_val = result.get("narrative_structure") if result else None
conf = result.get("confidence", "?") if result else "?"
@@ -93,7 +114,24 @@ def run(model, field="narrative"):
all_hit = all(v is True for v in sub.values() if v is not None)
rows.append({"ep": ep, "title": title, "sub": sub, "all_hit": all_hit, "conf": conf})
if field == "narrative":
if field == "opening_hook":
for r in rows:
if r["hit"] is None:
mark = "-"
else:
mark = "" if r["hit"] else ""
conf_str = f'置信度:{r["conf"]}' if r["conf"] != "?" else ""
print(f' ep{r["ep"]:03d} {r["title"]:<12} | 标准:{r["gt"]:<6} | {model}:{r["pred"]:<6} | {mark} {conf_str}')
scored = [r for r in rows if r["hit"] is not None]
hits = sum(1 for r in scored if r["hit"])
total = len(scored)
unlabeled = sum(1 for r in rows if r["hit"] is None)
print(f"\n ===== {model} 命中情况 =====")
print(f" opening_hook 命中: {hits}/{total} = {hits*100//total if total else 0}%")
print(f" 无标注(跳过): {unlabeled}")
print(f" 解析失败: {parse_fail}")
elif field == "narrative":
# 打印每行
for r in rows:
mark = "" if r["hit"] else ""
@@ -139,7 +177,7 @@ def run(model, field="narrative"):
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--model", required=True, help="模型键名,如 mimo-v2.5-pro / deepseek-v4-pro")
parser.add_argument("--field", default="narrative", choices=["narrative", "classification"],
help="打标字段: narrative(叙事结构) / classification(4分类)")
parser.add_argument("--field", default="narrative", choices=["narrative", "classification", "opening_hook"],
help="打标字段: narrative(叙事结构) / classification(4分类) / opening_hook(开篇钩子)")
args = parser.parse_args()
run(args.model, args.field)