forked from admin/PlantAI-rag-new
fix(r4-28v3): 检索模式关闭图证据检索(use_neo4j),arginine 150s->亚秒
r3(2026-09-10 #28)检索模式语义只关了 native_chain,漏关 use_neo4j (graph 证据种子检索,graph_top_k=80):arginine 向量候选过 0.45 后照常 启动 13M 断言库图查询 150s+(TL 实测:关 neo4j 后 0.787s)。 强制块置于所有 ablation 解析之后,用户 ablation 不得重开图检索 (性能红线);use_graph_expansion 依赖 use_neo4j 一并显式关。 chat 模式不受影响。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1293,10 +1293,19 @@ class QAV1Pipeline:
|
||||
if retrieval_only:
|
||||
# 缺陷 #28 回改 v2(2026-09-11):检索模式绝不产生答案——无条件
|
||||
# 关闭草稿/规划/最终 LLM(不看 llm.available;LLM 调用纯浪费且
|
||||
# 拖慢 search)。仍返回 top30 证据与 native 图链。
|
||||
# 拖慢 search)。仍返回 top30 向量证据。
|
||||
use_draft = False
|
||||
use_planner = False
|
||||
use_final_llm = False
|
||||
# 缺陷 #28 回改 v3(2026-09-11):检索模式只走 Qdrant 向量——
|
||||
# r3 语义补完。图证据种子检索(use_neo4j,graph_top_k=80)在
|
||||
# 13M 边库上 150s+(TL 实测 arginine 150s+ vs 关 neo4j 后
|
||||
# 0.787s),不可接受。use_graph_expansion 依赖 use_neo4j 一并
|
||||
# 显式关(本块在所有 ablation 解析之后:检索模式用户 ablation
|
||||
# 不得重开图检索——性能红线)。native_graph_chains 空数组在
|
||||
# search 分支已安全。
|
||||
use_neo4j = False
|
||||
use_graph_expansion = False
|
||||
|
||||
t0 = time.perf_counter()
|
||||
if use_draft:
|
||||
|
||||
@@ -212,6 +212,36 @@ def test_search_mode_no_llm_no_rerank_keeps_good_only():
|
||||
assert src["final_score"] == src["vector_score"]
|
||||
|
||||
|
||||
def test_search_mode_use_neo4j_forced_off():
|
||||
"""回改 v3:search 模式 retriever 收到的检索选项 use_neo4j=False
|
||||
(r3 语义补完——图证据种子检索在 13M 边库上 150s+,检索模式只走 Qdrant)。
|
||||
"""
|
||||
p = _make_pipeline("legacy")
|
||||
out = p.answer(
|
||||
"arginine biosynthesis",
|
||||
retrieval_only=True,
|
||||
native_chain_enabled=False,
|
||||
progress_callback=None,
|
||||
)
|
||||
kwargs = p._retriever_stub.last_kwargs
|
||||
assert kwargs["use_neo4j"] is False
|
||||
assert kwargs["use_graph_expansion"] is False # 依赖 use_neo4j 一并关
|
||||
assert kwargs["use_qdrant"] is True
|
||||
# 即使 ablation 显式开图检索,检索模式也不得重开(性能红线)
|
||||
p2 = _make_pipeline("legacy")
|
||||
out2 = p2.answer(
|
||||
"arginine biosynthesis",
|
||||
retrieval_only=True,
|
||||
native_chain_enabled=False,
|
||||
ablation={"retrieval": {"use_neo4j": True, "use_graph_expansion": True}},
|
||||
progress_callback=None,
|
||||
)
|
||||
kwargs2 = p2._retriever_stub.last_kwargs
|
||||
assert kwargs2["use_neo4j"] is False
|
||||
assert kwargs2["use_graph_expansion"] is False
|
||||
assert out2["success"] is True
|
||||
|
||||
|
||||
def test_chat_mode_passes_no_threshold():
|
||||
p = _make_pipeline("legacy")
|
||||
object.__setattr__(p.config, "enable_bge_rerank", False)
|
||||
|
||||
Reference in New Issue
Block a user