> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/documentation/zh/qa/quality-gate.md).

# Quality Gate 质量关卡

Quality Gate 质量关卡：在 Unitlab 工作流中将标注员提交的标注与隐藏的标准答案（基准、Gold 标签）自动比对评分，按阈值分为 Pass、Fail、Not evaluated 三种结果路由条目，并说明如何创建和批准标准答案、查看比对结果与排查问题。

**Quality Gate** 会将标注员的标注与可信的**标准答案**（也称基准或 Gold 标签）进行比对。标准答案对标注员隐藏。如果得分达到你设定的阈值，条目即通过。

## 三种结果 <a href="#the-three-outcomes" id="the-three-outcomes"></a>

| 结果                | 含义                  | 常见路线              |
| ----------------- | ------------------- | ----------------- |
| **Pass**          | 条目有标准答案，且得分达到阈值。    | Review 或 Complete |
| **Fail**          | 得分低于阈值。             | 退回 Annotate       |
| **Not evaluated** | 条目没有已批准的标准答案，或无法比对。 | Review            |

{% hint style="warning" %}
**Not evaluated** 不等于通过。大多数条目没有标准答案，请将它们路由给审核员。
{% endhint %}

## 创建标准答案 <a href="#create-answer-keys" id="create-answer-keys"></a>

{% stepper %}
{% step %}

### 选择基准条目

在项目的 **Datasets** 页面中，选择几个典型和困难的条目，然后选择 **Set as benchmark**。也可以在 **QA** > **Benchmarks** 标签页中选择 **Set as benchmark**。

条目最新保存的标注会被复制为一份隐藏的标准答案。
{% endstep %}

{% step %}

### 检查并修正标准答案

在 **QA** > **Benchmarks** 中打开每份标准答案，修正所有错误，使其准确体现一名完美标注员的标注结果。
{% endstep %}

{% step %}

### 批准标准答案

在编辑器中选择 **Set as benchmark**。只有已批准的标准答案会用于评分。如果之后编辑了标准答案，按钮会显示为 **Update benchmark**：选择它即可启用新版本。
{% endstep %}
{% endstepper %}

![Benchmarks 标签页列出已启用的标准答案和尚需标准答案的条目](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGjVLUz4wthGkGlRKM6rM%2Fuploads%2Frxh68Kv1WOPLXNFTVd73%2Fqa-benchmarks-overview.webp?alt=media\&token=ed7acc1b-6402-4897-b22f-34944925c5af)

## 添加 Quality Gate 阶段 <a href="#add-the-quality-gate-stage" id="add-the-quality-gate-stage"></a>

1. 在 **Workflows** 中，将 **Quality Gate** 添加到需要检查的阶段（通常是 **Annotate**）之后。
2. 选择该阶段并设置通过阈值。
3. 连接 **Pass**、**Fail** 和 **Not evaluated**。
4. 选择 **Save and Apply**。

![带有阈值设置的 Quality Gate 阶段设置面板](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGjVLUz4wthGkGlRKM6rM%2Fuploads%2Fc9npHqYMS1RpOjz9klnU%2Fqa-quality-gate-settings.webp?alt=media\&token=7e94bcc2-64d8-4d3a-af47-5d2538f8f11b)

条目进入该阶段时，关卡会自动评分，不分配任何人员。

## 查看结果 <a href="#look-at-a-result" id="look-at-a-result"></a>

在 **QA** > **Benchmarks** 中展开一个条目，查看每次提交的得分。打开比对视图，可并排查看标准答案与提交结果。

![在视频帧上并排对比标准答案与提交结果，下方显示时间轴](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGjVLUz4wthGkGlRKM6rM%2Fuploads%2FTPSuPMIO0r9EanT50OmO%2Fqa-benchmark-comparison.webp?alt=media\&token=f985046c-7e57-452f-8ba4-2c85751edcfa)

检查错误的类别、遗漏或多余的对象、不紧贴的边界以及错误的属性。得分告诉你工作有多接近；比对视图告诉你需要修正什么。

对于 Data Group，标准答案覆盖整个分组。

## 建议 <a href="#tips" id="tips"></a>

* 选择的基准应包含困难案例，而不只是简单案例。
* 条目未通过时，也要检查标准答案，有时是标准答案本身有误。
* 先用几份好的和几份差的提交进行评分，再确定阈值。

## 问题排查 <a href="#troubleshooting" id="troubleshooting"></a>

| 问题                     | 处理方法                           |
| ---------------------- | ------------------------------ |
| **Needs answer key**   | 打开标准答案，完成并批准它。                 |
| 关卡显示 **Not evaluated** | 确认条目有已批准的标准答案，并且分组中所有必填面板都已标注。 |
| 看起来不错的条目未通过            | 打开比对视图，先检查类别和属性，再检查阈值。         |

## 相关内容 <a href="#related" id="related"></a>

[共识（Consensus）](https://docs.unitlab.ai/documentation/zh/qa/consensus.md) · [审核阶段](https://docs.unitlab.ai/documentation/zh/qa/review-stages.md) · [质量工作流](https://docs.unitlab.ai/documentation/zh/qa/qa-workflows.md)
