Align Human 标志

Align Human

组织
agentscope-ai
align-human

Use when the user has a judge/grader and human-labeled data, and wants to measure how well the judge agrees with humans, detect systematic biases, determine whether automatic evaluation can replace human review, or build a human-reduction roadmap. Also use when the user mentions calibration, TPR/TNR, judge validation, inter-rater agreement, Cohen's kappa, bias detection, or "is my automatic evaluation trustworthy." Merges the calibrate and align functions into one skill.

概览

发布者agentscope-ai
代码仓库OpenJudge
技能名称align-human
星标数
871
复刻数
73
附带文件
1
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 agentscope-ai 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Align Human AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/agentscope-ai/OpenJudge/tree/main/skills/eval_pipeline/03-align-human
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/agentscope-ai/OpenJudge.git /tmp/OpenJudge
mkdir -p .claude/skills
cp -r /tmp/OpenJudge/skills/eval_pipeline/03-align-human .claude/skills/align-human
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Align Human,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Align Human。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Align Human 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Align Human

Measure whether your automatic judge agrees with human judgment, detect where and why they disagree, and build a roadmap to reduce human review over time.

When to Activate

  • You have a working judge/grader and 50+ human-labeled examples
  • You want to know if the judge is trustworthy enough to replace human review
  • You've noticed the judge's decisions being overturned by humans
  • You're preparing to deploy an evaluation as a production gate

Checklist

You MUST create a task for each item and complete them in order:

  1. Load paired data — match judge verdicts with human labels
  2. Measure TPR/TNR — confusion matrix + per-stratum breakdown
  3. Calculate agreement — Cohen's kappa, Gwet's AC1, systematic bias
  4. Run bias detection — 5 systematic bias checks
  5. Analyze disagreements — cluster patterns + diagnose root causes
  6. Build human-reduction roadmap — 4-phase transition plan
  7. Confirm and record — one confirmation, then write results

Fast path: run the bundled script

Don't hand-write the calibration statistics — that is exactly where subtle bugs hide. Run the bundled, tested script (scripts/calibration.py, standard library only, no OpenJudge dependency):

bash
python scripts/calibration.py --pairs pairs.jsonl                 # one paired file, OR
python scripts/calibration.py --verdicts verdicts.jsonl --labels labels.jsonl --stratum-key difficulty

Paired rows look like {"id","judge":"pass|fail","human":"pass|fail","stratum"?} (judge/human may also be 1/0). It prints the confusion matrix, TPR/TNR/F1 with bootstrap 95% CIs, Cohen's kappa, Gwet's AC1 (auto-flags the kappa paradox), directional bias, per-stratum TPR/TNR, and the calibration gate verdict (calibrated / not_calibrated / insufficient_evidence; exit code 0 only if calibrated). --json for machine output, --self-test to verify it.

Always report and interpret the actual numbers the script returns — TPR/TNR (with their 95% CIs), Cohen's kappa, Gwet's AC1, directional bias, per-stratum TPR/TNR, and the gate verdict — never just state that you ran it. If you don't yet have the paired verdicts/labels, say exactly what's missing (e.g. the judge verdicts file, or N more labels per class).

The Steps below explain what each number means and how to act on it — read them to interpret the script's output. The inline snippets are the reference behind the script; you normally just run the script rather than re-implementing it.

Step 1: Load and Pair Data

Human labels live in labels/<grader_name>.jsonl, one row per judged sample. Keep them separate from the dataset so they can be re-paired with any judge run:

python
{"id": "sample_017", "label": "pass",   # "pass"|"fail" (or 1/0); joins to a dataset row id
 "annotator": "alice", "rationale": "Order number matches context.",
 "timestamp": "2026-06-20T10:00:00Z", "schema_version": 1}

Match judge verdicts with human labels:

python
import json

# Load human labels and judge verdicts
labels = {item["id"]: item["label"] for item in json.load(open("labels.jsonl"))}
verdicts = json.load(open("runs/verdicts-dev.jsonl"))

# Pair them
paired = []
for v in verdicts:
    if v["id"] in labels:
        paired.append({
            "id": v["id"],
            "judge": v["verdict"],   # "pass" or "fail"
            "human": labels[v["id"]], # "pass" or "fail"
        })

print(f"Paired: {len(paired)}, Unmatched: {len(verdicts) - len(paired)}")

