Community编程与开发github.com

高级评估

该技能用于高级 LLM 评估:LLM 作为评委系统、直接评分、成对比较、评分标准校准、评估者偏见缓解、置信度评分以及自动化质量评估。

高级评估 是什么?

此高级评估技能为开发者提供了构建生产级 LLM 评估系统的综合方法论。它超越了简单的质量检查,深入研究了 LLM 作为评委的多种技术,包括直接评分(适用于有客观标准的任务,如事实准确性)和成对比较(适用于主观偏好判断,如语气和风格)。该技能详细阐述了评估系统中的系统性偏见(如位置偏差、长度偏差),并提供了实用的缓解策略,例如成对评估中的位置交换和基于证据的评分提示。此外,它还涵盖了评分标准生成、置信度校准以及评估指标选择框架,帮助开发者根据任务类型(如二分类、序数评分)选择合适的评估方法。此技能适用于 Claude Code、Cursor 和 Codex 等平台,核心是从其全面的 SKILL.md 文档中提炼出的可操作模式,旨在创建可靠、可审计且与人判断高度相关的自动化评估流水线。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/tree/main/skills/advanced-evaluation

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

高级评估 是做什么的?

本技能涵盖使用 LLM 作为评委来评估 LLM 输出的生产级技术。它综合了学术论文、行业实践和实际实施经验中的研究成果,形成了构建可靠评估系统的可操作模式。

关键洞察:LLM 作为评委并非单一技术,而是一系列方法的集合,每种方法适用于不同的评估场景。选择正确的方法并缓解已知偏见是本技能培养的核心能力。

何时激活

在以下情况下激活此技能:

  • 为 LLM 输出构建 LLM 作为评委系统
  • 比较多个模型响应以选择最佳结果
  • 在评估团队中建立一致的质量标准
  • 调试显示结果不一致的评估系统
  • 为提示或模型更改设计 A/B 测试
  • 专门为 LLM 或人/LLM 混合评委创建评分标准
  • 分析自动化评估与人工评估之间的相关性

对于属于其他技能范畴的相邻工作,请勿激活此技能:

  • 通用确定性检查、回归套件、生产质量门禁或结果指标:evaluation。
  • 自主循环治理、锁定评分标准、回滚或 PR 审批边界:harness-engineering。
  • 评估工具的工具 API 合约:tool-design。

核心概念

评估分类法

根据是否存在真实的标准,在两种主要方法之间进行选择:

直接评分 —— 当存在客观标准(事实准确性、指令遵循、毒性)时使用。单个 LLM 按照定义的标尺对一条响应进行评分。对于定义明确的标准,可实现中等至高的可靠性。注意评分校准漂移和标尺解释不一致的问题。

成对比较 —— 用于主观偏好(语气、风格、说服力)。LLM 比较两个响应并选择较好的一个。对于主观任务,成对方法通常比开放式直接评分与人类偏好的相关性更好(claim-advanced-evaluation-position-swap)。注意位置偏差和长度偏差。

偏见全景图

在每个评估系统中缓解这些系统性偏见:

位置偏差:处于第一位置的响应会得到优待。通过交换位置评估两次来缓解,然后应用多数投票或一致性检查。

长度偏差:较长的响应无论质量如何都会得到更高分数。通过明确提示忽略长度并应用长度归一化评分来缓解。

自我增强偏差:模型倾向于对自己生成的输出评分更高。通过使用不同的模型进行生成和评估来缓解。

冗长偏差:即使不必要,过多的细节也会得到更高分数。通过使用惩罚无关细节的特定于标准的评分标准来缓解。

权威偏差:自信的语气无论准确性如何都会得到更高分数。通过要求提供证据引用并添加事实核查层来缓解。

指标选择框架

将指标与评估任务结构相匹配:

任务类型主要指标次要指标
二分类(通过/失败)召回率、精确率、F1Cohen's kappa
序数标尺(1-5 评分)Spearman's rho, Kendall's tauCohen's kappa (加权)
成对偏好一致率、位置一致性置信度校准
多标签Macro-F1, Micro-F1各标签精确率/召回率

