什么是信号驱动决策?
信号驱动决策是语义路由的核心架构:从请求中提取多种信号并组合它们,以做出更优的路由决策。
核心思想
传统路由往往依赖单一信号:
# 传统:单一分类模型
if classifier(query) == "math":
route_to_math_model()
信号驱动路由组合多种信号:
# 信号驱动:多信号组合
if (keyword_match AND domain_match) OR high_embedding_similarity:
route_to_math_model()
为何重要:多信号共同「投票」比任何单一信号都更可靠。
十三类信号
1. 关键词信号
- 含义:支持 AND/OR 的快速模式匹配
- 延迟:小于 1ms
- 场景:确定性路由、合规、安全
signals:
keywords:
- name: "math_keywords"
operator: "OR"
keywords: ["calculate", "equation", "solve", "derivative"]
示例:「Calculate the derivative of x^2」→ 匹配「calculate」与「derivative」
2. 嵌入信号
- 含义:用语义嵌入衡量相似度
- 延迟:10–50ms
- 场景:意图识别、同义改写
signals:
embeddings:
- name: "code_debug"
threshold: 0.70
candidates:
- "My code isn't working, how do I fix it?"
- "Help me debug this function"
示例:「Need help debugging this function」→ 相似度 0.78 → 命中