# Warn if severe class imbalance
pass_rate = sum(1 for p in paired if p["human"] == "pass") / len(paired)
if pass_rate > 0.8 or pass_rate < 0.2:
    print(f"WARNING: Human label pass rate is {pass_rate:.0%} — "
          "kappa may be paradoxically low. Use Gwet's AC1 as complement.")

Step 2: Measure TPR/TNR

Build a confusion matrix and compute per-stratum metrics:

python
from openjudge.analyzer.validation import (
    AccuracyAnalyzer, F1ScoreAnalyzer,
    FalsePositiveAnalyzer, FalseNegativeAnalyzer,
)

# Convert to OpenJudge-compatible dataset with labels
analysis_dataset = [
    {"query": p.get("query", ""), "response": p.get("response", ""),
     "label": 1 if p["human"] == "pass" else 0}
    for p in paired
]

# Binary grader results (1=pass, 0=fail)
grader_results = [
    GraderScore(name="judge", score=1.0 if p["judge"] == "pass" else 0.0, reason="")
    for p in paired
]

accuracy = AccuracyAnalyzer().analyze(analysis_dataset, grader_results, label_path="label")
f1 = F1ScoreAnalyzer().analyze(analysis_dataset, grader_results, label_path="label")
fpr = FalsePositiveAnalyzer().analyze(analysis_dataset, grader_results, label_path="label")
fnr = FalseNegativeAnalyzer().analyze(analysis_dataset, grader_results, label_path="label")

# TPR = 1 - FNR, TNR = 1 - FPR
tpr = 1 - fnr.false_negative_rate
tnr = 1 - fpr.false_positive_rate
print(f"TPR={tpr:.2f}, TNR={tnr:.2f}, F1={f1.f1_score:.2f}")

# Per-stratum breakdown if difficulty data exists
for stratum in ["easy", "boundary", "hard"]:
    stratum_data = [d for d in analysis_dataset
                    if d.get("metadata", {}).get("difficulty") == stratum]
    if len(stratum_data) >= 10:
        # Compute TPR/TNR per stratum
        ...

Why per-stratum matters: A judge with TPR=0.9 overall but TPR=0.5 on boundary cases is unreliable exactly where judgment matters most. This is the "progress illusion" (EMNLP 2025) — aggregate metrics hide stratum-level failure.

Bootstrap 95% CI

Use bootstrap resampling to quantify uncertainty:

python
import numpy as np

def bootstrap_ci(samples, metric_fn, n_iter=1000, ci=95):
    """Compute bootstrap confidence interval for a metric."""
    n = len(samples)
    values = []
    for _ in range(n_iter):
        idx = np.random.choice(n, n, replace=True)
        resampled = [samples[i] for i in idx]
        values.append(metric_fn(resampled))
    lower = np.percentile(values, (100 - ci) / 2)
    upper = np.percentile(values, 100 - (100 - ci) / 2)
    return np.mean(values), lower, upper

tpr_mean, tpr_low, tpr_high = bootstrap_ci(
    paired, lambda s: sum(1 for p in s if p["judge"] == "fail" and p["human"] == "fail")
                      / max(1, sum(1 for p in s if p["human"] == "fail"))
)

Step 3: Calculate Agreement

Cohen's Kappa (chance-corrected agreement)

kappa = (p_o - p_e) / (1 - p_e)
  • p_o: observed agreement rate
  • p_e: expected agreement by chance
  • = 0.8: substantial — judge is consistent with humans

  • 0.6-0.8: moderate — conditional trust, needs spot-checking
  • < 0.6: weak — cannot replace human judgment yet

Gwet's AC1 (robust to class imbalance)

When 90% of samples are "pass," kappa can be paradoxically low even with high agreement. Gwet's AC1 corrects for this. If kappa and AC1 differ by > 0.15, report both and note the class imbalance effect.

Systematic Bias

bias = P(judge=fail | human=pass) - P(judge=pass | human=fail)
  • bias > 0.1: judge is stricter than humans (over-flagging)
  • bias < -0.1: judge is more lenient than humans (under-flagging)
  • |bias| < 0.1: no significant directional bias

Step 4: Five Bias Detection Checks

CheckWhat to look forHow to measure
Position biasDoes response order affect pairwise judgment?Swap A/B order, compare win rates. Diff > 0.05 = bias
Verbosity biasDo longer responses score higher?Pearson r between score and response length.
Self-enhancementDoes the judge favor its own model family?Check if judge model family = target model family. Same family = risk
Progress illusionDoes aggregate TPR hide boundary failure?Compare overall TPR vs boundary TPR. Gap > 0.2 = illusion
Label driftHave system outputs changed since labeling?Compare historical vs current pass rate. Shift > 0.15 = drift