优先关注系统性分歧模式而非绝对一致率,因为一个在特定标准上与人类持续存在分歧的评委,比一个带有随机噪声的评委问题更大。

评估方法

直接评分实现

使用三个组件构建直接评分:清晰的标准、校准的标尺和结构化的输出格式。

标准定义模式:

标准: [名称]
描述: [此标准衡量的内容]
权重: [相对重要性,0-1]

标尺校准 —— 根据评分标准细节选择标尺粒度:

  • 1-3:带有中性选项的二元标准,认知负荷最低
  • 1-5:标准李克特量表,粒度和可靠性的最佳平衡
  • 1-10:仅在有详细的分级评分标准时使用,因为校准更难

直接评分的提示结构:

您是一位评估响应质量的专家评估者。

## 任务
根据每个标准评估以下响应。

## 原始提示
{prompt}

## 待评估响应
{response}

## 标准
{对于每个标准:名称、描述、权重}

## 说明
对于每个标准:
1. 在响应中找到具体证据
2. 根据评分标准评分(1-{max} 标尺)
3. 用证据证明你的评分
4. 提出一项具体的改进建议

## 输出格式
以结构化 JSON 响应,包含分数、理由和摘要。

在评分提示中要求评分前提供证据,以便评委在给出数字之前,将其决策锚定在可观察到的输出特征上。

成对比较实现

在每次成对评估中应用位置偏差缓解:

  1. 首先运行确定性预检查:两个候选者必须满足相同的模式、源证据要求和范围约束。
  2. 第一轮评委评估:响应 A 处于第一位置,响应 B 处于第二位置。
  3. 第二轮评委评估:响应 B 处于第一位置,响应 A 处于第二位置。
  4. 一致性检查:如果两轮结果不一致,则返回“平局”且置信度降低。
  5. 最终裁决:一致的获胜者,附带平均置信度和明确的平局打破理由。

成对比较的提示结构:

您是一位比较两个 AI 响应的专家评估者。

## 关键说明
- 不要因为响应更长而偏爱它们
- 不要根据位置(第一个 vs 第二个)偏爱响应
- 仅根据指定标准关注质量
- 当两个响应确实等价时,平局是可以接受的

## 原始提示
{prompt}

## 响应 A
{response_a}

## 响应 B
{response_b}

## 比较标准
{标准列表}

## 说明
1. 首先独立分析每个响应
2. 在每项标准上比较它们
3. 确定最终获胜者及置信水平

## 输出格式
JSON,包含每项标准的比较、最终获胜者、置信度(0-1)和推理过程。

置信度校准 —— 将置信度映射到位置一致性:

  • 两轮评估一致:置信度 = 两个单独置信度的平均值
  • 两轮评估不一致:置信度 = 0.5,判定 = 平局

评分标准生成

生成评分标准以降低与开放式评分相比的评估方差。将确切的方差降低视为特定于工作负载,除非在目标评估集上进行了测量。

包含以下评分标准组件:

  1. 等级描述:每个分数等级的清晰边界
  2. 特征:定义每个等级的可观察特征
  3. 示例:每个等级的代表性文本(可选但很有价值)
  4. 边缘案例:针对模糊情况的指导
  5. 评分指南:用于一致应用的一般原则

根据用例设置严格度校准:

  • 宽松:较低的通过门槛,适合鼓励迭代
  • 平衡:典型的生产环境预期
  • 严格:对于安全关键或高风险评估的高标准

根据领域调整评分标准——使用领域特定的术语。代码可读性评分标准会提到变量、函数和注释。医学准确性评分标准会引用临床术语和证据标准。

实用指南

评估流水线设计

使用以下层级构建生产评估系统:标准加载器(评分标准 + 权重)-> 主要评分器(直接或成对)-> 偏见缓解(位置交换等)-> 置信度评分(校准)-> 输出(分数 + 理由 + 置信度)。有关完整视觉布局,请参阅评估流水线图。

