Skip to content

对话树

标注层次化对话结构,支持节点评分和路径选择。

对话树

对话树标注方案支持标注层次化对话结构,例如聊天机器人回复树、对话系统或分支叙事。标注者可以对单个节点进行评分、选择首选路径以及比较决策点处的分支。

使用场景

  • 聊天机器人评估 - 对多个回复选项的质量进行评分
  • 对话系统 - 选择首选的对话路径
  • A/B 测试 - 比较不同的回复策略
  • 互动小说 - 评估分支故事路径

快速入门

yaml
annotation_schemes:
  - annotation_type: tree_annotation
    name: response_quality
    description: Evaluate the conversation tree
    node_scheme:
      annotation_type: likert
      min_label: "Poor"
      max_label: "Excellent"
      size: 5
    path_selection:
      enabled: true
      description: Select the best response path through the tree

配置选项

字段类型默认值描述
annotation_typestring必填必须为 "tree_annotation"
namestring必填此方案的唯一标识符
descriptionstring必填显示给标注者的说明
node_schemeobject{}逐节点标注的标注方案配置
path_selection.enabledbooleanfalse启用通过树的路径选择
path_selection.descriptionstring"Select the best response path"路径选择的说明
branch_comparison.enabledbooleanfalse启用分支比较模式

示例

节点评分

对对话树中的每个回复进行评分:

yaml
annotation_schemes:
  - annotation_type: tree_annotation
    name: response_rating
    description: Rate each response in the conversation
    node_scheme:
      annotation_type: likert
      min_label: "Very Bad"
      max_label: "Very Good"
      size: 5

路径选择

选择对话中的最佳路径:

yaml
annotation_schemes:
  - annotation_type: tree_annotation
    name: best_path
    description: Navigate the conversation tree
    path_selection:
      enabled: true
      description: Click on responses to build the best conversation path

多维度节点评分

从多个维度对节点进行评分:

yaml
annotation_schemes:
  - annotation_type: tree_annotation
    name: multi_criteria
    description: Evaluate each response on multiple criteria
    node_scheme:
      annotation_type: multirate
      options:
        - Relevance
        - Fluency
        - Helpfulness
      labels: ["1", "2", "3", "4", "5"]

分支比较模式

在决策点比较同级分支:

yaml
annotation_schemes:
  - annotation_type: tree_annotation
    name: branch_compare
    description: Compare response options at each decision point
    branch_comparison:
      enabled: true
    node_scheme:
      annotation_type: radio
      labels: ["Better", "Same", "Worse"]

数据格式

输入

树数据应以层次化结构的 JSON 格式提供:

json
{
  "id": "conv_001",
  "tree": {
    "id": "root",
    "role": "user",
    "content": "Hello, I need help with my order",
    "children": [
      {
        "id": "resp_a",
        "role": "assistant",
        "content": "I'd be happy to help! Can you provide your order number?",
        "children": [
          {
            "id": "user_2",
            "role": "user",
            "content": "It's ORDER-12345",
            "children": []
          }
        ]
      },
      {
        "id": "resp_b",
        "role": "assistant",
        "content": "Sure, what seems to be the problem?",
        "children": []
      }
    ]
  }
}

配置树数据键:

yaml
item_properties:
  id_key: id
  tree_key: tree

输出

树标注同时保存节点级和路径级数据:

json
{
  "response_quality": {
    "node_annotations": {
      "resp_a": {
        "rating": 4
      },
      "resp_b": {
        "rating": 2
      }
    },
    "selected_path": ["root", "resp_a", "user_2"]
  }
}

用户界面

树形可视化

对话树以节点表示消息/回复,边连接父子关系,分支点表示存在多个回复的位置。

节点选择

点击任何节点可查看完整消息内容、访问标注面板,以及将节点添加到选定路径(如果启用了路径选择)。

路径选择

启用路径选择时,点击节点将其添加到路径中。选定的路径会高亮显示,您可以使用"清除路径"重新开始。

最佳实践

  1. 保持节点方案简单 - 每个节点上复杂的标注界面会减慢标注速度
  2. 提供上下文 - 确保标注者在评分回复时能看到父消息
  3. 明智地使用路径选择 - 最适合较小的树
  4. 培训标注者 - 树形导航需要练习;提供培训示例

延伸阅读

有关实现细节,请参阅源文档