Step 5: Disagreement Pattern Analysis

For samples where judge and human disagree, cluster them to find root causes:

  1. Extract disagreement samples — where judge verdict != human label
  2. Classify each disagreement:
    • judge_prompt_ambiguous: pass/fail definitions not clear for this case
    • human_inconsistent: multiple human annotators disagreed on this sample
    • task_inherently_subjective: the dimension is fundamentally subjective
    • label_error: human label appears wrong, judge's reasoning is more convincing
    • judge_too_strict: judge applies criteria more harshly than humans intend
    • judge_too_lenient: judge overlooks issues humans catch

Present the top 3 patterns with 3 exemplars each so the user can decide whether to refine the judge prompt or accept the disagreement as inherent noise.

Step 6: Human-Reduction Roadmap

PhaseConditionHuman roleJudge roleTrigger to advance
1: Advisorykappa < 0.6100% human reviewJudge is reference onlykappa >= 0.6
2: Assistedkappa >= 0.6Spot-check 20% of judgmentsJudge is primary screenerkappa >= 0.8, boundary >= 0.6
3: Auto-gatekappa >= 0.8Review only borderline + low-confidenceJudge is production gatekappa >= 0.9, all strata >= 0.8
4: Autonomouskappa >= 0.9Quarterly auditJudge runs independentlyContinuous monitoring

Step 7: Confirmation and Output

Present the alignment dashboard:

Alignment Results for [grader_name]:

TPR: 0.91  TNR: 0.88  F1: 0.90
Kappa: 0.87  AC1: 0.89  Bias: +0.03 (none)
95% CI (accuracy): [0.84, 0.93]

Per-stratum:
  easy:      TPR=0.96  TNR=0.94
  boundary:  TPR=0.82  TNR=0.79  ← weakest, monitor
  hard:      TPR=0.85  TNR=0.83

Bias checks:
  ✓ position:   no bias detected
  ✓ verbosity:  r=0.12 (clean)
  ✓ self-enh:   judge model != target model
  ✓ progress:   boundary gap 0.09 (acceptable)
  ✓ label drift: KL=0.08 (stable)

Phase: 3 (Auto-gate) — judge is calibrated and aligned

Disagreement patterns:
  - 12 samples: judge slightly stricter on multi-step queries
    Root cause: judge_prompt_ambiguous
    Recommendation: add a multi-step borderline example to few-shot

Recommendation: [calibrated + aligned | needs refinement | not ready]

Common Mistakes

  • Using raw accuracy instead of TPR/TNR. A judge that calls everything "pass" gets 90% accuracy when 90% of samples pass, but catches zero failures. TPR and TNR decompose accuracy into what actually matters.
  • Trusting kappa without checking class balance. With 95% pass rate, kappa can be 0.4 even with 95% raw agreement. Always report Gwet's AC1 alongside kappa.
  • Skipping per-stratum analysis. Aggregate TPR of 0.9 with boundary TPR of 0.5 means the judge is unreliable exactly where you need it most.
  • Not setting a stop condition for iteration. Refining the judge prompt has diminishing returns. After 3 iterations with no kappa improvement > 0.03, stop and collect more labeled data instead.
  • Forgetting judge model != target model constraint. Self-evaluation inflates TPR by 3-8%. Always verify these are different models.

Next Skills

After 03-align-human:

  • 04-eval-report: Generate a comprehensive report with maturity assessment.
  • 02-metric-design: If you need to redesign graders based on bias findings.
  • 01-eval-design: If disagreement patterns reveal dataset coverage gaps.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Align Human AI 技能有什么作用?

Use when the user has a judge/grader and human-labeled data, and wants to measure how well the judge agrees with humans, detect systematic biases, determine whether automatic evaluation can replace human review, or build a human-reduction roadmap. Also use when the user mentions calibration, TPR/TNR, judge validation, inter-rater agreement, Cohen's kappa, bias detection, or "is my automatic evaluation trustworthy." Merges the calibrate and align functions into one skill.

为什么在 TypingMind 中使用 Align Human?

因为您只需安装一次,就能搭配任何模型使用。Align Human 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Align Human?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/agentscope-ai/OpenJudge/tree/main/skills/eval_pipeline/03-align-human。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Align Human?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Align Human 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Align Human 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Align Human AI 技能免费吗?

是的。agentscope-ai 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