决策框架:直接 vs. 成对

应用此决策树:

是否存在客观真实标准?
+-- 是 -> 直接评分
|   示例:事实准确性、指令遵循、格式合规性
|
+-- 否 -> 是偏好或质量判断吗?
    +-- 是 -> 成对比较
    |   示例:语气、风格、说服力、创造力
    |
    +-- 否 -> 考虑基于参考的评估
        示例:摘要(与源比较)、翻译(与参考比较)

扩展评估

对于高容量评估,应用以下策略之一:

  1. LLM 委员会 (PoLL):使用多个模型作为评委并聚合投票,以减少单个模型偏见。对于高风险决策更昂贵但更可靠。

  2. 分层评估:使用快速廉价的模型进行筛选,使用昂贵的模型处理边缘案例。需要校准筛选阈值。

  3. 人在环中:自动化明确案例,并将低置信度决策路由到人工审查。设计反馈循环以随着时间的推移改进自动化评估。

示例

示例 1:准确性的直接评分

输入:

提示:“地球上的季节是什么原因造成的?”
响应:“季节是由地球倾斜的轴引起的。当地球绕太阳运行时,
不同的半球在一年中的不同时间接收到更直接的阳光。”
标准:事实准确性(权重:1.0)
标尺:1-5

输出:

{
  "criterion": "事实准确性",
  "score": 5,
  "evidence": [
    "正确识别地轴倾斜为主要原因",
    "正确解释了不同半球阳光分布的差异",
    "没有事实错误"
  ],
  "justification": "响应以正确的科学推理准确解释了季节的原因。地轴倾斜及其对阳光分布的影响都得到了正确描述。",
  "improvement": "可以补充具体倾斜角度(23.5 度)以更完整。"
}

示例 2:带位置交换的成对比较

输入:

提示:“向初学者解释机器学习”
响应 A:[带有行话的技术解释]
响应 B:[基于简单类比解释]
标准:[“清晰度”, “可访问性”]

第一轮(A 在前):

{ "winner": "B", "confidence": 0.8 }

第二轮(B 在前):

{ "winner": "A", "confidence": 0.6 }

(注意:获胜者是 A,因为 B 处于第一位置)

映射后的第二轮结果:

{ "winner": "B", "confidence": 0.6 }

最终结果:

{
  "winner": "B",
  "confidence": 0.7,
  "positionConsistency": {
    "consistent": true,
    "firstPassWinner": "B",
    "secondPassWinner": "B"
  }
}

示例 3:评分标准生成

输入:

criterionName: “代码可读性”
criterionDescription: “代码理解和维护的容易程度”
domain: “软件工程”
scale: “1-5”
strictness: “平衡”

输出(缩写):

{
  "levels": [
    {
      "score": 1,
      "label": "差",
      "description": "代码难以理解,需要付出很大努力",
      "characteristics": [
        "没有有意义的变量或函数名称",
        "没有注释或文档",
        "深度嵌套或复杂的逻辑"
      ]
    },
    {
      "score": 3,
      "label": "一般",
      "description": "代码需要一些努力才能理解",
      "characteristics": [
        "大多数变量具有有意义的名称",
        "复杂部分有基本注释",
        "逻辑可理解,但可以更清晰"
      ]
    },
    {
      "score": 5,
      "label": "优秀",
      "description": "代码一目了然,易于维护",
      "characteristics": [
        "所有名称描述性强且一致",
        "全面的文档",
        "清晰、模块化的结构"
      ]
    }
  ],
  "edgeCases": [
    {
      "situation": "代码结构良好但使用了特定领域的缩写",
      "guidance": "根据对领域专家的可读性评分,而非普通受众"
    }
  ]
}

