diff --git a/app/question_gen/adversarial_filter.py b/app/question_gen/adversarial_filter.py index fd919ce..7c1901c 100644 --- a/app/question_gen/adversarial_filter.py +++ b/app/question_gen/adversarial_filter.py @@ -723,9 +723,7 @@ async def run_adversarial_rounds( max_steps=config.adversarial_agent_max_steps, model=agent.model, ) - all_questions: dict[str, GeneratedQuestion] = { - q.question_id: q for q in initial_questions - } + all_questions: dict[str, GeneratedQuestion] = {q.question_id: q for q in initial_questions} pending = list(initial_questions) passed_now = 0 for round_no in range(config.adversarial_max_rounds): @@ -749,9 +747,7 @@ async def run_adversarial_rounds( session_id=session_id, ) passed_now = len(write_final_bank(final_path, store, all_questions, cfg_fp)) - _report_difficulty( - store, round_no=round_no, threshold=config.difficulty_warn_threshold - ) + _report_difficulty(store, round_no=round_no, threshold=config.difficulty_warn_threshold) deficit = target - passed_now if deficit <= 0 or round_no + 1 >= config.adversarial_max_rounds: break diff --git a/app/question_gen/run_store.py b/app/question_gen/run_store.py index 77b78c5..c778c6e 100644 --- a/app/question_gen/run_store.py +++ b/app/question_gen/run_store.py @@ -457,16 +457,20 @@ class QuestionGenStore: created_at=datetime('now') """, ( - question_id, question_hash, stage, round, agent_prediction, + question_id, + question_hash, + stage, + round, + agent_prediction, None if agent_correct is None else int(agent_correct), - verdict, pair_id, agent_config, + verdict, + pair_id, + agent_config, ), ) self._conn.commit() - def completed_stages( - self, question_id: str, question_hash: str, agent_config: str - ) -> set[str]: + def completed_stages(self, question_id: str, question_hash: str, agent_config: str) -> set[str]: """返回该题在当前 hash+config 下已完成的 stage 集合(续跑用)。 Parameters @@ -501,8 +505,7 @@ class QuestionGenStore: 当前 agent 配置指纹;保留该 config 行,其余全部删除。 """ self._conn.execute( - "DELETE FROM adversarial_verdicts " - "WHERE question_id=? AND agent_config!=?", + "DELETE FROM adversarial_verdicts WHERE question_id=? AND agent_config!=?", (question_id, agent_config), ) self._conn.commit() @@ -521,15 +524,12 @@ class QuestionGenStore: 该轮 stage='cheat' 的 agent_correct 平均值;无数据时返回 0.0。 """ row = self._conn.execute( - "SELECT AVG(agent_correct) FROM adversarial_verdicts " - "WHERE stage='cheat' AND round=?", + "SELECT AVG(agent_correct) FROM adversarial_verdicts WHERE stage='cheat' AND round=?", (round_no,), ).fetchone() return float(row[0]) if row and row[0] is not None else 0.0 - def final_passed_question_ids( - self, hash_by_qid: dict[str, str], agent_config: str - ) -> set[str]: + def final_passed_question_ids(self, hash_by_qid: dict[str, str], agent_config: str) -> set[str]: """在当前 hash+config 下通过两门的 question_id 集合(final JSON 全量重建用)。 终判规则(防 stale 泄漏):仅当该题在 **当前 question_hash + 当前 @@ -559,9 +559,7 @@ class QuestionGenStore: ).fetchall() if not rows: continue - cheat_passed = any( - stage == "cheat" and verdict == "passed" for stage, verdict in rows - ) + cheat_passed = any(stage == "cheat" and verdict == "passed" for stage, verdict in rows) no_flip = any(verdict == "filtered_no_flip" for _, verdict in rows) if cheat_passed and not no_flip: passed.add(qid) diff --git a/research-wiki/graph/edges.json b/research-wiki/graph/edges.json index 87acad1..2b37d3e 100644 --- a/research-wiki/graph/edges.json +++ b/research-wiki/graph/edges.json @@ -185,6 +185,11 @@ "id": "plan:grounded-question-gen-phaseA", "label": "Grounded Question-Gen Phase A", "type": "plan" + }, + { + "id": "plan:adversarial-question-gen-phaseB", + "label": "Adversarial Question-Gen Phase B", + "type": "plan" } ], "links": [ @@ -348,6 +353,13 @@ "relation": "implements", "evidence": "Phase A 实现计划", "added": "2026-07-14T18:41:35.899803+00:00" + }, + { + "source": "plan:adversarial-question-gen-phaseB", + "target": "design:adversarial-question-gen-phaseB", + "relation": "implements", + "evidence": "Phase B 实现计划", + "added": "2026-07-14T21:09:48.115521+00:00" } ] } \ No newline at end of file diff --git a/research-wiki/index.md b/research-wiki/index.md index 35a351c..3490291 100644 --- a/research-wiki/index.md +++ b/research-wiki/index.md @@ -1,6 +1,6 @@ # Research Wiki 索引 -> 自动生成,更新时间:2026-07-14 18:41 UTC +> 自动生成,更新时间:2026-07-14 21:09 UTC ## design (29) - [2026-07-06-core-agent-adapters-llm-design](designs/2026-07-06-core-agent-adapters-llm-design.md) `design:2026-07-06-core-agent-adapters-llm-design` @@ -42,7 +42,7 @@ - [Harness 评估: Spec-1 修复验证 (infer_spec1check)](findings/eval-spec1check.md) `finding:eval-spec1check` - [Harness 评估: Spec-2 批量并行建树](findings/eval-spec2-batch-tree-build.md) `finding:eval-spec2-batch-tree-build` -## plan (34) +## plan (36) - [2026-07-06-core-agent-adapters-llm](plans/2026-07-06-core-agent-adapters-llm.md) `plan:2026-07-06-core-agent-adapters-llm` - [2026-07-07-app-harness](plans/2026-07-07-app-harness.md) `plan:2026-07-07-app-harness` - [2026-07-07-core-evolution](plans/2026-07-07-core-evolution.md) `plan:2026-07-07-core-evolution` @@ -56,11 +56,13 @@ - [2026-07-12-per-category-pool-strategy](plans/2026-07-12-per-category-pool-strategy.md) `plan:2026-07-12-per-category-pool-strategy` - [2026-07-14-action-recognition-strategy](plans/2026-07-14-action-recognition-strategy.md) `plan:2026-07-14-action-recognition-strategy` - [2026-07-14-action-recognition-training](plans/2026-07-14-action-recognition-training.md) `plan:2026-07-14-action-recognition-training` +- [2026-07-14-adversarial-question-gen-phaseB-plan](plans/2026-07-14-adversarial-question-gen-phaseB-plan.md) `plan:2026-07-14-adversarial-question-gen-phaseB-plan` - [2026-07-14-grounded-question-gen-phaseA-plan](plans/2026-07-14-grounded-question-gen-phaseA-plan.md) `plan:2026-07-14-grounded-question-gen-phaseA-plan` - [2026-07-14-maintenance-pool](plans/2026-07-14-maintenance-pool.md) `plan:2026-07-14-maintenance-pool` - [2026-07-14-task-type-strategy-framework](plans/2026-07-14-task-type-strategy-framework.md) `plan:2026-07-14-task-type-strategy-framework` - [Action Recognition 单题型首次训练实验计划](plans/action-recognition-training.md) `plan:action-recognition-training` - [ActionRecognitionStrategy 特化实现计划 (Plan B)](plans/action-recognition-strategy.md) `plan:action-recognition-strategy` +- [Adversarial Question-Gen Phase B](plans/adversarial-question-gen-phaseB.md) `plan:adversarial-question-gen-phaseB` - [app/harness/ 训练循环编排层实现计划](plans/app-harness.md) `plan:app-harness` - [app/search/ 搜索 Agent 装配层实现计划](plans/2026-07-07-search-module.md) `plan:2026-07-07-search-module` - [core/agent/ + adapters/llm 基础设施实现计划](plans/core-agent-adapters-llm.md) `plan:core-agent-adapters-llm` @@ -78,7 +80,8 @@ - [赛题生成工具实现计划](plans/question-gen-synth.md) `plan:question-gen-synth` - [项目基础设施初始化计划](plans/infrastructure-setup.md) `plan:infrastructure-setup` -## schema (2) +## schema (3) +- [表结构: adversarial_verdicts(Phase B agent 门判定)](schemas/adversarial-verdicts.md) `schema:adversarial-verdicts` - [表结构: question_gen_items(逐题门判定)](schemas/question-gen-items.md) `schema:question-gen-items` - [表结构: question_gen_runs(出题批次)](schemas/question-gen-runs.md) `schema:question-gen-runs` diff --git a/research-wiki/log.md b/research-wiki/log.md index 59854e5..36d5b3e 100644 --- a/research-wiki/log.md +++ b/research-wiki/log.md @@ -89,3 +89,6 @@ - [2026-07-14 18:41 UTC] 新增边: plan:grounded-question-gen-phaseA --implements--> design:grounded-question-gen-phaseA - [2026-07-14 18:41 UTC] 重建索引: 76 篇页面 - [2026-07-14 18:41 UTC] 重建索引: 76 篇页面 +- [2026-07-14 21:09 UTC] 新增 plan: Adversarial Question-Gen Phase B (plan:adversarial-question-gen-phaseB) +- [2026-07-14 21:09 UTC] 新增边: plan:adversarial-question-gen-phaseB --implements--> design:adversarial-question-gen-phaseB +- [2026-07-14 21:09 UTC] 重建索引: 79 篇页面 diff --git a/research-wiki/plans/adversarial-question-gen-phaseB.md b/research-wiki/plans/adversarial-question-gen-phaseB.md new file mode 100644 index 0000000..ea2218d --- /dev/null +++ b/research-wiki/plans/adversarial-question-gen-phaseB.md @@ -0,0 +1,9 @@ +--- +type: plan +node_id: plan:adversarial-question-gen-phaseB +title: "Adversarial Question-Gen Phase B" +date: 2026-07-14 +--- + +# Adversarial Question-Gen Phase B +