---
title: bert-base-chinese-topic-shift-detector
canonical_url: "https://www.modelscope.cn/models/Fu496735182/bert-base-chinese-topic-shift-detector"
md_url: "https://www.modelscope.cn/models/Fu496735182/bert-base-chinese-topic-shift-detector.md"
repository: Fu496735182/bert-base-chinese-topic-shift-detector
chinese_name: "基于BERT的中文话题转移检测"
last_updated: 2026-08-24
pipeline_tag: text-classification
tasks:
  - text-classification
parameters: 102.3M
tensor_type:
  - F32
library_name:
  - safetensors
downloads: 23
stars: 1
---

# bert-base-chinese-topic-shift-detector

> bert-base-chinese-topic-shift-detector - Fu496735182 在 ModelScope 开源的模型。基于BERT的中文多轮对话话题转移判定模型。通过结合历史对话与当前发言，判断用户是延续当前话题还是开启新话题。

- **Repository**: Fu496735182/bert-base-chinese-topic-shift-detector
- **Tasks**: text-classification
- **Parameters**: 102.3M
- **Downloads**: 23
- **Stars**: 1
- **Last updated**: 2026-08-24

Source: https://www.modelscope.cn/models/Fu496735182/bert-base-chinese-topic-shift-detector

---

# 基于BERT的中文话题转移检测

基于 BERT 的中文多轮对话场景切分/话题转移判定模型。通过结合历史对话与当前发言，判断用户是延续当前话题（CONTINUE）还是开启新意图/话题转移（SHIFT）。

输入数据应该为如下结构

```json
{
    "current_user_message":"帮我写一段Python代码实现排序",
    "history_user_messages":["hello","你好","你都会什么","Python语言会吗"],
    "work_item_id":"42f3d728...u4"
}
```

- `current_user_message`：当前用户消息
- `history_user_messages`：历史用户消息，训练时仅包含4条，因为BERT模型的输入有长度限制
- `work_item_id`：用户当前消息的id

模型输出为一个得分`score`，具体而言，被组装为如下格式

```json
{
  "current_user_message": "帮我写一段Python代码实现排序",
  "history_user_messages": ["hello","你好","你都会什么","Python语言会吗"],
  "work_item_id": "42f3d728...u4",
  "score": 0.9523,
  "threshold": 0.9,
  "predicted_label": "CONTINUE",
  "scene_summary": ""
}
```

需要设置一个判断阈值`threshold`以区分是延续当前话题还是转移了话题，如果大于则认为CONTINUE，小于认为SHIFT。范围0-1，在本模型中默认建议设置为0.9或更低（最好不小于0.8，根据本地模型的测试结果），模型对CONTINUE通常有较大的把握度，`score`如果小于这一较大的阈值，就证明对话发生了一定的场景切换。`scene_summary`未在本模型中实现。

关于模型原理，很简单分类模型基于BERT模型，具体而言基于`bert_base_chinese`在本地训练集上读取文本进行训练，并通过sigmoid输出0-1的的得分。

历史信息和当前信息拼接方式及模型打分流程如下

```python
[CLS] history_1 [SEP] history_2 [SEP] history_3 [SEP] current [SEP]
input→BERT→dropout→linear→sigmoid→score
```

可以在下载本项目后用如下代码测试模型效果

```python
python main.py
```