指南

  1. 始终要求评分前提供证据 - 证据优先的提示使判断易于审计,并减少无根据的数字评分

  2. 在成对比较中始终交换位置 - 单轮比较会被位置偏差破坏

  3. 将标尺粒度与评分标准细节相匹配 - 没有详细的等级描述不要使用 1-10 标尺

  4. 分离客观和主观标准 - 对客观标准使用直接评分,对主观标准使用成对比较

  5. 包含置信度分数 - 根据位置一致性和证据强度进行校准

  6. 明确定义边缘案例 - 模糊情况导致的评估方差最大

  7. 使用特定领域的评分标准 - 通用评分标准会产生通用(用处较小)的评估

  8. 对照人类判断进行验证 - 自动化评估只有在与人类评估相关时才有价值

  9. 监控系统性偏见 - 按标准、响应类型、模型跟踪分歧模式

  10. 为迭代而设计 - 评估系统通过反馈循环不断改进

陷阱

  1. 无理由的评分:评分缺乏根基,难以调试。始终在评分前要求基于证据的理由。

  2. 单轮成对比较:当位置没有交换时,位置偏差会破坏结果。始终交换位置评估两次并检查一致性。

  3. 过载的标准:同时衡量多个事项的标准会产生不可靠的分数。强制一个标准 = 一个可衡量的方面。

  4. 缺少边缘案例指导:没有明确的指令,评估者处理模糊案例的方式会不一致。在评分标准中包含边缘案例及明确的解决方案规则。

  5. 忽略置信度校准:高置信度的错误判断比低置信度的判断更糟糕。根据位置一致性和证据强度校准置信度。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

bdi-mental-states

This skill should be used when modeling agent mental states with BDI concepts: beliefs, desires, intentions, RDF-to-belief transformations, rational agency traces, cognitive agents, BDI ontologies, and neuro-symbolic AI integration.

book-sft-pipeline

This skill should be used for book-to-SFT pipelines: ePub extraction, literary segmentation, author-voice dataset construction, style-transfer training, LoRA workflows, and model evaluation for voice replication.

compaction-control-profiling

This skill should be used when deciding, for a specific model and workload, whether the harness or the model should control compaction, and when qualifying or calibrating that choice with measurements: context-budget sweeps that compare harness-driven and model-driven compaction on one harness, the context-pressure regime where delegation pays, a per-model compaction behavior profile (interface uptake, compression factor per call, reopen rate of archived content, context fill at first compaction, response to pressure warnings), context anxiety and timing-instruction calibration, reversible collapse-and-archive interfaces, and re-qualification after a model or prompt change. Route the editable-file protocol, harness invariants, and edit-position cache cost of self-editing agents to self-managed-context, summary content to context-compression, harness thresholds and cache layout to context-optimization, and general evaluation design to evaluation.

comprehensive-research-agent

Ensure thorough validation, error recovery, and transparent reasoning in research tasks with multiple tool calls

context-compression

This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve decisions, files, risks, and next actions.

context-degradation

This skill should be used for diagnosing and mitigating context degradation: lost-in-middle failures, context poisoning, context clash, context confusion, attention-pattern issues, and agent performance degradation caused by accumulated or conflicting context.

context-fundamentals

This skill should be used to explain or reason about the foundational concepts of context engineering: what context is, the anatomy of a context window, how attention mechanics work, the U-shaped attention curve, why context quality matters more than quantity, and the mental models needed to interpret every other context-engineering decision. Use this for conceptual explanation, onboarding, and background reading. Route operational work to the specialized skills: debugging attention failures goes to context-degradation, token-efficiency work goes to context-optimization, conversation summarization goes to context-compression, and project-shape decisions go to project-development.

context-optimization

This skill should be used for improving context efficiency: context budgeting, observation masking, prefix or KV-cache strategy, partitioning, token-cost reduction, retrieval scoping, and extending effective context capacity without lowering answer quality.

evaluation

This skill should be used when building agent evaluation systems: deterministic checks, regression suites, multi-dimensional rubrics, quality gates, production monitoring, baseline comparison, and outcome measurement for agent pipelines.

filesystem-context

This skill should be used when agent work needs file-backed context: durable scratchpads, tool-output offloading, just-in-time discovery, cross-agent handoff files, filesystem memory, or cleanup policies for context stored outside the prompt.

