返回列表
🧠 阿头学 · 💬 讨论题

AI 工程评估:从一次性技巧到复利型基础设施

AI 产品的核心壁垒已从提示词与基座模型转移至可复现的评估基础设施,忽视方差控制与错误归因的团队将在生产环境中遭遇可靠性崩塌。
打开原文 ↗

2026-10-29 原文链接 ↗
阅读简报
双语对照
完整翻译
原文
讨论归档

核心观点

  • 评估资产复利化 提示词与模型迭代极快且易被替代,唯有版本化黄金数据集与自动化评估流水线能随时间沉淀业务边界,是团队唯一具备长期复利的核心资产。
  • 可靠性依赖概率乘法 生产环境必须采用 pass^k 而非 pass@k 作为验收标准,单次 80% 成功率在连续调用下会断崖式跌至 33%,忽略方差控制必然导致线上信任危机。
  • 确定性断言优先于模型评分 必须用 JSON 校验与正则等零方差手段拦截基础错误,将昂贵的 LLM 评判器降级为处理主观语义的最后防线,否则评测成本与噪声将彻底失控。
  • RAG 与 Agent 必须拆解归因 混合评估最终答案会掩盖系统瓶颈,检索质量与生成忠实度必须分离,Agent 轨迹的步数与成本超标应直接判定为工程 Bug 而非鲁棒性表现。

跟我们的关联

  • 对 Neta 意味着现有测试流程已失效,必须立即转向错误驱动的逆向构建流,下一步需按失败类别设定 CI 硬性拦截阈值,否则线上质量将不可控。
  • 对 ATou 意味着全局虚荣指标会掩盖核心体验倒退,必须将 pass^k 与成本延迟数据作为发布红线,下一步需在 PR 合入前强制运行评估套件,杜绝主观拍板。
  • 对 Uota 意味着静态数据集会随业务演进迅速腐化,必须建立线上失败案例自动回流标注的闭环,下一步需定期用人工样本校准 LLM 评判器的 TPR/TNR,防止指标漂移。

讨论引子

  • 在算力与人力受限的 MVP 阶段,如何在不陷入“过度工程”的前提下,裁剪出 ROI 最高的轻量级评估流水线?
  • 当 LLM 评判器自身存在位置偏差与长度偏好时,如何设计低成本的控制变量实验,确保自动化评分不会触发 Goodhart 定律导致系统“刷分”?

