Community程式設計與開發github.com

進階評估

這個技能應用於進階 LLM 評估:以 LLM 為評審的系統、直接評分、兩兩比較、評分量尺校準、評估者偏誤緩解、信心分數評估以及自動化品質評估。

進階評估 是什麼?

這個技能專注於建構生產環境等級的 LLM 輸出評估系統,核心方法是「以 LLM 為評審」,並整合學術研究與業界實務。技能涵蓋兩大評估方法:直接評分(適用於有客觀標準的任務,如事實正確性)與兩兩比較(適用於主觀偏好,如語氣或風格),並深入探討位置偏誤、長度偏誤等常見系統性偏誤的緩解策略。此外,還提供評分量尺校準、信心分數校準以及評估管線設計的實作指南,並包含量產環境下的規模化評估策略,如 LLM 小組投票與階層式評估。此技能適用於 Claude Code、Cursor 等平台,幫助開發者建立可靠、可審計且與人類判斷高度相關的 AI 評估系統,避免常見的實作陷阱。

相容平台~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 比較兩個回應並選出較佳者。對於主觀任務,兩兩比較方法通常比開放式直接評分更能與人類偏好相關(聲明:進階評估-位置-交換)。需注意位置偏誤和長度偏誤。

偏誤概觀

在每個評估系統中減輕這些系統性偏誤:

位置偏誤:位於第一位置的回應會獲得優待。透過使用交換位置的方式評估兩次,然後套用多數決或一致性檢查來減輕。

長度偏誤:較長的回應不管品質如何都會獲得較高分數。透過明確提示忽略長度並套用長度正規化評分來減輕。

自我增強偏誤:模型對自己的輸出評分較高。透過使用不同的模型進行生成和評估來減輕。

冗詞偏誤:過多的細節即使不必要也會獲得較高分數。使用懲罰無關細節的特定標準評分量尺來減輕。

權威偏誤:自信的語氣不管正確性如何都會獲得較高分數。透過要求引用證據並加入事實查核層來減輕。

指標選擇框架

將指標與評估任務結構相匹配:

任務類型主要指標次要指標
二元分類(通過/失敗)召回率、精確率、F1 值Cohen'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}

## 標準
{for each criterion: name, description, weight}

## 指示
對於每個標準:
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}

## 比較標準
{criteria list}

## 指示
1. 先獨立分析每個回應
2. 根據每個標準比較它們
3. 決定總體勝出者並附上信心水準

## 輸出格式
包含每個標準的比較結果、總體勝出者、信心水準(0-1)以及理由的 JSON。

信心校準 — 將信心水準映射到位置一致性:

  • 兩次評審一致:信心 = 個別信心水準的平均值
  • 兩次評審不一致:信心 = 0.5,裁決 = 平手

評分量尺生成

生成評分量尺以減少與開放式評分相比的評估變異性。除非在目標評估集上進行測量,否則將確切的變異性減少視為特定於工作負載。

包含這些評分量尺組成部分:

  1. 等級描述:每個分數等級的明確邊界
  2. 特徵:定義每個等級的可觀察特徵
  3. 範例:每個等級的代表性文字(可選但有價值)
  4. 邊緣案例:針對模糊情況的指導
  5. 評分指南:一致應用的一般原則

根據使用案例設定嚴格度校準:

  • 寬鬆:較低的通過門檻,適用於鼓勵迭代
  • 平衡:典型的生產環境期望
  • 嚴格:針對安全關鍵或高風險評估的高標準

根據領域調整評分量尺 — 使用領域特定的術語。一個程式碼可讀性評分量尺應提及變數、函式和註解。一個醫療準確性評分量尺應引用臨床術語和證據標準。

實務指導

評估管線設計

使用以下層級建構生產環境評估系統:標準載入器(評分量尺 + 權重)-> 主要評分器(直接或兩兩)-> 偏誤緩解(位置交換等)-> 信心評分(校準)-> 輸出(分數 + 理由 + 信心)。完整的視覺佈局請參閱評估管線圖。

決策框架:直接 vs. 兩兩比較

套用此決策樹:

是否存在客觀黃金標準?
+-- 是 -> 直接評分
|   範例:事實正確性、指令遵循、格式符合性
|
+-- 否 -> 是偏好還是品質判斷?
    +-- 是 -> 兩兩比較
    |   範例:語氣、風格、說服力、創造力
    |
    +-- 否 -> 考慮基於參考的評估
        範例:摘要(與來源比較)、翻譯(與參考文獻比較)

規模化評估

對於大量評估,套用以下策略之一:

  1. LLM 小組 (PoLL):使用多個模型作為評審並匯總投票,以減少個別模型的偏誤。對於高風險決策較昂貴但更可靠。

  2. 階層式評估:使用快速便宜的模型進行篩選,並使用昂貴的模型處理邊緣案例。需要校準篩選門檻。

  3. 人在迴圈中:自動處理明確案例,並將低信心決策路由給人類審查。設計回饋循環以隨著時間改進自動化評估。

範例

範例 1:用於準確性的直接評分

輸入:

提示:「什麼原因導致地球的季節?」
回應:「季節是由地球傾斜的地軸造成的。當地球繞太陽運行時,
不同的半球在一年中的不同時間接收到更直接的陽光。」
標準:事實準確性(權重:1.0)
量尺:1-5

輸出:

{
  "criterion": "Factual Accuracy",
  "score": 5,
  "evidence": [
    "Correctly identifies axial tilt as primary cause",
    "Correctly explains differential sunlight by hemisphere",
    "No factual errors present"
  ],
  "justification": "Response accurately explains the cause of seasons with correct
scientific reasoning. Both the axial tilt and its effect on sunlight distribution
are correctly described.",
  "improvement": "Could add the specific tilt angle (23.5 degrees) for completeness."
}

範例 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.

相關技能