5.0 KiB
Executable File
5.0 KiB
Executable File
多智能体分析与改进方案总结
日期: 2026-04-10 20:15 GMT+8
智能体协作完成的工作
智能体1: 分析师 - 问题诊断
发现的核心问题:
| 问题 | 严重程度 | 影响 |
|---|---|---|
| 证据是LLM生成,非原文摘录 | 🔴 严重 | 82%证据无效 |
| 复合基因名未展开 | 🔴 严重 | 覆盖率虚高 |
| Prompt设计缺陷 | 🟡 中等 | 准确率仅55% |
根因分析:
- Prompt要求LLM"生成"证据,而非"摘录"
- 未强制要求展开复合实体
- 缺乏严格的证据验证
智能体2: 设计师 - 方案设计
PC的关键设计原则:
-
证据必须原文摘录
❌ "genes were expressed in roots" (生成) ✅ "SlSut01 was highly expressed in roots" (原文摘录) -
复合实体必须展开
❌ SlSut01-SlSut40 --[expressed_in]--> roots ✅ SlSut01 --[expressed_in]--> roots ✅ SlSut02 --[expressed_in]--> roots ... (40个单独关系) -
逐句提取,精准定位
- 每句话单独处理
- 避免信息过载
- 证据位置明确
新Prompt设计:
prompt = """Extract gene relationships from the sentence.
CRITICAL RULES:
1. EVIDENCE MUST BE EXACT TEXT from the sentence
2. Use SPECIFIC gene names only, NO ranges like "SlSut01-SlSut40"
3. For "SlSut05, SlSut06, SlSut07, and SlSut08", create 4 SEPARATE relations
FORMAT: gene_id | relation | target | exact_evidence
EXAMPLE:
Sentence: "SlSut05, SlSut06 were on Chr07"
Output:
SlSut05 | located_on | Chr07 | "SlSut05, SlSut06 were on Chr07"
SlSut06 | located_on | Chr07 | "SlSut05, SlSut06 were on Chr07"
"""
智能体3: 编码器 - 实现方案
多智能体提取器架构:
PDF → 分析师(拆分) → 设计师(Prompt) → 编码器(提取) → 验证器(检查) → 总结者(输出)
关键改进:
-
强制原文摘录
def validate_evidence(relation, original_text): if relation.evidence not in original_text: return False # 拒绝 return True -
复合实体展开
def expand_composite_entities(relation): if '-' in relation.source: # SlSut01-SlSut40 → 40个单独关系 for gene in range(1, 41): yield Relation(f"SlSut{gene:02d}", ...) -
三级验证
- 自动验证: 证据存在性
- 附表验证: 染色体位置
- 人工抽样: 准确率检查
智能体4: 验证器 - 验证策略
验证流程:
def validate(relations, original_text):
# 1. 证据存在性检查
for r in relations:
if r.evidence not in original_text:
reject(r)
# 2. 实体标准化检查
for r in relations:
if not is_valid_gene(r.source):
reject(r)
# 3. 附表对比验证
for r in relations:
if r.relation == 'located_on':
expected = supplementary_table[r.source]
if r.target != expected:
flag_for_review(r)
# 4. 人工抽样
sample = random.sample(relations, 20)
accuracy = manual_check(sample)
return accuracy
验证标准:
- 证据在原文中: >95%
- 实体标准化: 100%
- 附表一致性: >90%
- 人工抽样准确率: >90%
智能体5: 总结者 - 最终方案
核心改进总结
1. Prompt改进 ✅
Before:
提取基因关系,提供证据
After:
CRITICAL RULES:
1. EVIDENCE MUST BE EXACT TEXT from the sentence
2. Use SPECIFIC gene names only, NO ranges
3. For multiple genes, create SEPARATE relations
2. 证据验证 ✅
Before: 无验证 After:
if evidence not in original_text:
reject(relation)
3. 实体展开 ✅
Before: SlSut01-SlSut40 (1个关系) After: 40个单独关系
4. 三级验证 ✅
Before: 无验证 After:
- 自动验证 (证据存在性)
- 附表验证 (染色体位置)
- 人工抽样 (准确率)
预期改进效果
| 指标 | Before | After | 提升 |
|---|---|---|---|
| 证据准确率 | 18% | >95% | 5倍 |
| 实体展开率 | 0% | 100% | ∞ |
| 整体准确率 | 55% | >90% | 1.6倍 |
| 验证覆盖率 | 0% | 100% | ∞ |
执行计划
立即执行
- ✅ 完成多智能体分析
- 🔄 实现V2提取器
- ⏳ 执行提取
- ⏳ 三级验证
文件清单
extractor_v2_pro.py- 多智能体提取器test_v2_core.py- 核心改进测试MULTI_AGENT_SUMMARY.md- 本总结
关键认知
之前的错误
- 过于乐观 - 未严格验证就宣称"优秀"
- Prompt设计缺陷 - 未强制原文摘录
- 缺乏验证 - 没有三级验证流程
正确的做法
- 严格验证 - 证据必须在原文中
- 实体展开 - 复合基因名必须拆分
- 三级验证 - 自动+附表+人工
时间: 2026-04-10 20:20 GMT+8
状态: 多智能体分析完成,改进方案已设计
签名: 🧬🤖