评估(Evals)是 AI 工程中最被低估的技能。

  1. 从错误分析开始,而非指标 抽样 100 条以上的生产环境追踪(traces)。用自由文本标注每次失败(开放式编码,open coding),然后将其聚类为不同的失败类别(主轴编码,axial coding)。统计每个类别的频次。排名前 3 的类别就是你的首批指标。

  2. 构建版本化的黄金数据集(golden dataset) 将输入、预期输出或评分标准(rubrics)以及元数据(意图、难度、用户细分)存储在版本化数据集中。对其进行分层抽样(stratify),确保罕见但关键的用例不会被简单用例淹没。将其与你的提示词(prompts)同步进行版本管理,以确保每个得分都可复现。

  3. 沿显式维度生成合成数据 不要仅仅向 LLM 索要“测试问题”。定义维度(用户画像 × 意图 × 复杂度 × 边缘情况),将组合生成为元组(tuples),然后将每个元组转化为自然输入。这样你获得的是测试覆盖率,而不是 200 个几乎相同的样本。

  4. 优先使用确定性断言(deterministic assertions) JSON 模式校验、正则检查、必填字段、长度限制、代码执行,以及在测试数据库中实际运行的 SQL。这些方法成本低、速度快且方差为零。将基于模型的评分(model-based grading)保留给代码确实无法检查的内容。

  5. 将检索与生成分开评估 对于 RAG,使用 recall@k、MRR 或 nDCG 针对已标注的相关片段(chunks)来衡量检索效果。使用忠实度(faithfulness,即每个论断是否都有检索到的上下文支持)来衡量生成效果。如果你只对最终答案进行评分,将无法判断究竟是哪一半出了问题。

  6. 针对智能体(agents)的轨迹评估(Trajectory evals) 记录每一步:工具名称、参数、结果、token 数量。参照参考路径(reference path)对工具调用的精确率与召回率、参数正确性、步骤数以及错误恢复能力进行评分。如果一个智能体(agent)在 3 次调用就能搞定的情况下却用了 14 次调用才得出正确答案,这就是一个成本与延迟(latency)层面的 Bug。

  7. pass@k vs pass^k pass@k = 在 k 次运行中至少成功一次。pass^k = 在 k 次运行中全部成功。在单次运行成功率为 80% 的情况下,pass^5 会骤降至约 33%。生产环境的可靠性体现在 pass^k 上,因此请使用你实际的温度参数(temperature)对每个用例进行多次运行。

  8. 用于多轮对话的模拟用户(Simulated users) 为 LLM 设定一个用户画像(persona)、一个隐藏目标以及约束条件,然后让它与你的系统进行对话,直到目标达成或达到轮次上限。对目标完成度、解决所需的轮次以及违规情况进行评分。单轮评估(Single-turn evals)会漏掉大部分状态与记忆(memory)方面的 Bug。

  9. 像训练分类器一样对齐你的 LLM 评判器(judge) 人工标注 100 个以上的样本为通过/失败(pass/fail)。将其划分为训练/开发/测试集(train/dev/test)。使用开发集迭代评判器的提示词(prompt),然后在测试集上报告 TPR(真阳性率)和 TNR(真阴性率)。使用带有书面评分标准(rubric)的二元输出,要求在给出最终判定前提供简短的批评意见,并锁定评判模型版本。

  10. 在成对比较中控制评判器偏差(bias) LLM 评判器存在位置偏差(position bias),且往往偏好更长的回答。将每项 A/B 比较以调换顺序的方式运行两次,只统计一致的判定结果。如果冗长(verbosity)导致结果偏移,则需对长度进行归一化或设限。

  11. 尊重统计学 在 100 个样本且准确率为 80% 的情况下,95% 的置信区间(confidence interval)约为 ±8 个百分点。从 80% 跃升至 83% 很可能只是噪声。在宣布取得胜利之前,请使用自举法(bootstrapped)置信区间,或对相同样本进行配对测试(paired test)。

  12. 在 CI 中把关部署 在每个涉及提示词、模型、工具或检索配置的 PR 上运行评估套件(eval suite)。按类别设定阈值,而不是仅看一个全局得分,这样某一方面的大幅提升就不会掩盖另一方面的性能倒退(regression)。一旦出现倒退,就让构建失败。

  13. 生产环境中的在线评估(Online evals) 抽样一定比例的实时流量,异步运行你的评判器,并针对每个失败类别的漂移(drift)发出警报。使用影子部署(shadow deployments)在真实流量上运行新提示词或模型,而无需向用户展示输出。

  14. 将成本与延迟作为一等指标(first-class metrics) 在关注质量的同时,追踪每次请求的 token 数量、每个成功任务的成本(而非每次调用的成本)以及 p50/p95 延迟。一项在保持质量平稳的同时削减 40% 成本的改动是真正的胜利,值得发布上线。

  15. 闭环 每个生产环境的失败案例都会转化为一个新的已标注测试用例。每个新模型发布后,都要在任何人讨论是否切换之前先运行完整评估套件。随着时间的推移,你的评估集将成为代码库中最有价值的资产。

提示词是一次性的。模型每隔几个月就会被替换。

你的评估基础设施才是能产生复利(compounds)的资产。

Evals are the most underrated skill in AI engineering.

