Qwen3-8B 电话分诊 LoRA (Telephone Triage LoRA)

基于 Qwen/Qwen3-8B 的 4-bit QLoRA 指令微调适配器,面向电话医疗分诊场景:给定患者来电主诉(自然语言,中文优先),模型输出分诊级别 + 疑似诊断/考虑 + 处置建议

用途

面向成人电话分诊(emergency triage)领域的专科助手,适用于:

  • 来电症状紧急程度分级(emergency / urgent / non-acute)
  • 疑似诊断提示与初步处置建议
  • 辅助分诊护士的决策支持

⚠️ 医疗免责声明:本模型仅用于研究与辅助参考,不构成医疗建议,不能替代专业医疗人员与急救判断。紧急情况请拨打当地急救电话(如 120/911)。

训练方法(知识蒸馏)

  1. 数据来源:一份成人电话分诊协议手册(PDF,481 页),解析其规范化的三栏表格结构,得到 887 条「症状→分级→处置建议」记录。
  2. 教师蒸馏:使用本地 vLLM 教师模型(minimax)将结构化症状记录改写为逼真的第一人称中文来电主诉,保留全部医学信息 —— 将领域知识转化为自然语言对话素材。
  3. SFT:unsloth + 4-bit QLoRA(r=16, α=16, use_rslora),842 训练 / 45 验证,5 epochs / 530 步,loss 3.88 → 0.156。
  4. 推理enable_thinking=False 直接输出分诊判断。

分级分布:emergency 236 / urgent 375 / non-acute 276。

加载与推理

from unsloth import FastLanguageModel
import torch

model, tokenizer = FastLanguageModel.from_pretrained("Qwen/Qwen3-8B", max_seq_length=2048, load_in_4bit=True)
model.load_adapter("chenhaodev/triage-qwen3-8b-lora")

def ask(complaint: str) -> str:
    text = tokenizer.apply_chat_template(
        [{"role": "user", "content": complaint}],
        tokenize=False, add_generation_prompt=True, enable_thinking=False,
    )
    enc = tokenizer(text, return_tensors="pt").to("cuda")
    with torch.inference_mode():
        out = model.generate(
            input_ids=enc.input_ids, attention_mask=enc.attention_mask,
            max_new_tokens=200, temperature=0.7, top_p=0.8, top_k=20,
        )
    return tokenizer.decode(out[0][enc.input_ids.shape[1]:], skip_special_tokens=True).replace("<|im_end|>", "").strip()

输出格式示例分诊级别:紧急。疑似诊断/考虑:...。处置建议:...

脚本

仓库内 scripts/ 包含完整流水线(均为原创代码,不含源书原文):

  • parse_protocols.py — 三栏表格协议解析
  • distill_all.py — 教师 API 蒸馏(症状 → 中文来电主诉)
  • prep_train.py / train_lora.py — SFT 数据准备与 unsloth LoRA 训练
  • build_rag.py / search_rag.py — 配套 FAISS 检索知识库

版权说明

  • LoRA 权重、训练脚本、本文档为原创/派生态产物。
  • 训练的语料衍生自版权文献,原始文本数据不随本仓库分发;如需复现请自行处理数据合规。

可能的后续增强

  • 导出 16-bit 权重部署 vLLM
  • 叠加 RAG 检索增强,构建「检索+生成」分诊助手
Downloads last month
19
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for chenhaodev/triage-qwen3-8b-lora

Finetuned
Qwen/Qwen3-8B
Adapter
(2134)
this model