---
title: bert_indus_intent_multitask
canonical_url: "https://www.modelscope.cn/models/leitzjzhe/bert_indus_intent_multitask"
md_url: "https://www.modelscope.cn/models/leitzjzhe/bert_indus_intent_multitask.md"
repository: leitzjzhe/bert_indus_intent_multitask
chinese_name: "工业问答多任务意图路由模型 (BERT 多标签)"
last_updated: 2026-10-27
license: apache-2.0
pipeline_tag: text-classification
tasks:
  - text-classification
model_type:
  - bert
architectures:
  - BertModel
base_model:
  - bert-base-chinese
base_model_relation: finetune
parameters: 102.3M
tensor_type:
  - F32
library_name:
  - safetensors
language:
  - zh
downloads: 6
stars: 1
tags:
  - text-classification
  - intent-detection
  - multi-task
  - multi-label
  - industrial-qa
  - retrieval-routing
---

# bert_indus_intent_multitask

> bert_indus_intent_multitask - leitzjzhe 在 ModelScope 开源的模型。基于 bert-base-chinese 的多任务意图路由模型：共享编码器 + 双分类头，gate 头判定专业/通用、source 头多标签判定使用/维修手册，用于工业问答系统的检索路由。

leitzjzhe/bert_indus_intent_multitask 是 ModelScope 魔搭社区上的 102.3M 参数text-classification模型，采用 apache-2.0 许可，基于 bert-base-chinese 构建。

- **Repository**: leitzjzhe/bert_indus_intent_multitask
- **License**: apache-2.0
- **Tasks**: text-classification
- **Parameters**: 102.3M
- **Base model**: bert-base-chinese
- **Tags**: text-classification, intent-detection, multi-task, multi-label, industrial-qa, retrieval-routing
- **Downloads**: 6
- **Stars**: 1
- **Last updated**: 2026-10-27

Source: https://www.modelscope.cn/models/leitzjzhe/bert_indus_intent_multitask

---

# 工业问答多任务意图路由模型 (BERT 多标签)

`bert_indus_intent_multitask` —— 用于工业设备问答系统（IndusQA）的**意图路由模型**。
它不直接回答问题，而是判断"这个问题该怎么走"：是专业问题还是通用问题、该去使用手册还是维修手册检索。

## 模型结构

共享一个 `bert-base-chinese` 编码器，接两个独立分类头（多任务学习）：

- **gate 头（二分类, softmax + 交叉熵）**：`通用` / `专业`
  决定是否进入专业检索链路。
- **source 头（多标签, sigmoid + BCE）**：`使用手册` / `维修手册`
  仅对"专业"样本生效（"通用"样本该头被 mask 掉），可单选也可双选。

| 维度 | 取值 |
|---|---|
| gate_labels | `通用`, `专业` |
| source_labels | `使用手册`, `维修手册` |
| max_len | 64 |
| hidden_size | 768 |

## ⚠️ 重要：这是自定义结构，非标准 HF pipeline

主干权重在 `model.safetensors`，但**两个分类头单独保存在 `multitask_heads.pt`**，
`config.json` 的 `architectures` 是 `BertModel`（不含分类头）。
因此**不能**用 `AutoModelForSequenceClassification.from_pretrained()` 直接加载，
必须配合本仓库提供的 `intent_model.py` 中的 `IntentModelManager` 类来重建结构。

## 文件清单

```
config.json          BertModel 主干配置
model.safetensors    共享 BERT 编码器权重 (~409MB)
multitask_heads.pt   gate 头 + source 头权重 (自定义结构)
multitask_meta.json  标签表与 max_len
tokenizer.json / tokenizer_config.json / vocab.txt
intent_model.py      加载与推理代码 (IntentModelManager) —— 必须一起使用
```

## 使用方法

```python
from intent_model import IntentModelManager

mgr = IntentModelManager.load("./")   # 传入本模型目录
texts = [
    "PLC 1200 程序怎么修改？",          # 专业 / 使用手册
    "E015 报警 主轴转速不稳定 怎么处理？",  # 专业 / 维修手册
    "今天天气怎么样？",                  # 通用
]
out = mgr.predict_batch(texts, gate_tau=0.5, source_tau=0.5)
# out[i] = {is_professional, p_pro, sources, source_p}
```

路由决策（参考 `intent_router.py`）：
非专业 → 走通用问答；专业且 top 概率 ≥ source_tau 且与次高差 ≥ margin → 单一手册；
否则 → 全库双检索。

## 评估结论（独立测试集, 94 条含疑问/陈述孪生对）

- gate（专业/通用）在独立测试集上明显高于"问号基线"(54.3%)，说明已学到语义而非标点捷径；
- 疑问↔陈述孪生稳定性约 90%；
- **已知局限**：source 头为 single-hot 关键词训练，真正"双命中"的 query 会坍缩到维修手册，
  both_recall≈0%。需要 both-hot 真实数据重训才能改善。

## License

Apache License 2.0（与底层 bert-base-chinese 一致）。