评估(Evals)是 AI 工程中最被低估的技能。

  1. Start with error analysis, not metrics Sample 100+ production traces. Annotate each failure in free text (open coding), then cluster them into failure categories (axial coding). Count frequency per category. Your top 3 categories are your first metrics.
  1. 从错误分析开始,而非指标 抽样 100 条以上的生产环境追踪(traces)。用自由文本标注每次失败(开放式编码,open coding),然后将其聚类为不同的失败类别(主轴编码,axial coding)。统计每个类别的频次。排名前 3 的类别就是你的首批指标。
  1. Build a versioned golden dataset Store inputs, expected outputs or rubrics, and metadata (intent, difficulty, user segment) in a versioned dataset. Stratify it so rare but critical cases aren't drowned out by easy ones. Version it alongside your prompts so every score is reproducible.
  1. 构建版本化的黄金数据集(golden dataset) 将输入、预期输出或评分标准(rubrics)以及元数据(意图、难度、用户细分)存储在版本化数据集中。对其进行分层抽样(stratify),确保罕见但关键的用例不会被简单用例淹没。将其与你的提示词(prompts)同步进行版本管理,以确保每个得分都可复现。
  1. Generate synthetic data along explicit dimensions Don't just ask an LLM for "test questions." Define dimensions (persona × intent × complexity × edge case), generate combinations as tuples, then turn each tuple into a natural input. You get coverage instead of 200 near-identical examples.
  1. 沿显式维度生成合成数据 不要仅仅向 LLM 索要“测试问题”。定义维度(用户画像 × 意图 × 复杂度 × 边缘情况),将组合生成为元组(tuples),然后将每个元组转化为自然输入。这样你获得的是测试覆盖率,而不是 200 个几乎相同的样本。
  1. Deterministic assertions first JSON schema validation, regex checks, required fields, length limits, code execution, SQL that actually runs against a test DB. These are cheap, fast, and have zero variance. Reserve model-based grading for what code genuinely can't check.
  1. 优先使用确定性断言(deterministic assertions) JSON 模式校验、正则检查、必填字段、长度限制、代码执行,以及在测试数据库中实际运行的 SQL。这些方法成本低、速度快且方差为零。将基于模型的评分(model-based grading)保留给代码确实无法检查的内容。
  1. Evaluate retrieval separately from generation For RAG, measure retrieval with recall@k, MRR, or nDCG against labeled relevant chunks. Measure generation with faithfulness (is every claim supported by retrieved context?). If you only score the final answer, you can't tell which half is broken.
  1. 将检索与生成分开评估 对于 RAG,使用 recall@k、MRR 或 nDCG 针对已标注的相关片段(chunks)来衡量检索效果。使用忠实度(faithfulness,即每个论断是否都有检索到的上下文支持)来衡量生成效果。如果你只对最终答案进行评分,将无法判断究竟是哪一半出了问题。
  1. Trajectory evals for agents Log every step: tool name, arguments, result, tokens. Score tool-call precision and recall against a reference path, argument correctness, step count, and error recovery. An agent that reaches the right answer in 14 calls when 3 would do is a cost and latency bug.
  1. 针对智能体(agents)的轨迹评估(Trajectory evals) 记录每一步:工具名称、参数、结果、token 数量。参照参考路径(reference path)对工具调用的精确率与召回率、参数正确性、步骤数以及错误恢复能力进行评分。如果一个智能体(agent)在 3 次调用就能搞定的情况下却用了 14 次调用才得出正确答案,这就是一个成本与延迟(latency)层面的 Bug。
  1. pass@k vs pass^k pass@k = succeeded at least once in k runs. pass^k = succeeded in all k runs. At 80% per-run success, pass^5 drops to roughly 33%. Production reliability lives in pass^k, so run each case multiple times at your real temperature.
  1. pass@k vs pass^k pass@k = 在 k 次运行中至少成功一次。pass^k = 在 k 次运行中全部成功。在单次运行成功率为 80% 的情况下,pass^5 会骤降至约 33%。生产环境的可靠性体现在 pass^k 上,因此请使用你实际的温度参数(temperature)对每个用例进行多次运行。
  1. Simulated users for multi-turn Give an LLM a persona, a hidden goal, and constraints, then let it converse with your system until the goal is met or a turn limit hits. Grade goal completion, turns-to-resolution, and policy violations. Single-turn evals miss most state and memory bugs.
  1. 用于多轮对话的模拟用户(Simulated users) 为 LLM 设定一个用户画像(persona)、一个隐藏目标以及约束条件,然后让它与你的系统进行对话,直到目标达成或达到轮次上限。对目标完成度、解决所需的轮次以及违规情况进行评分。单轮评估(Single-turn evals)会漏掉大部分状态与记忆(memory)方面的 Bug。
  1. Align your LLM judge like a classifier Hand-label 100+ examples as pass/fail. Split into train/dev/test. Iterate on the judge prompt using dev, then report TPR and TNR on test. Use binary outputs with a written rubric, require a short critique before the verdict, and pin the judge model version.
  1. 像训练分类器一样对齐你的 LLM 评判器(judge) 人工标注 100 个以上的样本为通过/失败(pass/fail)。将其划分为训练/开发/测试集(train/dev/test)。使用开发集迭代评判器的提示词(prompt),然后在测试集上报告 TPR(真阳性率)和 TNR(真阴性率)。使用带有书面评分标准(rubric)的二元输出,要求在给出最终判定前提供简短的批评意见,并锁定评判模型版本。
  1. Control judge bias in pairwise comparisons LLM judges have position bias and often prefer longer answers. Run every A/B comparison twice with swapped order and only count consistent verdicts. Normalize or cap length if verbosity is skewing results.
  1. 在成对比较中控制评判器偏差(bias) LLM 评判器存在位置偏差(position bias),且往往偏好更长的回答。将每项 A/B 比较以调换顺序的方式运行两次,只统计一致的判定结果。如果冗长(verbosity)导致结果偏移,则需对长度进行归一化或设限。
  1. Respect statistics With 100 examples at 80% accuracy, your 95% confidence interval is about ±8 points. A jump from 80% to 83% is probably noise. Use bootstrapped confidence intervals, or a paired test on the same examples, before declaring a win.
  1. 尊重统计学 在 100 个样本且准确率为 80% 的情况下,95% 的置信区间(confidence interval)约为 ±8 个百分点。从 80% 跃升至 83% 很可能只是噪声。在宣布取得胜利之前,请使用自举法(bootstrapped)置信区间,或对相同样本进行配对测试(paired test)。
  1. Gate deploys in CI Run the eval suite on every PR that touches prompts, models, tools, or retrieval config. Set per-category thresholds instead of one global score, so a big win in one area can't hide a regression in another. Fail the build on a regression.
  1. 在 CI 中把关部署 在每个涉及提示词、模型、工具或检索配置的 PR 上运行评估套件(eval suite)。按类别设定阈值,而不是仅看一个全局得分,这样某一方面的大幅提升就不会掩盖另一方面的性能倒退(regression)。一旦出现倒退,就让构建失败。
  1. Online evals in production Sample a percentage of live traffic, run your judges asynchronously, and alert on drift per failure category. Use shadow deployments to run a new prompt or model on real traffic without showing users the output.
  1. 生产环境中的在线评估(Online evals) 抽样一定比例的实时流量,异步运行你的评判器,并针对每个失败类别的漂移(drift)发出警报。使用影子部署(shadow deployments)在真实流量上运行新提示词或模型,而无需向用户展示输出。
  1. Make cost and latency first-class metrics Track tokens per request, cost per successful task (not per call), and p50/p95 latency next to quality. A change that keeps quality flat while cutting cost 40% is a real win and deserves to ship.
  1. 将成本与延迟作为一等指标(first-class metrics) 在关注质量的同时,追踪每次请求的 token 数量、每个成功任务的成本(而非每次调用的成本)以及 p50/p95 延迟。一项在保持质量平稳的同时削减 40% 成本的改动是真正的胜利,值得发布上线。
  1. Close the loop Every production failure becomes a new labeled test case. Every new model release gets run against the full suite before anyone debates switching. Over time your eval set becomes the most valuable asset in the codebase.
  1. 闭环 每个生产环境的失败案例都会转化为一个新的已标注测试用例。每个新模型发布后,都要在任何人讨论是否切换之前先运行完整评估套件。随着时间的推移,你的评估集将成为代码库中最有价值的资产。

