評估 AI 智慧體:智慧體 Trace 人類標註完整指南
學習如何使用 Potato 的智慧體標註功能設定 AI 智慧體輸出的人類評估,從 trace 匯入到標註方案設計。
自動化指標告訴你智慧體多久成功一次。人類評估告訴你它為什麼失敗、在哪裡出錯以及如何修復。本指南將引導你使用 Potato 的智慧體標註功能設定完整的 AI 智慧體人類評估流程。
From raw traces to structured judgments
我們將評估一個通過搜尋網路回答問題的 ReAct 風格智慧體。在本指南結束時,你將能夠:
- 將智慧體 trace 匯入 Potato
- 配置智慧體 trace 顯示
- 設定整體和逐步標註方案
- 執行標註任務
- 匯出結構化評估結果
前提條件
安裝 Potato 2.3.0 或更高版本:
pip install --upgrade potato-annotation你還需要待評估的智慧體 trace。本指南使用 ReAct trace,但同樣的方法適用於 12 種支援格式中的任何一種。
第 1 步:準備智慧體 Trace
ReAct trace 是 Thought、Action 和 Observation 步驟的序列。以下是一個最簡示例。建立檔案 data/traces.jsonl:
{
"trace_id": "trace_001",
"task": "What is the capital of Australia and what is its population?",
"trace": [
{"type": "thought", "content": "I need to find the capital of Australia and its population. Let me search for this."},
{"type": "action", "content": "search", "action_input": "capital of Australia"},
{"type": "observation", "content": "Canberra is the capital city of Australia. It was chosen as the capital in 1908 as a compromise between Sydney and Melbourne."},
{"type": "thought", "content": "The capital is Canberra. Now I need to find its population."},
{"type": "action", "content": "search", "action_input": "Canberra population 2025"},
{"type": "observation", "content": "Canberra has a population of approximately 467,000 as of 2025, making it the eighth-largest city in Australia."},
{"type": "thought", "content": "I now have both pieces of information. The capital of Australia is Canberra with a population of approximately 467,000."},
{"type": "action", "content": "finish", "action_input": "The capital of Australia is Canberra, with a population of approximately 467,000 as of 2025."}
],
"ground_truth": "Canberra, approximately 467,000"
}JSONL 檔案中的每一行是一個完整的智慧體 trace。trace 欄位包含逐步日誌。task 欄位是智慧體被要求完成的任務。
Trace 格式說明
對於 OpenAI 函式呼叫 trace,格式有所不同:
{
"trace_id": "oai_001",
"task": "Find cheap flights from NYC to London",
"messages": [
{"role": "user", "content": "Find cheap flights from NYC to London"},
{"role": "assistant", "content": null, "tool_calls": [{"function": {"name": "search_flights", "arguments": "{\"from\": \"NYC\", \"to\": \"LHR\"}"}}]},
{"role": "tool", "name": "search_flights", "content": "{\"flights\": [{\"airline\": \"BA\", \"price\": 450}, {\"airline\": \"AA\", \"price\": 520}]}"},
{"role": "assistant", "content": "I found flights from NYC to London. The cheapest is British Airways at $450."}
]
}Potato 的轉換器處理這些差異。你只需指定正確的轉換器名稱。
第 2 步:建立項目配置
建立 config.yaml:
annotation_task_name: "ReAct Agent Evaluation"
task_dir: "."
data_files:
- "data/traces.jsonl"
item_properties:
id_key: trace_id
text_key: task
# --- Agentic annotation settings ---
agentic:
enabled: true
trace_converter: react
display_type: agent_trace
agent_trace_display:
colors:
thought: "#6E56CF"
action: "#3b82f6"
observation: "#22c55e"
error: "#ef4444"
collapse_observations: true
collapse_threshold: 400
show_step_numbers: true
show_timestamps: false
render_json: true
syntax_highlight: true這告訴 Potato:
- 從
data/traces.jsonl載入 trace - 使用 ReAct 轉換器解析
trace欄位 - 使用帶顏色編碼步驟卡片的 agent trace 顯示來展示 trace
第 3 步:設計標註方案
智慧體評估通常需要 trace 級別 的判斷(智慧體是否成功?)和 步驟級別 的判斷(每個步驟是否正確?)。讓我們同時新增兩者。
將以下內容新增到 config.yaml:
annotation_schemes:
# --- Trace-level schemas ---
# 1. Task success (the most important metric)
- annotation_type: radio
name: task_success
description: "Did the agent successfully complete the task?"
labels:
- "Success"
- "Partial Success"
- "Failure"
label_requirement:
required: true
sequential_key_binding: true
# 2. Answer correctness (if the task has a ground truth)
- annotation_type: radio
name: answer_correctness
description: "Is the agent's final answer factually correct?"
labels:
- "Correct"
- "Partially Correct"
- "Incorrect"
- "Cannot Determine"
label_requirement:
required: true
# 3. Efficiency rating
- annotation_type: likert
name: efficiency
description: "Did the agent use an efficient path to the answer?"
labels:
1: "Very Inefficient (many unnecessary steps)"
3: "Average"
5: "Optimal (no wasted steps)"
# 4. Free-text notes
- annotation_type: text
name: evaluator_notes
description: "Any additional observations"
label_requirement:
required: false
# --- Step-level schemas ---
# 5. Per-step correctness
- annotation_type: trajectory_eval
name: step_correctness
steps_key: agentic_steps
description: "Was this step correct and useful?"
correctness_options:
- "Correct"
- "Partially Correct"
- "Incorrect"
- "Unnecessary"
# 6. Per-step error type (only shown when step is not correct)
- annotation_type: trajectory_eval
name: error_type
steps_key: agentic_steps
description: "What type of error occurred?"
correctness_options:
- "Wrong tool/action"
- "Wrong arguments"
- "Hallucinated information"
- "Reasoning error"
- "Redundant step"
- "Premature termination"
- "Other"這個方案設計為你提供:
- 用於高階分析的二元成功/失敗指標
- 用於評估最終答案的正確性評分
- 用於比較智慧體策略的效率分數
- 逐步評分,精確識別智慧體在哪裡出錯
- 僅在某步驟有問題時才出現的條件性錯誤分類
第 4 步:配置輸出並啟動伺服器
將輸出設定新增到 config.yaml:
output_annotation_dir: "output/"
export_annotation_format: "jsonl"
# Optional: also export to Parquet for analysis
parquet_export:
enabled: true
output_dir: "output/parquet/"
compression: zstd完整的 config.yaml 供參考:
annotation_task_name: "ReAct Agent Evaluation"
task_dir: "."
data_files:
- "data/traces.jsonl"
item_properties:
id_key: trace_id
text_key: task
agentic:
enabled: true
trace_converter: react
display_type: agent_trace
agent_trace_display:
colors:
thought: "#6E56CF"
action: "#3b82f6"
observation: "#22c55e"
error: "#ef4444"
collapse_observations: true
collapse_threshold: 400
show_step_numbers: true
render_json: true
syntax_highlight: true
annotation_schemes:
- annotation_type: radio
name: task_success
description: "Did the agent successfully complete the task?"
labels: ["Success", "Partial Success", "Failure"]
label_requirement:
required: true
sequential_key_binding: true
- annotation_type: radio
name: answer_correctness
description: "Is the agent's final answer factually correct?"
labels: ["Correct", "Partially Correct", "Incorrect", "Cannot Determine"]
label_requirement:
required: true
- annotation_type: likert
name: efficiency
description: "Did the agent use an efficient path?"
labels:
1: "Very Inefficient"
3: "Average"
5: "Optimal"
- annotation_type: text
name: evaluator_notes
description: "Any additional observations"
label_requirement:
required: false
- annotation_type: trajectory_eval
name: step_correctness
steps_key: agentic_steps
description: "Was this step correct?"
correctness_options: ["Correct", "Partially Correct", "Incorrect", "Unnecessary"]
- annotation_type: trajectory_eval
name: error_type
steps_key: agentic_steps
description: "Error type"
correctness_options:
- "Wrong tool/action"
- "Wrong arguments"
- "Hallucinated information"
- "Reasoning error"
- "Redundant step"
- "Premature termination"
- "Other"
output_annotation_dir: "output/"
export_annotation_format: "jsonl"
parquet_export:
enabled: true
output_dir: "output/parquet/"
compression: zstd啟動伺服器:
potato start config.yaml -p 8000在瀏覽器中開啟 http://localhost:8000。
第 5 步:標註工作流
當標註人員開啟一個 trace 時,他們會看到:
- 頂部的 任務描述(原始使用者查詢)
- 步驟卡片 顯示完整的智慧體 trace,按類型顏色編碼:
- 紫色卡片表示思考/推理
- 藍色卡片表示操作/工具呼叫
- 綠色卡片表示觀測/結果
- 紅色卡片表示錯誤
- 每個步驟卡片旁邊的 逐步評分控制元件
- trace 顯示下方的 trace 級別標註方案
典型工作流:
- 閱讀任務描述以理解智慧體應該做什麼
- 逐步瀏覽 trace,對每個步驟進行評分
- 對於評為"部分正確"或"不正確"的步驟,選擇錯誤類型
- 對整體 trace 進行評分(成功、正確性、效率)
- 如需要新增備註
- 提交併進入下一個 trace
標註人員提示
- 展開摺疊的觀測結果 以驗證智慧體是否正確處理了資訊
- 將最終答案與標準答案對比(如果有的話),然後再評定任務成功
- 將"不必要"的步驟 與"不正確"的步驟分開評分——不必要的步驟浪費精力但不會引入錯誤
- 使用步驟時間線 側邊欄跳轉到長 trace 中的特定步驟
第 6 步:分析結果
標註完成後,可以程式化地分析結果。
使用 pandas 進行基礎分析
import pandas as pd
import json
# Load annotations
annotations = []
with open("output/annotations.jsonl") as f:
for line in f:
annotations.append(json.loads(line))
df = pd.DataFrame(annotations)
# Task success rate
success_counts = df.groupby("annotations").apply(
lambda x: x.iloc[0]["annotations"]["task_success"]
).value_counts()
print("Task Success Distribution:")
print(success_counts)
# Average efficiency rating
efficiency_scores = [
a["annotations"]["efficiency"]
for a in annotations
if "efficiency" in a["annotations"]
]
print(f"\nAverage Efficiency: {sum(efficiency_scores) / len(efficiency_scores):.2f}")步驟級錯誤分析
# Collect all step-level errors
error_counts = {}
for ann in annotations:
step_errors = ann["annotations"].get("error_type", {})
for step_idx, errors in step_errors.items():
for error in errors:
error_counts[error] = error_counts.get(error, 0) + 1
print("Error Type Distribution:")
for error, count in sorted(error_counts.items(), key=lambda x: -x[1]):
print(f" {error}: {count}")使用 DuckDB 分析(通過 Parquet)
import duckdb
# Overall success rate
result = duckdb.sql("""
SELECT value, COUNT(*) as count
FROM 'output/parquet/annotations.parquet'
WHERE schema_name = 'task_success'
GROUP BY value
ORDER BY count DESC
""")
print(result)第 7 步:擴大規模
對於較大的評估項目(數百或數千個 trace),考慮以下配置:
多標註者
為每個 trace 分配多個標註者以計算標註者間一致性:
annotation_task_config:
total_annotations_per_instance: 3
assignment_strategy: random使用預置方案
快速設定時,使用 Potato 的預置智慧體評估方案:
annotation_schemes:
- preset: agent_task_success
- preset: agent_step_correctness
- preset: agent_error_taxonomy
- preset: agent_efficiency品質控制
啟用金標準實例進行品質監控:
phases:
training:
enabled: true
data_file: "data/training_traces.jsonl"
passing_criteria:
min_correct: 4
total_questions: 5適配其他智慧體類型
OpenAI 函式呼叫
agentic:
enabled: true
trace_converter: openai
display_type: agent_traceAnthropic 工具使用
agentic:
enabled: true
trace_converter: anthropic
display_type: agent_trace多智慧體系統(CrewAI/AutoGen)
agentic:
enabled: true
trace_converter: multi_agent
display_type: agent_trace
multi_agent:
agent_converters:
researcher: react
writer: anthropic
reviewer: openai網頁瀏覽智慧體
對於網頁智慧體,切換到 web agent 顯示:
agentic:
enabled: true
trace_converter: webarena
display_type: web_agent
web_agent_display:
screenshot_max_width: 900
overlay:
enabled: true
filmstrip:
enabled: true詳見標註網頁瀏覽智慧體的專門指南。
總結
AI 智慧體的人類評估需要專門的工具。Potato 的智慧體標註系統提供:
- 12 種轉換器 標準化來自任何框架的 trace
- 3 種顯示類型 分別針對工具使用、網頁瀏覽和對話智慧體最佳化
- 逐步評分 用於步驟級評估
- 9 個預置方案 覆蓋常見評估維度
- Parquet 匯出 用於高效的下游分析
關鍵洞察在於,智慧體評估不僅僅是"智慧體是否得到了正確答案?"——而是"智慧體在每個步驟中是否進行了正確推理?"逐步標註揭示了聚合指標遺漏的錯誤模式。
延伸閱讀
- 智慧體標註文件
- 標註網頁瀏覽智慧體
- Solo Mode -- 將智慧體標註與人機協同評估相結合
- Best-Worst Scaling -- 對智慧體輸出進行比較排名
- Parquet 匯出 -- 高效的分析匯出