什么是 Signal-Driven Decision?
Signal-Driven Decision 是核心架构,它通过从请求中提取多种 signal 并将它们结合起来做出更好的路由决策,从而实现智能路由。
核心理念
传统路由使用单一信号:
# 传统:单一分类模型
if classifier(query) == "math":
route_to_math_model()
Signal-Driven routing 使用多种 signal:
# 信号驱动:多种信号组合
if (keyword_match AND domain_match) OR high_embedding_similarity:
route_to_math_model()
为什么这很重要:多个 signal 共同投票比任何单一 signal 做出更准确的决策。
6 种 Signal 类型
1. Keyword Signal
内容:使用 AND/OR 运算符的快速模式匹配 延迟:小于 1ms 用例:确定性路由、合规性、安全性
signals:
keywords:
- name: "math_keywords"
operator: "OR"
keywords: ["calculate", "equation", "solve", "derivative"]
示例:"Calculate the derivative of x^2" → 匹配 "calculate" 和 "derivative"
2. Embedding Signal
内容:使用 embedding 的语义相似度 延迟: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 相似度 → 匹配!