harness-engineering

This skill should be used when designing autonomous agent harnesses: research loops, evaluation scaffolds, locked and editable surfaces, durable logs, novelty gates, pruning, rollback, PR preparation, and human approval boundaries.

hosted-agents

This skill should be used when designing hosted or background agent infrastructure: sandboxed execution, remote coding environments, warm pools, session persistence, multiplayer collaboration, self-spawning agents, or Modal-style sandboxes.

instruction-surface-security

Hardens agent runtimes against persistent prompt injection or unauthorized changes to instructions and permissions. Use to audit what agents auto-load, design reviewed activation for project rules, skills, memory, or tool configuration, and test whether trust boundaries hold after reload, restart, or delegation.

latent-briefing

This skill should be used when the user asks to "share memory between agents", "KV cache compaction for multi-agent", "orchestrator worker context", "latent briefing", "reduce worker tokens", "cross-agent memory without summarization", or discusses Attention Matching compaction, recursive language models with workers, or token explosion in hierarchical agents.

long-horizon-prompting

This skill should be used when writing, enhancing, or evaluating the launch prompt for a long-running autonomous agent or a parallel multi-agent orchestration attacking a hard problem: pseudo-formal task briefs that define terms and an exact success predicate linguistically, enumerate non-counting outcomes, set persistence rules with explicit stop and return conditions and effort floors, manage a diverse portfolio of parallel approaches with an approach registry and blocked-route bookkeeping, and gate the return on adversarial audit. Route agent topology and coordination protocols to multi-agent-patterns, runtime control surfaces and loop governance to harness-engineering, evaluator and quality-gate construction to evaluation, judge design to advanced-evaluation, and compaction or memory mechanics to context-compression and memory-systems.

memory-systems

This skill should be used for persistent semantic memory in agent systems: cross-session knowledge retention, entity tracking, temporal validity, graph or vector retrieval, memory consolidation, and memory benchmark selection. Route file-backed scratchpads to filesystem-context, handoff summaries to context-compression, and token-efficiency tactics to context-optimization.

multi-agent-patterns

This skill should be used when designing multi-agent systems that need context isolation, supervisor or swarm coordination, explicit handoffs, parallel execution, or a decision on whether multiple agents are justified.

project-development

This skill should be used for project-level decisions about LLM-powered systems: whether an LLM is the right primitive for the task at hand, the shape of a multi-stage batch or agent pipeline, token and cost estimation, choosing between single-agent and multi-agent at the project level, structured output design for downstream parsing, and structuring agent-assisted iteration. Use this when the unit of work is a whole project or a multi-stage pipeline. Route individual tool design to tool-design and individual skill-loading or context-budget tactics to context-optimization.

self-improvement-loops

This skill should be used when the harness, scaffold, workflow, or optimizer itself is the optimization target: recursive self-improvement (RSI) loops, meta-harnesses, self-improving harnesses that mine their own failures and propose bounded edits, evolutionary or population-based search over agent scaffolds, acceptance gates for self-modifying systems, and agentic context evolution where the mechanism that produces context is versioned and evolved. Route governance of a single autonomous loop (locked surfaces, durable logs, rollback, novelty gates, approval boundaries) to harness-engineering, measurement and quality-gate design to evaluation, judge design to advanced-evaluation, and remote sandbox infrastructure to hosted-agents.

self-managed-context

This skill should be used when a model gets read-write control over its own live context window instead of a harness-scheduled compaction policy: the context exposed as an editable file the model rewrites with code tools, model-driven eviction and in-place updates, the harness invariants that keep self-editing safe (pinned prefix, edit gate, edit receipts, budget readouts, rollback on overflow), the prefix-cache cost of mid-context edits, and steering or training the model's own context-editing strategy. Route note content and fixed-threshold summarization to context-compression, cache-stable layout under harness control to context-optimization, file offloading to filesystem-context, and loop governance to self-improvement-loops.

相关技能