簡介
BLEU、ROUGE 衡量「表面」——但人工智慧品質最終必須由人類或更聰明的人工智慧來判斷。這是最強的兩種方法。
1. 法學碩士法官
1.1 逐點評分
JUDGE_PROMPT = """Evaluate the response on a scale of 1-5:
**Task:** {task}
**Response:** {response}
Criteria:
- Accuracy (1-5): Thông tin chính xác không?
- Completeness (1-5): Trả lời đầy đủ không?
- Format (1-5): Đúng format yêu cầu không?
- Tone (1-5): Giọng điệu phù hợp không?
Output JSON: {"accuracy": X, "completeness": X, "format": X, "tone": X, "overall": X, "reasoning": "..."}
"""
1.2 兩兩比較
PAIRWISE_PROMPT = """Compare Response A vs Response B:
Task: {task}
Response A: {response_a}
Response B: {response_b}
Which is better? Output: {"winner": "A" or "B" or "tie", "reasoning": "..."}
"""
2. 手動評估
黃金測試集
golden_tests = [
{
"input": "Triệu chứng COVID-19?",
"expected_elements": ["sốt", "ho", "mệt mỏi", "mất vị giác"],
"expected_format": "bullet list",
"rubric": "Phải mention ít nhất 3/4 triệu chứng chính"
},
# 50+ test cases
]
註釋者間協議
from sklearn.metrics import cohen_kappa_score
kappa = cohen_kappa_score(annotator_1_scores, annotator_2_scores)
# kappa > 0.6 = acceptable agreement
總結
- 法學碩士擔任法官:快速、可擴展、與人類有良好的相關性
- 成對比較:強於逐點評分
- 人工評估:黃金標準,但昂貴且緩慢
- 黃金測試集:50 多個針對您的領域精心策劃的範例
- 結合 LLM-Judge + 人體抽樣 = 最佳實踐
練習
- 為您的領域設計評判提示(5 個評分標準)
- 運行成對比較:基礎與微調(20 個範例)
- 建立包含 30 多個範例的黃金測試集
- 衡量註釋者間的一致性(邀請2位審查者)