Prompts are disposable. Models get replaced every few months.

提示词是一次性的。模型每隔几个月就会被替换。

Your eval infrastructure is what compounds.

你的评估基础设施才是能产生复利(compounds)的资产。

Evals are the most underrated skill in AI engineering.

  1. Start with error analysis, not metrics Sample 100+ production traces. Annotate each failure in free text (open coding), then cluster them into failure categories (axial coding). Count frequency per category. Your top 3 categories are your first metrics.

  2. Build a versioned golden dataset Store inputs, expected outputs or rubrics, and metadata (intent, difficulty, user segment) in a versioned dataset. Stratify it so rare but critical cases aren't drowned out by easy ones. Version it alongside your prompts so every score is reproducible.

  3. Generate synthetic data along explicit dimensions Don't just ask an LLM for "test questions." Define dimensions (persona × intent × complexity × edge case), generate combinations as tuples, then turn each tuple into a natural input. You get coverage instead of 200 near-identical examples.

  4. Deterministic assertions first JSON schema validation, regex checks, required fields, length limits, code execution, SQL that actually runs against a test DB. These are cheap, fast, and have zero variance. Reserve model-based grading for what code genuinely can't check.

  5. Evaluate retrieval separately from generation For RAG, measure retrieval with recall@k, MRR, or nDCG against labeled relevant chunks. Measure generation with faithfulness (is every claim supported by retrieved context?). If you only score the final answer, you can't tell which half is broken.

  6. Trajectory evals for agents Log every step: tool name, arguments, result, tokens. Score tool-call precision and recall against a reference path, argument correctness, step count, and error recovery. An agent that reaches the right answer in 14 calls when 3 would do is a cost and latency bug.

  7. pass@k vs pass^k pass@k = succeeded at least once in k runs. pass^k = succeeded in all k runs. At 80% per-run success, pass^5 drops to roughly 33%. Production reliability lives in pass^k, so run each case multiple times at your real temperature.

  8. Simulated users for multi-turn Give an LLM a persona, a hidden goal, and constraints, then let it converse with your system until the goal is met or a turn limit hits. Grade goal completion, turns-to-resolution, and policy violations. Single-turn evals miss most state and memory bugs.

  9. Align your LLM judge like a classifier Hand-label 100+ examples as pass/fail. Split into train/dev/test. Iterate on the judge prompt using dev, then report TPR and TNR on test. Use binary outputs with a written rubric, require a short critique before the verdict, and pin the judge model version.

  10. Control judge bias in pairwise comparisons LLM judges have position bias and often prefer longer answers. Run every A/B comparison twice with swapped order and only count consistent verdicts. Normalize or cap length if verbosity is skewing results.

  11. Respect statistics With 100 examples at 80% accuracy, your 95% confidence interval is about ±8 points. A jump from 80% to 83% is probably noise. Use bootstrapped confidence intervals, or a paired test on the same examples, before declaring a win.

  12. Gate deploys in CI Run the eval suite on every PR that touches prompts, models, tools, or retrieval config. Set per-category thresholds instead of one global score, so a big win in one area can't hide a regression in another. Fail the build on a regression.

  13. Online evals in production Sample a percentage of live traffic, run your judges asynchronously, and alert on drift per failure category. Use shadow deployments to run a new prompt or model on real traffic without showing users the output.

  14. Make cost and latency first-class metrics Track tokens per request, cost per successful task (not per call), and p50/p95 latency next to quality. A change that keeps quality flat while cutting cost 40% is a real win and deserves to ship.

  15. Close the loop Every production failure becomes a new labeled test case. Every new model release gets run against the full suite before anyone debates switching. Over time your eval set becomes the most valuable asset in the codebase.

Prompts are disposable. Models get replaced every few months.

Your eval infrastructure is what compounds.

📋 讨论归档

讨论进行中…