feat: 多专业小模型+路由模型系统 MVP(mock 全链路 + FastAPI 网关 + 论文调研)

This commit is contained in:
tzt
2026-08-12 10:40:04 +08:00
commit 1e51167ea5
50 changed files with 49382 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
# ============================================================
# 多专业小模型 + 路由模型系统 — 配置
# 默认全 mock 模式(零依赖、离线可跑)。要接入真实模型,把对应
# 后端 type 改为 hf / api 即可(见 README)。
# ============================================================
system:
name: multi-expert-router
version: 0.1.0
router:
low_confidence_threshold: 0.60 # 分类置信度低于此值 -> 直接走大模型
judge_fallback_threshold: 0.70 # Judge 质量分低于此值 -> 升级大模型
default_temperature: 0.2
classifier:
type: rule # rule(零依赖)| hftransformers
model: Qwen/Qwen3-0.6B
confidence_floor: 0.55
domains:
- code
- math
- legal
- medical
- general
experts:
code: { type: mock, model: Qwen/Qwen2.5-Coder-7B-Instruct }
math: { type: mock, model: Qwen/Qwen3-4B-Instruct }
legal: { type: mock, model: Qwen/Qwen3-4B-Instruct }
medical: { type: mock, model: Qwen/Qwen3-4B-Instruct }
general: { type: mock, model: Qwen/Qwen3-1.7B-Instruct }
fallback:
type: mock # mock | apiOpenAI 兼容,如 DeepSeek
model: deepseek-chat
base_url: https://api.deepseek.com/v1
api_key_env: DEEPSEEK_API_KEY
judge:
type: rule # rule(零依赖)| llm
model: Qwen/Qwen3-1.7B-Instruct
cache:
enabled: true
semantic_enabled: true # 语义缓存(字符 n-gram 相似度,零依赖)
similarity_threshold: 0.88
promote_frequency: 5 # 命中 N 次后提升为精确缓存␍